I have created custom module and update layout for catalog product listing page and product detail page shown below.
<layout version="0.1.0">
<catalog_product_view translate="label">
<reference name="product.info.addtocart">
<block type="core/template" name="mytest" template="mytest/mytest.phtml"/>
</reference>
<reference name="product.info.additional">
<block type="core/template" name="mytest"
template="mytest/mytest.phtml"/>
</reference>
</catalog_product_view>
<catalog_category_layered translate="label">
<reference name="product.info.addtocart">
<block type="core/template" name="mytest" template="mytest/mytest.phtml"/>
</reference>
<reference name="product.info.additional">
<block type="core/template" name="mytest"
template="mytest/mytest.phtml"/>
</reference>
</catalog_category_layered>
</layout>
Its working fine for product detail page but it won't work on catalog product listing page.
Please advice me how to add custom block under the product price/Add Cart button in product listing page?
Best Answer
This will work well for
<catalog_product_view>
. The reason is because the child blocks are called out in the phtml files.For the Catalog Product List you will need to do a bit more.
In 1.9.2 if you open the /template/catalog/product/list.phtml, you will see the below code:
Now we will be re-using the above code logic as below:
Inside catalog.xml or local.xml paste the code:
If you can notice, there is a block called:
<block type="core/text_list" name="product_list.price.cart.after" as="price.cart.after"> <block type="core/template" name="mytest" template="mytest/mytest.phtml"/> </block>
This will help display all your custom blocks in one place. Since you want to display this custom below Price/Add to Cart, search for "GRID MODE" and inside the FOREACH loop the in the file - /template/catalog/product/list.phtml and paste the code below the div:
So now your list.phtml will look like below:
Hope this helps. Let me know if this works for you.
Happy Coding...