-= content single =-

OpenCart: Multiple layouts for the same route

When you create a custom layout for some product you would expect that other products will use default layout, so the system, technically, will look for default layout by route. On the screen-shot below, OpenCart will pick up ‘default’ layout ‘Product’…

… but this order could be different in the “real world”. so the products with no layout assigned (default) will be also displayed using your custom layout. The easiest way is just to modify source code, I have my own vqmod… see an excerpt from this file below. 

in catalog/design/layout.php

line 4: replace 'route' with layout_id, route
<file name="catalog/model/design/layout.php">
  <search position="ibefore">
    <![CDATA[route DESC]]>
    <![CDATA[layout_id, ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *