3

I have populated bestselling products on homepage. It's populating list of products as desired. Now i have enabled configurable swatches & have enabled on product listing(i'm using rwd theme).

I can see color swatches on product lists in my product listing page. Now i want those swatches on my custom product list at homepagepage.

What i tried:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('configurableswatches/catalog/product/list/swatches.phtml')->toHtml(); ?>

This above prints nothing.

And i get all the code from rwd/default/theme/configurableswatches/catalog/product/list/swatches.phtml inside products populating loop. And it worked and shows the swatches, but now clicking on swatches has no effect to image ? (Image doesn't changes as like it does on product listing for same product even after i added all configurableswatches js under skin/frontend/rwd/default/js/configurableswatches/*.js).

What is the best way to achieve configurable swatches on custom product list on homepage ?

1 Answer 1

0

To show configurable swatch on Home Page in Feature Products List, follow the below steps -

1- Make your own list.phtml file for custom products list 2- in your list.phtml file select place where you want to show configurable swatches, and paste below code -

$_nameAfterChild = $this->getLayout()->getBlock('product_list.swatches');
$_nameAfterChild->setProduct($_product);
echo $_nameAfterChild->toHtml();

3- Include this file in Home Page in CMS using below code -

{{block type="catalog/product_list" column_count="5" category_id="21" template="catalog/product/homepage-list.phtml"}}  

4- In local.xml file in your theme paste below code -

    <cms_index_index>
         <update handle="product_list"/>
    </cms_index_index>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.