cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong product layout because of wrong controller name for product pages

Wrong product layout because of wrong controller name for product pages

Hi,

I'm running Magento 1.9.3.7 and I got an issue on about 1/3 of my 5000 products.

 

When I echo the code bellow, 1/3 return "index" and the other return "product".

They should all return "product". I don't know why few are bugged.

I tried to rebuild the whole index from the BO but it didn't solve the issue.

 

echo Mage::app()->getFrontController()->getRequest()->getControllerName();

 

In my layout.xml, I have a definition of "my catalog_product_view".

I've also "cms_index_index" for the homepage (which returns also "index" when I use getControllerName().

 

Be cause of that wrong controllerName returned, the template is a mess.

I got a mix between a product page, a cms page and a 404 error page.

 

What is this all about? How can I fix this?

 

Thanks guys!

2 REPLIES 2

Re: Wrong product layout because of wrong controller name for product pages

Got more informations. I analysed the values returned by the controller:

 

print_r(Mage::app()->getFrontController());

Here are the differences:

 

Wrong product page:

- [action] => Mage_Cms_IndexController Object
- [_route:protected] => cms
- [_controllerModule:protected] => Mage_Cms
- [_module:protected] => cms
- [_controller:protected] => index
- [_action:protected] => noRoute

 

Good product page:

- [action] => Francecreation_PrintProduct_ProductController Object
- [_route:protected] => catalog
- [_controllerModule:protected] => Francecreation_PrintProduct
- [_module:protected] => catalog
- [_controller:protected] => product
- [_action:protected] => view

Re: Wrong product layout because of wrong controller name for product pages

Digging a bit more.

 

Cache is off

Compilation is off

Wrong URL is in core_url_rewrite

 

If I access to the page with /catalog/product/view/id/xxx - the problem is still visible.