Categories


Recent Posts


Archives


June, 2011 20

One Line Observers

I’ve started creating single line observers like this <?php class Mycompany_Mymodule_Model_Observer { public function someMethod($observer) { Mage::helper('mycompany_mymodule/observer') ->someMethod($observer->getCustomer()); } } The logic is punted to a helper class. This way the helper receives only the objects it needs [...]

astorm

SQL Headquarters

There’s more sophisticated ways of logging and profiling SQL in Magento these days, but sometimes it’s still easier and quicker to drop down to the abstract Zend adapter and log your queries with a few discrete calls to Mage::Log Almost every INSERT, UPDATE, SELECT, and DELETE goes through the methods in [...]

astorm

We have an extension that uses Ajax to change what shipping rates are shown in a weekly date/time grid @webshopapps, in response to my question “Hey magento people, are there are any extensions (free/paid) that add Ajax features to the checkout page?”

astorm

PHP Patterns in Magento

In many programming languages, especially the less strictly typed ones, a common coding pattern starts to emerge. $thing = $this->getSomeThing(); if($thing) { //do something with the thing } Without a compiler to catch methods returning what they shouldn’t, a developer is forced to sanity check return values from methods before [...]

astorm

Editing Email Templates

Magento Version: 1.5.0.1 I’m not sure when this feature was added. It’s there in 1.5.0.1 and might be in previous version. The phtml template file for your system emails are located in app/locale/en_US/template/email/ However, you don’t want to edit these files. Instead, go to System -> Transactional Emails This UI [...]

astorm

404 Debugging

Magento Version: 1.4.2 I’ve found that most of my route based 404 problems in Magento can be traced a misnamed controller file and/or class. Adding some debugging to the standard router’s _validateControllerClassName method often point to the problem. In 1.4.2 you can find this file here.

astorm

sales_model_service_quote_submit_before, sales_model_service_quote_submit_success, sales_model_service_quote_submit_after. All of these are in Sales/Model/Service/Quote.php in submitOrder() method. Zoran Lazarevski, when asked What event(s) are you using to “do something” after checkout/order-creation, regardless of method?

astorm

sales_model_service_quote_submit_before, sales_model_service_quote_submit_success, sales_model_service_quote_submit_after. All of these are in Sales/Model/Service/Quote.php in submitOrder() method. Zoran Lazarevski, when asked What event(s) are you using to “do something” after checkout/order-creation, regardless of method?

astorm
email hidden; JavaScript is required