Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How can you change a blocks view when you use a custom page layout for a product? 
 
benz001
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-02-05
Sydney
 

For some products we need to use different page layouts, eg I might use 2columns-left everywhere but one-column just for a couple of special products.

At first it seems for the person running the site that’s easy, they just pick the different layout for their special products.
But what about when I need to trigger related changes in other files, eg in the one-column layout I want to show a larger image size, so I’d edit my media.phtml file, but how can I link my new media.phtml so that it only appears in the one-column pages?

Currently I’m using the custom layout updates to do this eg

<reference name="product.info">
<
remove name="product.info.media" />
<
block type="catalog/product_view_media" name="product.info.media_tall" as="media" template="catalog/product/view/media_tall.phtml" before="-"/>
</
reference>

So I have a new media_tall.phtml template that I use on these pages, but this is not a usable solution for the admins, they now have to change a drop down box and remember to paste this weird xml stuff into the product as well, over time this will become a nightmare - particularly as more and more alternate layouts get added.

I’m sure that somewhere in the sea of xml files there’s a configuration syntax that can do this!
I just can’t see it…

Anyone done this already or have some ideas???

 
Magento Community Magento Community
Magento Community
Magento Community
 
int2k
Sr. Member
 
Total Posts:  244
Joined:  2008-07-28
Bandung, Indonesia
 

why not just create a theme on your template
say there is default folder template
just create a new theme with some changes that was needed
and point the product custom design to use the new theme

at least that how i do it

 
Magento Community Magento Community
Magento Community
Magento Community
 
benz001
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-02-05
Sydney
 

Good idea, I was hoping there was something a bit ‘smaller’ than creating another theme - but that would work perfectly, the admin user only needs to pick one option and it will still inherit all the base changes from my new default theme.

Thanks for the quick response!

 
Magento Community Magento Community
Magento Community
Magento Community
 
int2k
Sr. Member
 
Total Posts:  244
Joined:  2008-07-28
Bandung, Indonesia
 

i think it the most simplest solution
and quite small also
since you only need to add the modified part to the new theme

 
Magento Community Magento Community
Magento Community
Magento Community
 
benz001
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-02-05
Sydney
 

I agree its quite straightforward and I’m doing it now.

However it would be good in general if picking a page layout allowed you to link to other template versions for the common blocks - as Magento already lets you pick different page layouts for each product or CMS page.

With different page layouts its very common that you would want to render blocks differently, a one column page layout will always give you more page area to work with than a sidebar - I’m sure they have thought of some way to do this, but we’ll never find it documented grin

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top