1

I want to show multiple configurable swatches on product listing page.

For that I created configurable_category.phtml where I replicated configurable.phtml file to showing the configurable swatches like this:

$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
$_jsonConfig = $this->getJsonConfig();
$_renderers  = $this->getChild('attr_renderers')->getSortedChildren();

....

$_rendered = false;
foreach ($_renderers as $_rendererName):
   $_renderer = $this->getChild('attr_renderers')->getChild($_rendererName);
   if (method_exists($_renderer, 'shouldRender') && $_renderer->shouldRender($_attribute, $_jsonConfig)):
       $_renderer->setProduct($_product);
       $_renderer->setAttributeObj($_attribute);
       echo $_renderer->toHtml();
       $_rendered = true;
       break;
   endif;
endforeach;

....

Now I have to include this code:

<block type="core/text_list" name="product.info.options.configurable.renderers" as="attr_renderers" />

But I don't know where to include it. I've tried to put it in catalog.xml under the catalog_category_default and catalog_category_layered but $_renderers = $this->getChild('attr_renderers')->getSortedChildren(); still returns false.

Can anyone help me with that? Or anyone have any idea?

0

0

Your Answer

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