3

How can i add my custom block in catalog category page

enter image description here

<catalog_category_layered translate="label">
    <label>Catalog Category (Anchor)</label>
    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
<!-- i add my block here  -->
                    <block type="quickview/quickview" name="quickview" template="quickview/quickview.phtml" />
                </block>                 
            </block>
        </block>
    </reference>
</catalog_category_layered>
  • you can call your block file as $this->getChildHtml('quickview') in list.phtml – saravanavelu Jan 19 '15 at 7:07
1

You can always modify your phtml file which displays product listing on category page,

Go to below Path app/design/frontend/default/yourtheme/template/catalog/product/list.phtml

you can set your custom text according the html structure here...

  • i dont want to edit my .phtml file – Vaibhav Ahalpara Jan 19 '15 at 7:19
  • any reason ? this we always do to get our look and feel ? – Siddharth Vaghasia Jan 19 '15 at 7:22
  • 1
    i want to do this using reference Tag – Vaibhav Ahalpara Jan 19 '15 at 7:26
  • I don't think you can do that, because from reference tag you always call other block after or before block. this you need within list.phtml. Experts can verify :) – Siddharth Vaghasia Jan 19 '15 at 7:37
  • @Amit Bera...in which file you will add this code ? as it see it is again code change only. – Siddharth Vaghasia Jan 19 '15 at 7:45
1

vaibhav ahalpara,you can do anything without changing at list.phtml;

You want to call this block for all products

echo past the code at

    echo   $this->getLayout()->createBlock('quickview/quickview')
->setTemplate('quickview/quickview.phtml')->setName('quickview')->toHtml()

and this code id put inside of loop of products thus it can be show for all products:

Add this code below $this->getPriceHtml()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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