2

I'm using a module of Amasty that adds a block to my catalog product view's content reference. This puts in on the top of the page, but I want to move it just above the upsell in the product.info block.

I'm trying to unset this using unsetChild and inserting it just above product.info.upsell, but I can't get it to work. The block keeps appearing above the whole product.info block or below it.

This is my code:

<catalog_product_view>
        <reference name="content">
            <action method="unsetChild"><name>amprevnext_prevnext</name></action>
            <action method="insert">
                <blockName>amprevnext_prevnext</blockName>
                <siblingName>product.info.upsell</siblingName>
                <after>0</after>
            </action>
        </reference>
    </catalog_product_view>

How do I do this?

1 Answer 1

5

It is because the awprevnext_prevnext is added to the content block and not to the product.info block.

Here's what you should do:

<catalog_product_view>
    <reference name="content">
        <action method="unsetChild"><name>amprevnext_prevnext</name></action>
    </reference>
    <reference name="product.info">
        <action method="insert"><block>amprevnext_prevnext</block></action>
    </reference>
</catalog_product_view>

However, this won't be enough because the product.info original template catalog/product/view.phtml does not render all the child block automatically by calling echo $this->getChildHtml();

Thus you need to add the following to your custom theme catalog/product/view.phtml template:

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

You need to add that code before the following code:

<?php echo $this->getChildHtml('upsell_products') ?>
1
  • I tried the whole <reference name="product.info"> indeed, but didn't think of also including it in my catalog/product/view.phtml.. Thanks, this fixed it! Oct 31, 2016 at 14:59

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.