1

I'm trying to move my upsells out of the product 'content' view and into their own section within the template.

My XML looks something like this:

<catalog_product_view translate="label">
    <reference name="root">
        <action method="setTemplate">
            <template>page/2columns-left.phtml</template>
        </action>
    </reference>
    <reference name="content">
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            ...other blocks...
            <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml" />
            ....other blocks...
        </block>
    </reference>
</catalog_product_view>

Then, within 'page/2columns-left.phtml' it calls $this->getChildHtml('content') which renders the catalog/product/view.phtml, and then within THAT file a call is made to $this->getChildHtml('upsell_products').

What I'm trying to do is move the 'upsell_products' out of the main 'content' view (because that is wrapped in the right column of the template), and move it into the main 2column template, so that the upsells can actually sit below the 2 column layout and span the full width of the page, rather than being constrained to the right column. I know I should probably create a new template as this is more than just 2 columns now, but what is the proper way to set this up? I thought I could just call '$this->getChildHtml('upsell_products')' from within 2columns-left.phtml, but it doesn't do anything. I've tried a bunch of different stuff like moving it to its own block outside of reference, and a few other things, and none of it seems to work. I hope I've included all the pertinent information.

0

2 Answers 2

0

I ended up declaring the block in 'root', which got it working:

<reference name="root">
    <block type="core/text_list" name="bottom" as="bottom" translate="label">
        <label>bottom</label>
    </block>
</reference>

https://stackoverflow.com/questions/23227610/confusion-with-magento-blocks-and-layouts

0

Remember that type="catalog/product_view" for example, in your layout XMLs will map to Magento as:

Mage/Catalog/Block/Product/View.php

Something like such, should suffice on moving the block to another referenced area.

$this->getChildHtml('name') <- get name or as reference defined in the block XML.

I would also suggest reading over the following link to gain some more details on how blocks/layout work internally:

References:

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.