Cancel addStatusHistory with an Observer

Cancel addStatusHistory with an Observer

Create a new observer on the config.xml of your module : <events> <sales_order_save_before> <observers> <mypackage_mymodule_cancel_add_history> <class>mymodule/observer</class> <method>cancelAddHistory</method> </mypackage_mymodule_cancel_add_history> </observers> </sales_order_save_before> </events> Create this observer : <?php class Mypackage_Mymodule_Model_Observer { public function cancelAddHistory(Varien_Event_Observer $observer) { $order = $observer->getEvent()->getOrder(); // My logic

Get a product’s attribute without load (with label)

Get a product’s attribute without load (with label)

Sometimes, you need to get a precise information about a product, and it’s very boring to load it. Two methods are possible : Collection method $productId = 25; // Your product ID $model = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSelect(‘attribute_code’) ->addAttributeToFilter(‘entity_id’,$productId) ->getFirstItem(); $attribute_value

We use cookies to ensure that we give you the best experience on our website.
Ok