How to stack all items in a Magento basket?

Well, I have no idea how to do this. All I need is to sort out the three items that I have in the basket, so I can get information about each of them - for example, product category, item name, blah blah blah. I tried this for several hours for an hour and found nothing in what seems like such a simple task. Getting a quote and then getAllItems () returns nothing for me. Anyone have any ideas / links?

Thank.

+3
source share
1 answer

Are you sure the receipt of the quote does not work? The following code should work:

$session = Mage::getSingleton('checkout/session');
foreach ($session->getQuote()->getAllItems() as $item) {
    print_r($item->getData());
}

Of course, if you do not do this from the Magento template / controller / model, you need to configure the environment accordingly:

require_once 'app/Mage.php';
umask(0);
Mage::app();

/* Then put your code here.. */
+12

Source: https://habr.com/ru/post/1787962/


All Articles