0

I need to display below file in my category list page as a block

frontend\default\theme_name\template\configurableswatches/catalog/product/view/type/options/configurable/swatches.phtml

Mage_ConfigurableSwatches_Block_Catalog_Product_View_Type_Configurable_Swatches

Is it possible??

------------------------------------Edit----------------------------------------------

In my Product View, the swatches are displaying like

product options in product view page

But in Category Page i'm using a Quick view option where the product option is

enter image description here

How can i display the same in product category also?

configurableswatches.xml

<layout version="0.1.0">
<default>
    <reference name="head">

        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/modernizr.custom.min.js</name></action>
        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/script.js</name></action>
        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/imagesloaded.js</name></action>
        <action method="addCss"><stylesheet>css/configurableswatches.css</stylesheet></action>
        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/swatches-product.js</name></action>
    </reference>
</default>

<product_list>
    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/product-media.js</name></action>
        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/swatches-list.js</name></action>
    </reference>
    <reference name="product_list.name.after">
        <block type="core/template" name="product_list.swatches" template="configurableswatches/catalog/product/list/swatches.phtml" />
    </reference>
    <reference name="product_list.after">
        <block type="configurableswatches/catalog_media_js_list" name="configurableswatches.media.js.list" />
    </reference>
</product_list>

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

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

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

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

<PRODUCT_TYPE_configurable>
    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/product-media.js</name></action>
        <action method="addItem"><type>skin_js</type><name>js/configurableswatches/swatches-product.js</name></action>
    </reference>
    <reference name="product.info.media">
        <action method="setGalleryFilterHelper"><helper>configurableswatches/productimg</helper></action>
        <action method="setGalleryFilterMethod"><method>filterImageInGallery</method></action>
    </reference>
    <reference name="product.info.media.after">
        <block type="configurableswatches/catalog_media_js_product" name="configurableswatches.media.js.product" />
    </reference>
    <reference name="product.info.options.configurable.renderers">
        <block type="configurableswatches/catalog_product_view_type_configurable_swatches" template="configurableswatches/catalog/product/view/type/options/configurable/swatches.phtml" />
    </reference>
    <reference name="product.info.options.configurable.after">
        <block type="core/template" template="configurableswatches/catalog/product/view/type/configurable/swatch-js.phtml" />
    </reference>
</PRODUCT_TYPE_configurable>

1 Answer 1

0

Why do you need it in category page? If you look at that module you will notice that such block is used in configurable products view. Look for this file: configurableswatches.xml.

So I'm not sure if you will get success to print it out in category page.

Still, in order to test. Have you tried to add the block to the layout under the handle catalog_category_default or catalog_category_layered

Make a reference to content and add something like:

<block type="configurableswatches/catalog_product_view_type_configurable_swatches" template="configurableswatches/catalog/product/view/type/options/configurable/swatches.phtml" />

this is a copy 'n paste from previous mentioned file at:

app/design/frontend/rwd/default/layout/configurableswatches.xml

EDIT:

Can you try to install a clean magento, I did yesterday with latest CE v1.9 and installed also sample data and searched for product: "ELIZABETH KNIT TOP". There were swatches in the listing. Is that what you need? Could you try to reproduce the same I did and confirm.

If it is like so, then you have your solution there, if it is not your desired result, I think I can not help you any more. Sorry.

4
  • I just updated my question with exact details please check. Mar 22, 2016 at 12:38
  • Have you checked the file: configurableswatches.xml. In magento-1.9-CE I can see some suggesting code, handle "product_list", is this not working for you? or usable at all in your case? I edited answer with file path.
    – davidmpaz
    Mar 22, 2016 at 13:34
  • I'm using <?php if ($_product->isSaleable() && $this->hasOptions()):?> <?php echo $this->getChildChildHtml('container1', '', true, true) ?> <?php endif;?> </span> to display the swatches in product view page, but it's not working in product category page. I'm also attaching my configurableswatch.xml in the question. Mar 22, 2016 at 13:45
  • Sorry, I don't know what do you want to do anymore. Yesterday I installed a clean magento latest v1.9 CE, with the sample data. There are swatches in the product list, category and search pages. See the updated answer please.
    – davidmpaz
    Mar 23, 2016 at 8:37

Your Answer

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

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