• Magento: Debug logging

    Enable logging (System > Configuration > Developer > Log Settings > Enabled = Yes) then add this code somewhere:

    Mage::log("Add this message to the log");
  • Magento: Static Blocks

    In a template file:

    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('identifier')->toHtml(); ?>

    ... or in a layout file:

    <block type="cms/block" name="myblock" before="-">
    	<action method="setBlockId">
    		<block_id>myblock</block_id>
    	</action>
    </block>
    
  • Magento: One page checkout gets stuck on custom skin

    Magento, a complex beast for sure but flexibility and scalability will have a cost. I recently had to ponder a problem I was having with a custom skin I was building.  My one-page checkout was getting stuck at billing address and I couldn't figure out why.  I thought I'd walked through the JS properly and established that everything was in order but I hadn't. My custom skin didn't use the col-right class for the right had column where the checkout progress module is housed. This meant that the JS was unable to find the progress module and unable to update it therefore the code was not all being called and subsequent steps in the checkout process were remaining hidden. The solution is either edit the JS to use a class that you are using or maintain the col-right class in your markup.

    It is quite often the case that I end the day tearing my hair out over a Magento puzzle but it must be said that when I fix it, the solution often reassures me that Magento IS the solid e-commerce foundation that it purports to be.