Want to test the Magento 2 success page after making some changes there without placing many orders in your Magento 2 store? By changing the following code in vendor/magento/module-checkout/Controller/Onepage/Success.php you only have to place one order. So look for the…
Getting order items on success page (success.phtml) (Magento 1)
Use the following code to get all ordered items on the Magento success page.
1 2 3 4 5 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $items = $order->getAllItems(); foreach($items as $item) { //... } |
Getting custom options of ordered items on success page (success.phtml) (Magento 1)
Using the folowing code you can get the custom options of the ordered items on the Magento success page.
1 2 3 4 5 6 7 8 9 10 |
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $items = $order->getAllItems(); foreach($items as $item) { $options = $item->getProductOptions(); foreach ($options['options'] as $itemOption) { $optionTitle = $itemOption['title']; $optionValue = $itemOption['value']; //... } } |