The modern theme made available by the good folks at Varian for their free e-commerce product Magento is a great template and a good starting point for anyone looking to customise magento for their own look and feel. However, the default layout has the Related products block in the left hand menu which unless you have very long product descriptions can leave the page unbalanced.
These instructions will move the block to to the centre under the product descriptions.
You can see this at work here on a <a href=”http://www.cl-floraldesigns.co.uk”>wedding flowers</a> site.
In catalog.xml find
<reference name=“right”>
<block type=“catalog/product_list_related” name=“catalog.product.related” before=“-” template=“catalog/product/list/related.phtml”/>
</reference>
Remove or comment out
<block type=“catalog/product_list_related” name=“catalog.product.related” before=“-” template=“catalog/product/list/related.phtml”/>
Change the following to include the above…
<block type=“core/template_facade” name=“product.info.container2″ as=“container2″>
<action method=“setDataByKey”><key>alias_in_layout</key><value>container2
</value>
</action>
<action method=“setDataByKeyFromRegistry”><key>options_container</key>
<key_in_registry>product</key_in_registry></action>
<action method=“append”><block>product.info.options.wrapper</block></action>
<action method=“append”><block>product.info.options.wrapper.bottom</block>
</action>
</block>
<action method=“unsetCallChild”><child>container1</child><call>ifEquals</call>
<if>0</if><key>alias_in_layout</key><key>options_container</key></action>
<action method=“unsetCallChild”><child>container2</child><call>ifEquals</call>
<if>0</if><key>alias_in_layout</key><key>options_container</key></action>
</block>
<block type=“catalog/product_list_related” name=“catalog.product.related” after=“-” template=“catalog/product/list/related.phtml”/>
</reference>
Note the use of after=“-” instead of before=“-”
You may need to restyle it depending on your layout.
Related Posts
- Create a left hand navigation / verticle category in Magento
- Remove side_logo_promo.gif from header in modern theme magento
about 1 year ago
Could you please advise or show a complete example of this code as I can’t get it to work. I don’t really understand what is required in the last step.
Thanks
about 1 year ago
http://www.cl-floraldesigns.co.uk
do you mean the css bit?
about 1 year ago
Hello, this is helpful, but is there a way to show related products ABOVE upsell products?
Thanks
about 1 year ago
Hello,
Thanks for your post.
Can you please explain, what before=”-” or after=”-” does and make a difference?
Thanks,
Riti
about 1 year ago
Hello Andy,
Can you please help me to do it for my custom theme?
thanks in advance.
Riti
about 1 year ago
Hi There,
I have an issue with Relate products.
Example:
Product 1 (Category 1)
Product 2 (Category 1)
Product 3 (Category 1)
I have three products in my store. I have added the product 2 and product 3 as related product for product 1 in admin section. I did same with all products. Product 2 having its related product as product 1 and product 3. Product 3 having its related products as product 1 and product 2. I did all in admin section. But in products detail page all the two product are not visible.
On product 1 details page both the other two are visible as related products. But for product 2 only product 3 is visible in related product and for product 3 only 2 is visible.
I can’t understand the magento behaviour for related products. On which logic it shows related product in related product section in frontend.
I have tried that with fresh installation. But the thing are same. I can’t see the product 1 in product 2 and product 3 details page as related products. That’s done in the admin section but does not effect the frontend.
Anybody can help me out to show the product 1 as related product for product 2 and product 3?