1

Inside our template/catalog/product/list.php file I want to load ChildHtml.

Inside list.php I got this line:

   <ul class="productbox-beknoptespecs">
   <?php echo $this->getChildHtml('beknopte_specificaties_new'); ?>
   </ul>

What do I need to place inside our local.xml file?

External .php file:

<?php
    $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct();
    $theme = $this->helper('ultimo');
?>

<!-- LAPTOPS -->

<?php $yourCatIds = array(27,233,234,235);
$productCats = $_product->getAvailableInCategories();

if (count(array_intersect($yourCatIds,$productCats))) {

    if($_product->getData('i_display_diagonal_944_1')) :
    echo '<li class="short-specifications"><span class="attributename">' . $_product->getResource()->getAttribute('i_display_diagonal_944_1')->getFrontendLabel() . '</span>';
    echo '<span class="attributetext">' . $_product->getAttributeText('i_display_diagonal_944_1') . '</span></li>';
    endif;

}
?>

I tried this but that does not work:

<catalog_category_layered>
<reference name="product_list">
<block type="catalog/product_view" name="beknopte_specificaties_new" as="beknopte_specificaties_new" template="catalog/product/view/beknoptespecs.phtml"/>
</reference>
</catalog_category_layered>
2
  • Where are you defined beknopte_specificaties_new in xml. <?php echo $this->getBlockHtml('beknopte_specificaties_new'); ?>
    – Amit Bera
    May 7, 2015 at 12:40
  • @AmitBera See my edit.
    – JGeer
    May 7, 2015 at 12:45

1 Answer 1

1

Add this code by local.xml

<!--
Category default layout
-->

    <catalog_category_default translate="label">
        <reference name="product_list">
           <block type="Block_Prefix/BlockClass" name="beknopte_specificaties_new"  template="YouTemplateLocation/Yourfile.phtml"/>
        </reference>
    </catalog_category_default>

<!--
Category layered navigation layout
-->

    <catalog_category_layered translate="label">
        <reference name="product_list">
           <block type="Block_Prefix/BlockClass" name="beknopte_specificaties_new"  template="YouTemplateLocation/Yourfile.phtml"/>
        </reference>
    </catalog_category_layered>

As per as your update :the block type catalog/product_view is not working as it product view page main content page.

5
  • Thanks Amit! Tried that code, but that does not display the file. Nothing is loaded.
    – JGeer
    May 7, 2015 at 12:58
  • I used this line <block type="core/template" name="beknopte_specificaties_new" as="beknopte_specificaties_new" template="catalog/product/list/beknoptespecs_new.phtml"/>. That does display the file, but it breaks down the page, because php can not be loaded
    – JGeer
    May 7, 2015 at 13:28
  • Please show the code of phtml
    – Amit Bera
    May 7, 2015 at 13:30
  • See the edit above
    – JGeer
    May 7, 2015 at 13:33
  • hi.. Jelle ,i guess that you got the answer for Marius magento.stackexchange.com/questions/67045/…
    – Amit Bera
    May 7, 2015 at 17:01

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.