How 10,000 Geeks break the UK's biggest distributors, RS and Farnell (Raspberry Pi)

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 well prepared and are presently serving up a static page. So, if you’re running an eCommerce site, like Magento or osCommerce, and are warned by one of your suppliers, or your manufacturing department that you’re launching a new product, be prepared. Read On →

Automatically convert smart quotes in the browser

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 code friendly.

Using TCPDF with Magento

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 that you could add to Magento to make things a lot easier by creating pdf’s from html called TCPDF. Read On →

Magento addAttributeToFilter() and addAttributeToSelect()

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 collection of entities. A combination of these two functions could be likened to sql SELECT Read On →

Remove Double Slashes from URL without Breaking It

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 protected function removeDoubleSlash($in) { return preg_replace('%([^:])( Handy :)

Magento or Zend Framework Session issues with PHPUnit and session_start()

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 phpunit --stderr mytest.php If you are using Netbeans, you simply need to add this to your PHPUnit script setting in Tools->Options->PHP->Unit Test eg /opt/lampp/bin/phpunit –stderr