Post by mikrocica » Wed Sep 26, 2018 8:51 pm

I wish to have 2-3 types of product themes. (not layouts)
Lets say one has pink background the other has blue and the third has green.
One shows the product picture, the other doesn't. etc...
I could make/edit the twig files, however just don't know how to assign them to a product.

Is it possible to assign a different product to a twig? (preferably on the product setting page of the admin panel)
I not only would like to have a different layout (changing modules and their positions) but to have a different theme/template assigned to each product?

Thank you for any help

Newbie

Posts

Joined
Tue Jun 02, 2015 3:30 pm

Post by synapseindia » Wed Sep 26, 2018 9:17 pm

Yes it is possible . You have to customize the product controller.
You can set if /elseif/else statement to render files based product id .

Thanks

User avatar
Active Member

Posts

Joined
Thu Apr 05, 2018 2:27 pm

Post by Johnathan » Wed Sep 26, 2018 11:28 pm

If your changes are CSS-related, you might be able to use Dynamic Styling for that. It works as a normal module extension, so what you do is create a custom styling (including custom CSS) then create a layout with that module, then assign the product that layout in its "Design" tab. That will give it that layout, and apply any modules that are on that layout, including the styling you set up.

Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by mikrocica » Tue Oct 02, 2018 8:08 pm

Thanks.
Instead of any extension I would be more interested in the logic itself.
How are twigs-design-layout-theme related to each other.
As several products are concerned if/else statements wouldn't be the solution either.

However the question is:
By editing/copying twig files, can those be added to a certain product (on its design tab)
Thanks

Newbie

Posts

Joined
Tue Jun 02, 2015 3:30 pm

Post by Johnathan » Wed Oct 03, 2018 12:38 am

mikrocica wrote: Thanks.
Instead of any extension I would be more interested in the logic itself.
How are twigs-design-layout-theme related to each other.
The .twig file controls all product pages. You can assign different layouts to individual products, but those aren't .twig files. A layout is just a list of modules to show on that particular page.

mikrocica wrote: However the question is:
By editing/copying twig files, can those be added to a certain product (on its design tab)
Thanks
You'd have to modify the product template code and the layout system in order to do that. It's certainly possible, but beyond what anyone in the forum will likely be able to lead you through. I'd recommend playing around with the layout system and files that control that to get a feeling for how it works, as well as look in the controller files to figure out how they load the .twig template files. You could then change that code to load different .twig files depending on the layout overrides you set in the product data.

If you can't figure out how to do this yourself, you may want to get in touch with someone for commercial support, to create this kind of system for you. If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 16 guests