Casting Image Helpers
Casting Image Helpers Image helper objects are tricky. Instead of having a “get image url” function, you cast them as a string to get the URL, or more commonly, let PHP cast them in echo statements automatically. However, if you’re not familiar with PHP’s casting rules, it look like the init method returns a [...]
astormCustomer Confirmation
This one’s a little un-intuitive. At first. There are times where you’ll want to programmatically check if a customer is confirmed. To do this you’d instantiate a customer object like this $customer = Mage::getModel('customer/customer')->getCollection() ->addFieldToFilter('entity_id','197') ->getFirstItem(); or [...]
astormSQL 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 [...]
astormCheckItOut @andkorolyov, in response to my question “Hey magento people, are there are any extensions (free/paid) that add Ajax features to the checkout page?”
astormWe 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?”
astormMagento Custom Form Validation
Magento’s form validation seems scary at first, but using it is actually quite easy. First, create for your form. <form action="<?php echo $this->getUrl('/some/route/thing');?>" id="theForm"> <input type="text" name="foo" id="foo" /> </form> Next, run this bit of javascript to turn your plain old form [...]
astormSafari Keeps Showing “Please Enable Cookies” Page
Lots of kind souls helped me out on Twitter with this one. Some versions of Safari are stricter about setting cookies than others. Also, Magento sets the full cookie domain and path as well, which is where weird cookie bugs can lie. If you’re having trouble setting your session Magento (i.e. “Please Enable Cookies, you [...]
astormEditing 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 [...]
astormsales_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?
astormI use the event ‘checkout_submit_all_after’. Yes the order has been saved by the time this event is fired. Jason Evans, when asked What event(s) are you using to “do something” after checkout/order-creation, regardless of method?
astormThere is no sure method except sales_order_save_after, but generally I tend to use sales_model_service_quote_submit_after. It covers opc, api and adminhtml (but not multiaddress). sales_convert_quote_address_to_order covers all, but I don’t like it. Vinai Kopp, when asked What event(s) are you using to “do something” [...]
astormNo Product Images in Admin
Magento Version: 1.5.0.1 We’d just done a simple product import, and everything in the front end of the cart looked fine. There was one problem. When we browsed to the admin, no images showed up in the Catalog -> Manage Products -> Images. It turns out that the catalog/product object has a few redundancies when it comes to [...]
astorm