Page 1 of 1

One code base for repeating Product info box in opencart site.

Posted: Sun Oct 15, 2017 10:48 pm
by jos@kelleners.nl
Hello,
I'm working in a project where my customer wants to change the product info box. With "product info box" I mean the box with product thumb, name and price as it is shown in the overviews of categories, latest products and related products. This box although it has always the same code is not put in a separate function or template, but it is part of almost every template page. Changing this box means editing every template page and possibly change all the controllers associated with it. I wonder if there is not a different solution where the box code is put in a different template (think of smarty). Does someone have experience with this?

Re: One code base for repeating Product info box in opencart site.

Posted: Mon Oct 16, 2017 7:58 am
by IP_CAM
Well, strictly technically, such already exists, at least in certain Themes.
They use 'global settings' for certain layouts, to have all sections, like grid-view,
list-view, toolbars, form-action, e.t.c., then looking fully identical, as set in Admin.
But I could not tell you, wich themes are using such 'common' ways of doing things,
I found it in the famous Merkent Bootstrap Theme, but this is only for Version v.1.5.6.x.
Just to mention this !
Good Luck! ;)
Ernie
http://merkent.com/merkent_theme_v3
Image
Image

Re: One code base for repeating Product info box in opencart site.

Posted: Thu Oct 19, 2017 1:26 am
by jos@kelleners.nl
:) Thank you for your resonse.
I think there is allot of double code for this "product box". A separate template for this box in combination with a small adjustment in the controllers would make life easier and decrease the code lines. Your post does something like that. I wonder if this should not be a "feature of the next generation "open-cart". I'm not aware of any extension doing such a thing.

Re: One code base for repeating Product info box in opencart site.

Posted: Thu Oct 19, 2017 4:55 am
by Johnathan
This has been suggested many times, and most developers agree this would be a good idea. However, it hasn't made it into the core in the years since it was first suggested, so I wouldn't plan on it happening any time soon.

Some themes may have a standard "product box" template file in their code, so you might look around and ask some theme developers. It's certainly doable yourself, but you have to edit all the template files that load a list of products, and change them so they all load from the same "master" template file.