0

I created 3 static blocks with just a random headline for now, where I want to add html content later.
the ids of the blocks are:

warranty
instructions
certificates

I then created 3 .phtml files with content like this ( will jsut add one because they all look the same):

<?php

echo $this->getLayout()->createBlock('cms/block')->setBlockId('warranty')->toHtml();

I placed all the three files in app/design/frontend/rwd/mytheme/template/catalog/product/view

so I have these files lying there:

warranty.phtml
instructions.phtml
certificates.phtml

Then I added this in app/design/frontend/rwd/mytheme/layout/local.xml:

<?xml version="1.0"?>

<layout>
    <catalog_product_view>
        <reference name="product.info">
            <block type="core/template" name="product.warranty" as="warranty" template="catalog/product/view/warranty.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Garantie</value></action>
            </block>
            <block type="core/template" name="product.instructions" as="instructions" template="catalog/product/view/instructions.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Anleitung</value></action>
            </block>
            <block type="core/template" name="product.certificates" as="certificates" template="catalog/product/view/certificates.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Zertifikate</value></action>
            </block>
        </reference>
    </catalog_product_view>
</layout>

It doesn't work. Nothing showing up on the product pages. There are only the 3 tabs that have already been there before including one that seems to have been added the same way I just tried: (same code in .xml adding blocks to the detailed_info group and linking to a template.phtml file which is then using the same code as I do to call the static block.
But I must be missing some step in between because for me it doesn't work.

What am I missing?

Edit: The part of the template/catalog/product/view.phtml where the output of the detailed_info group happens looks like this:

<div class="product-collateral toggle-content tabs">
    <?php if ($detailedInfoGroup = $this->getChildGroup('detailed_info', 'getChildHtml')):?>
        <dl id="collateral-tabs" class="collateral-tabs">
            <?php foreach ($detailedInfoGroup as $alias => $html):?>
                <dt class="tab"><span><?php echo $this->escapeHtml($this->getChildData($alias, 'title')) ?></span></dt>
                <dd class="tab-container">
                    <div class="tab-content"><?php echo $html ?></div>
                </dd>
            <?php endforeach;?>
        </dl>
    <?php endif; ?>
</div>
0

You can try this by following way, please check & i have tested it.

<catalog_product_view>
        <reference name="content">
            <reference name="product.info">
                <block type="catalog/product_view_attributes" name="product.attributes1" as="additional1" template="catalog/product/view/warranty.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Garantie</value></action>
                </block>

                <block type="catalog/product_view_attributes" name="product.attributes2" as="additional2" template="catalog/product/view/instructions.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Anleitung</value></action>
                </block>

                <block type="catalog/product_view_attributes" name="product.attributes3" as="additional3" template="catalog/product/view/certificates.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
                <action method="setTitle" translate="value"><value>Zertifikate</value></action>
                </block>
            </reference>
        </reference>
</catalog_product_view>

  • Oh I see, that happens when you just ctrl-v like that. I tried your code though and it still doesn't work. Anything else I might have missed? – Chaz May 25 '19 at 14:32
  • i have updated my answer, please check. local.xml file will start with <?xml version="1.0"?> <layout version="0.1.0"> and end with </layout> – MR.R DNATH May 26 '19 at 8:48
  • Unfortunately this stil doesn't work – Chaz May 27 '19 at 8:24
  • For checking , trying to add static HTML into the phtml file. Only xml file is required & once update clear cache and check – MR.R DNATH May 27 '19 at 9:48

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.