Archive:

 

Archive for February, 2012


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 [...]



 

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 [...]



 

So, 6am this morning (Wed 29 2012), a bunch of geeks eagerly awaiting the Raspberry Pi have killed the websites of both RS Components and Farnell Why, you ask? Because the servers were not prepared for the influx of visitors that such an announcement brings. Raspberry Pi themselves (a UK Foundation, like a Charity) were [...]



 

If you have ever had to browse for a coding solution, you will have come across the problem of "smart" quotes replacing normal punctuation. Thankfully there is a simple fix to to this, a userscript called DumbQuotes which can be downloaded here. This will convert all of the single & double quotes into something more [...]



 

Magento's Zend extension for creating pdfs could take massive amount of time to customize, I would say customizing the code to make it do what you want is not the best the way to go when an entire layout changes is to be made to probably for invoice, packing slip etc. I found an extension [...]



 

These two Magento functions looks more like there is no obvious difference between them, but there is. addAttributeToFilter('some_attribute1','attribute_value') filters a Magento entity collection (e.g Products, categories) by only selecting entities that has 'some_attribute' equal to 'attribute_value' while addAttributeToSelect('some_attribute2') tells Magento to return add 'some_attributes' to the set of properties that would be returned for a [...]



 

If you need to clean up a URL and remove any double (or more) slashes that might have crept in, but need to keep the :// bit intact you might like this little function PLAIN TEXT PHP: protected function removeDoubleSlash($in) {         return preg_replace('%([^:])([/]{2,})%', '\\1/', $in);     } Handy More Reading:Magento [...]



 

If you are having issues running unit tests that work with sessions and call session_start(), you might see error messages like this: output started at "PHPUnit/Util/Printer.php:173" If you do, the solution is fairly simple. Just add the flag --stderr to PHPUnit eg PLAIN TEXT CODE: phpunit --stderr mytest.php If you are using Netbeans, you simply [...]



 

Encrypting a string in Magneto is really easy and will use the encryption key specified in the local.xml file: PLAIN TEXT PHP: <?php $encryptedData = Mage::helper('core')->encrypt("This will be encrypted"); There is one problem that you may encounter that can be a little bit problematic but there is an easy work around. The encryption process will [...]



 

If you ever need to create a custom field to save data against a customer in Magento you will probably need to create a custom attribute. Creating the attribute is easy, in your modules install script you do: PLAIN TEXT PHP: <?php $installer = $this; $installer->startSetup(); $installer->addAttribute('customer', 'my_custom_attribute', array('type'=>'text')); $installer->endSetup(); Then on the customer object [...]