0

My local.xml is not affecting my product page layout. Any idea how to debug it or, better yet, fix it?

I have this in my theme/local.xml.

...
    </default>
<catalog_product_view>
   <reference name="root"><!-- was set to pages/2columns-right.phtml, changing it does nothing -->
      <action method="setTemplate"><template>pages/2columns-left.phtml</template></action>
   </reference>
</catalog_product_view>
...

Changing it has no effect. Another developer has used per-product layout updates to "fix" the problem, but I think the best solution is to get the xml directive to work, rather than fill up the database with 1 million new entries.

I found this magento.stackexchange answer on how to trace the layout building process, but it isn't helping me find the actual problem.

I've inserted this into the top of my theme/product/view.phtml:

<pre><?php var_dump(Mage::app()->getLayout()->getUpdate()->getHandles()); ?></pre>

The output is essentially the same for a product that has no per-product layout update applied vs one that does have one applied:

1.) no per-product layout applied:

array(11) {
  [0]=>
  string(7) "default"
  [1]=>
  string(13) "STORE_default"
  [2]=>
  string(28) "THEME_frontend_default_mytheme"
  [3]=>
  string(20) "catalog_product_view"
  [4]=>
  string(19) "PRODUCT_TYPE_simple"
  [5]=>
  string(14) "PRODUCT_157610"
  [6]=>
  string(19) "customer_logged_out"
  [7]=>
  string(9) "MAP_popup"
  [8]=>
  string(19) "MAP_price_msrp_item"
  [9]=>
  string(14) "SHORTCUT_popup"
  [10]=>
  string(17) "SHORTCUT_uk_popup"
}

2.) per-product layout applied (visible in the admin product page under Design/Page Layout: "2 columns with right bar")

array(11) {
  [0]=>
  string(7) "default"
  [1]=>
  string(13) "STORE_default"
  [2]=>
  string(28) "THEME_frontend_default_mytheme"
  [3]=>
  string(20) "catalog_product_view"
  [4]=>
  string(19) "PRODUCT_TYPE_simple"
  [5]=>
  string(12) "PRODUCT_2563"
  [6]=>
  string(19) "customer_logged_out"
  [7]=>
  string(9) "MAP_popup"
  [8]=>
  string(19) "MAP_price_msrp_item"
  [9]=>
  string(14) "SHORTCUT_popup"
  [10]=>
  string(17) "SHORTCUT_uk_popup"
}

2 Answers 2

3

You have a typo, it's page/2columns-left.phtml not pages/2columns-left.phtml.

0
0

use following code in your local.xml

<catalog_product_view>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
</catalog_product_view>

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.