Add order history comment in Magento 1.9

The method used in older version was deprecated.
The new methods are:
– $order->addStatusHistory($historyItem)
– $order->addStatusHistoryComment(“Comment”)

If you also have to set the Customer Notification flag, you should rather use the first option by creating first a Mage_Sales_Model_Order_Status_History object.

$historyItem = new Mage_Sales_Model_Order_Status_History();
$historyItem->setComment(‘Order confirmation e-mail sent by cronjob’);


Updating Google Analytics Tracking on your Magento e-shop

Google Analytics has recently changed the tracking scripts from ga.js to a more optimised version analytics.js that can be used if you set your analytics account to “Universal tracking”
Yet, Magento’s Google Analytics module is still using the old ga.js.
Of course, there are a couple of new plugins that claim to fix this, but why use a plugin to slow down your shop instead of updating 2 files and not affecting in any way the performance of your website?

Wait! Did I say updating? That should already ring a bell for a Magento developer.
The internet is full of blog articles and answers on StackOverflow advising to actually edit the existing GoogleAnalytics Module and Template files.
One could never be more wrong than that. It’s one of the first things a developer should learn about developing and extending Magento features. Never touch the core/default Modules and Templates. Create new ones under the “local” folder.

This, together with the Google Analytics Universal Tracking documentation should give you all the necessary hints and information in order to update your tracking code.

If you still can’t get it done, contact me and we can talk about contracting me to do it for you, or contracting me to provide you with a training on how you can do it yourself.¬†