I have a custom PHTML file


I have edited


I have added

<block type="catalog/product_colors" name="colors" template="catalog/product/colors.phtml"/>

Right under list.phtml as follows

<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_colors" name="colors" template="catalog/product/colors.phtml"/>

I have added

<?php echo $this->getChildHtml('colors') ?>



Nothing is showing on the category page.

What am I doing wrong?

  • have you created block Colors ? as you have used block type="catalog/product_colors" – Anil Suthar Jul 19 '16 at 13:39
  • I've only done what I mentioned. What do I need to do? – Mike Tim Turner Jul 19 '16 at 13:42
  • what is in catalog/product/colors.phtml file ?? – Murtuza Zabuawala Feb 27 '17 at 12:32

Replace your code

 <block type="catalog/product_colors" name="colors" template="catalog/product/colors.phtml"/>


<block type="core/template" name="colors" template="catalog/product/colors.phtml"/>

and try after clearing cache.


Method 1: That colors.phtml file can be called directly in list.phtml file without creating block in catalog.xml by adding this following code in list.phtml.

<?php echo $block = $this->getLayout()->createBlock('core/template')->setTemplate('catalog/product/colors.phtml')->toHtml(); ?>

Method 2: Replace your line with

<block type="core/template" name="colors" template="catalog/product/colors.phtml" />

Note: Now check where do u want to make it display for Catalog Category (Anchor) or Catalog Category (Non-Anchor) or for both. Then add that line accordingly.

Now call that block in list.phtml file by adding bellow line.

<?php echo $this->getChildHtml('colors'); ?>

First of all, catalog/product_colors block does not exit at default magento.

You need to changed it to core/template,in order to check catalog/product/colors.phtml render at category view page page.

Also note that you should add this block both two handler catalog_category_default and catalog_category_layered

<block type="catalog/product_colors" name="colors" template="catalog/product/colors.phtml"/>
  • The data in colors.phtml is item specific and i need to show this inside the product foreach loop in list.phtml. Is this possible? I need this as I need to stop full page cache from caching it and I need a block name. Can this be created inside list.phtml itself? thanks – Mike Tim Turner Jul 19 '16 at 14:30

You have not created block Colors. This is needed because you have used block type="catalog/product_colors".


<block type="catalog/product_colors" name="colors" template="catalog/product/colors.phtml"/>


<block type="catalog/product_list" name="colors" as="colors" template="catalog/product/colors.phtml"/>

You can also use block type="core/template"

  • thanks. What if <?php echo $this->getChildHtml('colors') ?>is inside a foreach loop. how do I get it to display the correct value per product? – Mike Tim Turner Jul 19 '16 at 14:22

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.