0

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've tried a bunch of different stuff and none of it seems to work. I hope I've included all the pertinent information.

1 Answer 1

1

Here's what I did.

Add the following the your local.xml:

<catalog_product_view>     <reference name="root">         <block type="core/text_list" name="bottom" as="bottom" translate="label">             <label>bottom</label>         </block>     </reference>     <reference name="bottom"> <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml"> <action method="setColumnCount"><columns>4</columns></action> <action method="setItemLimit"><type>upsell</type><limit>4</limit></action> </block>     </reference> </catalog_product_view> 

I created a new template called 2columns-left-bottom, but you could modify 2columns-left if you wanted to. In whatever template you choose, you can call bottom like this:

<div><?php echo $this->getChildHtml('bottom') ?></div> 

Place this above the footer and below (outside) of the main container col2-left-layout. You will have some styling of the div to do, but I leave that up to you.

So this has defined a new structural block, like 'right' or 'left' and then put the contents of the upsell_products into it.

hth, sconnie

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, didn't realize you had to declare the block in root, I think that's what was tripping me up.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.