Search code examples
xmlmagentolayoutmodule

Disable Magento extention/module on mobile theme


An extension I have installed on my Magento site overwrites the view.phtml file for the product pages, even on the mobile site. I would like to use the mobile template's view.phtml when viewing from a mobile device.

I've thought of some options to fix the problem, but don't know how to do it, or which method would work best..

  • disable the module overriding the template file, only when viewed via a mobile device (make it device-dependent somehow)
  • edit the module's layout xml to conditionally override the template files, based on the device (not sure if this is possible either)
  • ?????

Any ideas?


Solution

  • The module most likely uses it's own layout XML file within the default Magento theme to override the view.phtml.

    1. Find the module's layout XML file inside of app/design/frontend/default/default/layout/MODULENAME.xml (this is the common format)

    2. Copy that XML file to your mobile theme's layout folder.

    3. Open the XML file, and look for the view.phtml template override. It will look something like: template="MODULENAME/path/to/view.phtml"

    4. Change this back to the default, which is: catalog/product/view.phtml

    Save the file, flush your Magento caches. The product page layout should revert back to your default view.phtml file when viewing the mobile template.

    If you want to remove all overrides occuring in the module's layout XML file, you can simply delete everything inside of the file, and save it like that in the mobile theme's layout directory.