Magento Adding a Custom Layout to individual product - magento

Hi
I have an online estore setup using magento 1.6.2 CE, an have a very novice like question!!
THE SITUATION / FACTS:
1. I have created Categories and sub categories.
2. To categories i have added a custom template for left navigation.
3. I want this template to also apply to products that i have applied to the category/ sub category. For this, i have selected Apply To Products under Custom Design to Yes.
4. i want custom left navigations for products in different categories./p>
HOw ITS ACTING:
when i access the product using the category name/ sub category name, the template is applied to it on the individual products page. For example, say the category is MENS, and the product name is shirts, so when i access it using www.mydomain.com/MENS/shirts.html the template is applied and i see the custom left menu.
PROBLEM:
when the shirts page is accessed directly, like magento does, ie www.mydomain.com/shirts.html, the custom template is not applied. it shows blank.
what is the possible workaround for this? I have tried setting APPLY TO PRODUCTS to NO, and then adding custom layout template to each product individually... but this is too cumbersome..
Thanks
Moody

Can't you just set 'Use Categories Path for Product URLs' to yes in Configuration > Catalog > Search Engine Optimization?

Navigate to your catalog.xml file in
app>design>frontend>base>default>layout>catalog.xml
You may already have this file located in your theme folder, if not copy it across.
Search for
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
the line below this should state something like the following:
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
Edit this so that it states this instead
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
Notice the column denotation has changed from right to left, re-upload the file. Hey presto it is done!
emagen - Magento Designers, Shepherds Bush, West London

Related

custom layout settings won't apply

I have small problem with Magento. I'm not Magento guru but i'm trying to figure out this error.
And this 1column page won't be 1 column, it always two-column. Where can i check it?
I set in admin to this page custom layout - 1 column and for all others - use parent settings, on root category i set 2 column with left pad - no luck.
Inside theme/package/layout/local.xml the template for catalog pages was set to:
<catalog_category_layered translate="label">
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
For this one page the settings on admin was set to: Page Layout: 1 column.
These settings are not stable. In case the page is reloaded several times in a row, sometimes, I see, that the template for this page is "2-columns-left.phtml", sometimes - it is correct and is "1column.phtml"
Please i'll be glad for any help.
Edited:
How can i set this page to be always 1 column?
I've tried to comment template section in local.xml and setup Catalog->Manage categories->My_category->Custom design->Page layout to "1 column" but page still be sometimes loaded 1 column and sometimes 2 columns.
Kindly check the complete tutorial on http://www.exinent.com/magento-custom-theme-development/
please check if you don't have template set in cms: go to admin>Catalog>Manage Categories> [select your category] > Custom Design Tab > Page Layout - change to No layout updates
catalog_category_layered mostly is set if you have anchored category, check this, also try catalog_category_default handler
There is another way to change the custom layout settings for the category page.
Go to admin panel Catalog > Manage Categories > Edit any category > Custom Design > Page Layout.
Here you can change the page layout for the category page.

can i have a second media.phtml in my magento new theme?

so this is the project.
I need to display the regular product images for most of the products but for a second set of products i need to replace the image with a javascript that will change depending on selections of options.
My question is: can i have two different media.phtml. Let's say media.phtml and js-media.phtml. And if i can where can i change this?
Or another case could be finding the file responsible for the content on the product page and change it there.
<?php echo $this->getChildHtml('content') ?>
I thought i could change this creating a new layout file but apparently i am wrong.
Thanks
This is totally something you can do.
In your template create your js-media.phtml in templates/catalog/product/view.
Then if you want to assign this new template only to some of the products, you can switch media template straight from the backend of magento, through the Design tab of a product info.
There you can do this by adding a bit of XML into the Custom Layout Update field :
<reference name="product.info.media">
<action method='setTemplate'><template>catalog/product/view/js-media.phtml</template></action>
</reference>

Removing Masshead Magento Extension from certain categories

As I describe in the title, what i want to do is to remove the Masshead extension from certain categories in magento. Any ideas how can that be done?
The module will be most likely including a block on the categories page. This block will be defined in the modules layout xml file. You need to find the definition to identify the name of the block and the name of the parent block/container it is being included in. As you want to keep it on some categories but remove it from others, the simplest solution I can think of would to be to use Magento's Administration Area for the categories you want to remove it from and add some layout update xml to these specific categories.
I normally do this with statements like the following under Admin->Catalog->Manage Categories. Select the appropriate category and then click on Custom Design where you will find the Custom Layout Update field to out the XML in;
<reference name="content">
<remove name="masshead.blockname" />
</reference>
You could go about it the other way and remove it from all categories by changing the layout xml file of the module to not include it and use layout update xml in the admin area per each category you want to include it on. Really depends on if there are more categories you want on it than not or vice versa.

Only some products using proper theme in Magento

This has been very frustrating and I cannot figure it out. I recognize the answer is most likely simple.
I have a my own package and all the desired pages except for some products are not using the desired theme product view layout.
Compared the data in mysql against a product that is displaying properly. Both records match.
In Catalog/Manage products - I have performed a side by side comparison of the products in magento admin (including design). both match.
In Catalog/Manage Categories - All categories set to apply to products and to use parent as default.
The default category is using my theme and applying to products.
Set the proper template in my local.xml file however this did not work.
<catalog_product_view>
<reference name="root">
<action method="setTemplate">
<template>page/2columns-right.phtml</template>
</action>
</reference>
</catalog_product_view>
In system/configuration/design I have the current package name set to my package for the Default Config. Any children from there are checked to use default.
I tried several configurations with flushing cache and re indexing just in case.
This is and example of the site the correct display (please note design not complete).
Page using correct Theme
Here is example of product using base theme
Page using BASE Theme
Any suggestions. I understand that I could Manually select the desired template for each product and I would sooner jump off bridge. I must be overlooking something. Appreciate any advice.
Please check to admin>product here each product can select difference type of custom design

Magento - Different image gallery block for specific products or categories

I'm trying to change how the image gallery is displayed but only for specific products or specific categories. Using the developer display hints, I can see that the block I want to modify for certain products is output by media.phtml.
Suppose I have an alternate file called media-special.phtml, what XML do I need to use and where do I put that XML, to use media-special.phtml instead of media.phtml for specific products or specific categories?
Both categories and products allow you to save layout xml along with the entity record. In this field for the desired entities, add the following:
<action method="setTemplate" block="product.info.media">
<tpl>path/to/media-special.phtml</tpl>
</action>

Resources