I am adding a new twig for testing designs.
I have added nwqtest.twig (copy of product.twig with noticeable changes) in the store product template folder,
I have added a nwqtest.php in controller/catalog by copying product.php and changing all instances of product/product(except language pointers) to product/nwqtest
I have added a new layout NWQtester in admin with route product/nwqtest.
I have set one product to use NWQtester with layout override.
I have reset and saved the twig using the admin theme editor
I have cleared the cache, and refreshed modifications
When I look at the product from the front end, the new layout is being used, but it is still using the product.twig.
What am I missing???
Unfortunately, that's not how layouts work. Layouts are assigned routes, so they control all pages with that route (e.g. route=product/product for the product page). If you want a new template file for a specific product, you're going to have to duplicate all the controller/view files for the product page, and then make the new product use that route. That's a lot of work, so it's not something I'd really recommend.
Instead, are the changes something you could do mostly with CSS? If so, you could use an HTML module to add CSS specific to that page, or an extension like Dynamic Styling or Rule-Based Banners. Once you have a module that you want to load on a specific product page, then you can (1) create a layout for that page, with the module assigned to it, and no route assigned to it, then (2) add that layout the product, in its "Design" tab. That will make the product use that layout, and any modules associated with it, instead of the default product layout.
You can do the same thing with other modules, but you can't change the template file itself --- that requires changing files like I described above, so it's not really recommended. If you can do it with HTML/CSS modules that's the best method, otherwise you'll need to familiarize yourself with the MVC system and learn how to add new controllers and template files.
Instead, are the changes something you could do mostly with CSS? If so, you could use an HTML module to add CSS specific to that page, or an extension like Dynamic Styling or Rule-Based Banners. Once you have a module that you want to load on a specific product page, then you can (1) create a layout for that page, with the module assigned to it, and no route assigned to it, then (2) add that layout the product, in its "Design" tab. That will make the product use that layout, and any modules associated with it, instead of the default product layout.
You can do the same thing with other modules, but you can't change the template file itself --- that requires changing files like I described above, so it's not really recommended. If you can do it with HTML/CSS modules that's the best method, otherwise you'll need to familiarize yourself with the MVC system and learn how to add new controllers and template files.
Who is online
Users browsing this forum: No registered users and 14 guests