Posted on | June 4, 2016 | No Comments
When dealing with Magento, the common knowledge to bulk update products is to pull in a collection and, in a loop, load the product, change the attribute and save.
A client is syncing their product database from their system to Magento, but their system only allows a product to be in one category. I was asked to run a cron script nightly to check for an attribute on the product and place those products into an additional category.
Knowing how slow save() is, I started to dig around and come up with the below code.
Benchmarking this code against the regular way of doing it, I saw the times drop from about an hour and a half for 1,200 products to five seconds!
Posted on | March 11, 2015 | No Comments
When viewing a product we all like to see what other people have said about it, so our first stop is to look at the overall customer rating for this product. This is usually in the form of empty/full/partially filled stars out of five.
This blog post will teach you how to create a stars-rating using very little HTML and CSS.
Posted on | November 3, 2014 | No Comments
Posted on | May 15, 2014 | 1 Comment
Something I use at work is a task-tracking website. At the basic level, you give the task a short title, a long description, one or more flags, and estimate how long it will take to complete. A cool feature of this website is that they offer an api for registered users.
The boss wants any IT support issues to be logged into this task-tracking website so that any of the support team can see what has or has not been started and fix the issue.
All issues for IT support are being sent to a single mailing list on Gmail. This, I thought, is a perfect opportunity to play with Google Apps Scripts.
In this blog post I am going to show how to get your recent emails from Gmail, and POST to an API depending on the email’s label.
Posted on | September 4, 2013 | No Comments
On any website that does any form of background operation that prevents the user from progressing immediately (for example an ajax operation that updates search filters based on the currently selected option) then the user needs to be informed.
Posted on | May 31, 2013 | 2 Comments
Sometimes you may think you are doing a nice simple effect in jQuery. In reality, you are making hundreds of unnecessary DOM calls and updates every second. And you wonder why the effect is taking so long to run.
This post hopes to teach you how to optimise your code to run that little bit quicker.
Posted on | May 28, 2013 | No Comments
Ah the strength and failings of Magento. Of all its features, the ability to control nearly all of the layout from a single local.xml file is my favourite. One of the main features of this approach is that you can call functions (called actions) to add, remove or override values for the block you are working on. But what is the correct way to specify the value?
Posted on | May 13, 2013 | 12 Comments
Where I work nearly every other developer is using Sublime 2, whereas I am working on Notepad++. Having seen the features and the way the other developers have set up their Sublime 2 environments, I have fought against the peer-pressure as I believe that Notepad++ is the same as (if not better than) Sublime 2 as both use plugins to do pretty much the same thing.
Here is your chance to change that. This poll will be ran for a few weeks, then I will go with the winning option.
Posted on | April 18, 2013 | 6 Comments
Routing is the action of taking the requested url and pointing the application to the correct module, controller, and action so that the request can be correctly processed. There are a number of ways to implement this using the Zend Framework, the most common of which is to create a routing object in the application bootstrap file. An alternative, which this blog post explores, is to store all possible urls in your database, with the corresponding default route stored alongside it.
Posted on | December 20, 2012 | 1 Comment
Some websites with external links have a small image or icon to indicate that the link will lead them to an external webpage. Here is a simple CSS trick to show an html entity indicating an external link:keep looking »