Magento Create Category Method

Ideal to drop into a helper, this is a simplified create category method. You need to specify the name, store_id and parent category id and can optionally set to active, anchor and change the display mode if you wish. public function createCategory($name, $store_id, $parent_id, $active = 0, $anchor = 0, $display_mode='PRODUCTS') { $parent = Mage::getModel('catalog/category')->load($parent_id); if($parent->getId() != $parent_id){ Mage::helper('exception')->except('Failed to load parent category', 'Fatal'); } $category = Mage::getModel('catalog/category'); /* @var Read On →

Restore lessc -w functionality, extendable to anything that needs to watch a file.

The latest version of the less compiler in ruby has reduced the functionality of watching a file, so we wrote this little script (which we put in ~/bin/lessc-w) to restore the old functionality : #!/bin/bash LESSFILE=$1 CSSFILE=`basename $1 .less`.css if [ "$2" != "-f" ]; then if [ "`file -b $LESSFILE`" != "ASCII text" ]; then echo "file $1 doesn't look like a less file...., looks like a `file -b $LESSFILE`"; echo "usage: lessc-w lessfile.less [-f]"; exit fi fi while true; do inotifywait -e modify $LESSFILE && \ echo "Rebuilding styles" && \ lessc $LESSFILE > $CSSFILE done As you can see it’s very simple to tweak this to any program that needs to be run when a file is changed.

Netbeans AutoComplete on Magento Objects called by Mage::getModel()

As we have been working with the various versions of Magento its nice to see more and more use of DocBlock notation to help IDEs auto suggest and auto complete methods etc when working with objects. However the style is inconsistent and with a few subtle tweaks would be much, much better. Template Files, What is $this? First one is the @see syntax often used in .phtml files to describe which block object is in play as $this. Read On →

Magento Automated Testing for Quality Assurance

Widely regarded as best practice, the use of automated tests to ensure the correct functioning of your web application is a really powerful and useful practice. For Magento it has historically been something that you would need to create yourself. Now Magento have released a comprehensive package of 1000 tests that you can download as a package. Based on Selenium the package will allow you to to test your store and will also assist with the creation of your own custom tests. Read On →

Magento Layout ignore="1"

If you are looking at your Layout XML when trying to debug missing blocks for example, you may see the attribute ignore=“1” being assigned to chunks of XML. These are set when some module or other is using the remove syntax to remove a block. For example I have just had some issues with Fontis Recaptcha and TBT Sweetooth extensions not playing nice together. The reason is that the Fontis extension is removing the entire customer_form_register handle and replacing it with a custom one however the Sweettooth module is still referring to the core Magento handle which then means its layout updates are not having any effect. Read On →

Zend Certified Engineers

We are really pleased to announce the successful Zend Certification exam for two of our developers Bolaji and Martyn. It’s really quite a hard exam to pass and definitely tests your knowledge of PHP to the limits. They found it challenging but nailed it. That means that we now have a 100% Zend Certified PHP Developer team ready to work on your projects.