Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $objectManager = MagentoFrameworkAppObjectManager::getInstance();
  2. $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
  3. $connection = $resource->getConnection();
  4.  
  5. $sqlx = "SELECT * FROM sales_order ORDER BY entity_id DESC LIMIT 1";
  6. $connection->query($sqlx);
  7. $resultx = $connection->fetchAll($sqlx);
  8. foreach($resultx as $resulx)
  9. {
  10. $entityid = $resulx['entity_id'];
  11. }
  12.  
  13. $sql = "SELECT * FROM sales_order_item WHERE order_id='$entityid'";
  14. $connection->query($sql);
  15. $results = $connection->fetchAll($sql);
  16.  
  17. foreach($results as $result)
  18. {
  19. $item_id = $result['item_id'];
  20.  
  21. /* DO WHATEVER YOU WANT HERE */
  22.  
  23. $upsql = "UPDATE sales_order_item SET product_options='$finalque' WHERE item_id='$item_id'";
  24. $connection->query($upsql);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement