Magento Block Caching Cache Key Helper Method - Generate Safe Unique Cache Keys

If you do any work at all on Magento performance optimisation with a view to making pages load faster then you must have come across block caching. To understand block caching you need to first of all understand that a Magento page is actually made up of a lot of nested chunks called blocks. Blocks can have their HTML generated dynamically every time though it is also possible to make Magento cache the block HTML output so that it loads a LOT faster, especially with heavy and slow blocks such as best sellers etc. Read On →

Warning in Varien/Autoload + Solution

I have recently been putting together a system that needed to interact with Magento. A big issue that I came across was a warning similar to this Warning: include(): Failed opening ‘Model/Base.php’ for inclusion (include_path=‘…’) in /path/to/magento/lib/Varien/Autoload.php on line 93 As I was running with an error handler that turned all errors into exceptions this prevented the code from running. The issue was due to my code using a custom autoloader, and when the Varien auto-loader was called first it could not find the files which triggered a warning. Read On →

Extending a Modules CSS within a Theme in PrestaShop

PrestaShop has a really nice structure for handling all the CSS that will appear in a site. It starts by splitting the CSS so that the CSS is split up per modules. There is a global CSS sheet but this should only be used for things that genuinely appear on all pages. Extending the CSS of a module in PrestaShop is easy. All you need to do is create a CSS file that matches the naming convention of the module you are looking to extend. Read On →

osCommerce PHP 5.2 Upgrade - You Really Should Get onto PHP 5.3 ASAP

Many of our clients use osCommerce for their online store. osCommerce was very popular a few years ago and to date still powers a really large number of stores. Due to a variety of technical reasons, many osCommerce stores are still hosting on PHP version 5.2. The latest version of PHP is 5.4 and 5.5 is due out fairly soon. Most hosting companies will now regard PHP 5.3 to be the minimum version they will support. Read On →

Tip: Remove spaces from filenames one-liner

There is often the case when you need to remove spaces from filenames - for instance when importing broken data feeds into Magento or osCommerce systems. The following strips spaces and replaces them with nothing :- find directoryname -name '* *' -type f | while read f; do mv "$f" "$(echo $f | sed s/" "/""/g)"; done or alternatively replace them with underscores :- find directoryname -name '* *' -type f | while read f; do mv "$f" "$(echo $f | sed s/" "/"_"/g)"; done Or any other character/string combo you like, you can even be more clever moving them out into subdirectories with more sed magic but you get the idea. Read On →

How To Add a Row Number to A Magento Dataflow Import Errors

I find it frustrating when importing data into Magento that it’ll successfully complain about a row with errors, but won’t tell you which row has the problem! The code which generates the HTML for the error messages is at app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php. Make a copy of this file at app/code/local/Mage/Adminhtml/Block/System/Convert/Profile/Run.php Locate this part: $this->setBatchConfig( ... 'template' => '<li style="#{style}" id="#{id}">' . '<img id="#{id}_img" src="#{image}" class="v-middle" style="margin-right:5px"/>' . '<span id="#{id}_status" class="text">#{text}</span>' . '</li>', ... Read On →