Archive for August 2017

Pass information from Observer via session

Step 1: Mage::dispatchEvent(’my_event’); Step 2: link method MyEvent to event “my_event” in your module’s config.xml file Observer.php public function MyEvent(Varien_Event_Observer $observer) { Mage::getSingleton(’customer/session’)->setData(’my_event’, ‘results’); } } Step 3: $result = Mage::getSingleton(’customer/session’)->getData(’my_event’));

Load Sales/quote by id returns empty data

$quote = Mage::getModel(’sales/quote’)->loadByIdWithoutStore($quoteId); instead of $quote = Mage::getModel(’sales/quote’)->load($quoteId); because the regular Mage_Sales_Model_Quote::load() function automatically attaches the current storeview to load the quote object. In this case the storeview is admin, which means no results will be found for the quote id and the returned object is empty.