Magento Themes and Magento Extensions

Magento: More Flexibility For Your Layout Updates

Share
Posted on April 16th, 2013 | Posted by admin

Magento: More Flexibility For Your Layout Updates
I’ve been working on a project with a lot of requirements for certain templates or javascript to be added based on a lot of different conditionals and situations that the standard layout xml files do not really allow for. Fortunately, there are events and methods that you can use to add in xml on the fly without the need for layout xml files, allowing the ability to add in logic as to what and if something should be added or not.

First thing you are going to want to do is create an event observer to observe the ‘controller_action_layout_generate_xml_before’ event. That event will provide you with the layout object. By accessing the Update object from the layout, we can easily add in our own update:

$layout = $observer->getLayout();

$layout->getUpdate()->addUpdate('
    <reference name="content">
        <block type="module/block" name="the.name" template="your/template.phtml" />
    </reference>
');

If you wanted that block only to be added if the customer is not logged in, you could wrap the code in a conditional. You could get quite creative with this in implementing all sorts of cool functionality as we have done on our project. I hope this provides the tool to get you started!

Magento Certification

Share
Posted on April 10th, 2013 | Posted by admin

In this month I am appearing for an exam of Magento certification. I hope for the best. I am more focused on the PDF that Magento has provided as reference guide.
One thing I would like to say its fun to read those things that you have done in practical and clear your concepts.
Wish me luck.

MAGENTO SHOW SYSTEM DATE PHP EXAMPLE

Share
Posted on April 5th, 2013 | Posted by admin

When we need to get Magento time as as an variable you should use  echo Mage::getModel with timestamp() function.it can display on your Magento font end anywhere and if it needs format date as dd-mm-yyyy it can simply use PHP date function.This example shows how to display the date and format the date time

1 //display the default output
2 echo Mage::getModel('core/date')->timestamp(time());
3
4 //format the op- dd-mm-YYY
5 echo date('d-M-Y',strtotime(Mage::getModel('core/date')->timestamp(time()));
6
7 //format date time
8 echo date('d-M-Y H:i:s',strtotime(Mage::getModel('core/date')->timestamp(time()));

Create a custom category attribute in Magento

Share
Posted on April 4th, 2013 | Posted by admin

Create a custom category attribute in Magento
Copy and paste the following code in your header.phtml

Magento : cache_dir must be a directory

Share
Posted on March 29th, 2013 | Posted by admin

cache_dir must be a directory : This problem came generally when you move your magento store to another host or server . There are mainly two solution for this problem

1 -  Make sure your cache directory is writable or you can make writable to var folder of magento

but sometimes this situation does not work so here is the alternate solution. Go to this location lib/Zend/Cache/Backend/

and open file.php file you’ll see the code something like this

Page 5 of 51« First...«34567»102030...Last »