[Feature] Child Template #6428
Replies: 28 comments 7 replies
-
Must be pointed out: |
Beta Was this translation helpful? Give feedback.
-
Before writing code, how do you envision it working? There's not enough detail in your first post to respond to "if approved...". Many questions arise, including this brief incomplete list: What "kind" of "customizations" are you trying to support? Just CSS? That's easy today. |
Beta Was this translation helpful? Give feedback.
-
More importantly: |
Beta Was this translation helpful? Give feedback.
-
This would be for code files; css and JS would still have to be replicated. The spirit of this idea is to allow people to modify just the code files needed. The problem it solves is having people copy responsive_classic and then never merge back in the changes.
The child template would have overrides directories (named after it) as needed. It just wouldn't require all the responsive_classic files to be copied, as is the case now. |
Beta Was this translation helpful? Give feedback.
-
The only use case I can come up with off the top of my head is where you might want child templates of "your template" to change the look of the site seasonally, so mostly CSS changes in the children. I would personally extend this as it is something I have on the back burner that I have been thinking about for years and children would take us partway there. A store owner may want to "rearrange" some stuff for Christmas, change the order of centerboxes on the homepage, increase the number of items in those centerboxes, switch out text on the homepage, etc... So I think it would be brilliant if in the children's template folder there would be files that could override layout config settings. Nothing worse than switching a template and then having to go fiddle with all of those config switches drbyte hates so much and then having to switch them back when the holiday is over and you switch back to the "normal" template just my two cents and if you take a drink every time you see the word children in this thread it will make you feel better...lol |
Beta Was this translation helpful? Give feedback.
-
I think the approach I am suggesting would make it easier for people to stay up to date.
Agreed - so an alternate approach would be to overrwrite the contents of template_default with what's in responsive_classic, so the latter would become the "real" base. |
Beta Was this translation helpful? Give feedback.
-
if I am understanding you correctly then ummm, no. |
Beta Was this translation helpful? Give feedback.
-
Can you elaborate on your reasoning? I am suggesting this because desktop only templates make no sense anymore. What's the counterargument? |
Beta Was this translation helpful? Give feedback.
-
so you are saying responsive_classic files should replace template_default files, basically making resposive_classic the base for all things, unless you override absolutely everything in a template to get away from responsive classic? Let me lay my bias out on the table. I hate (it is a strong word but I couldn't think of another I would use in polite company) responsive classic, am I forced to use it, sure, and I hold my nose the whole time. Where is my poop emoji when I need it..... |
Beta Was this translation helpful? Give feedback.
-
True. There's all kinds of things they never merge back in until something breaks.
I knew that would come up. :( I actually expected it to be said sooner than this.
IMO the counter-argument is that responsive_classic uses the wonky MobileDetect stuff to determine mobile mode, instead of being truly responsive. That and other bloat it introduced that I wish we'd done differently.
I'm toying with ripping out the defaults for those and creating a json field in a template-related table to store template-specific configs for those. It's a lotta work, and a lotta admin ui dev, and a pain to make backward-compatible with existing templates. But it would reduce a lot of the pain of settings being suddenly wrong when switching between templates. |
Beta Was this translation helpful? Give feedback.
-
I'd like to envision more clearly what overrides a "child template" would have in this context. I'd prefer real examples, not contrived/theoretical. And, while I don't want a rabbit trail, for completeness I should ask: how would it differ from the |
Beta Was this translation helpful? Give feedback.
-
yes, mobile detect can be tossed to the curb
Yes, please. Draw a line in the sand and don't worry about backward-compatible. |
Beta Was this translation helpful? Give feedback.
-
Shared was another idea for multiple templates. Different. |
Beta Was this translation helpful? Give feedback.
-
Consider the following workflow:
You then create the following customizations:
of course, instead of basing your template on responsive classic, it could be some other template - the principle is the same. If there's an update to the template, you drop it in and only need to worry about merging files you have changed. |
Beta Was this translation helpful? Give feedback.
-
Liked it, and backported to several 1.5.x projects |
Beta Was this translation helpful? Give feedback.
-
This!! |
Beta Was this translation helpful? Give feedback.
-
As to the staying up-to-date, I'm not really seeing anything above that improves on that. In fact now there are possibly two files that need to be updated, the parent and the child. I see that it would be easier to update if there was a way to more easily align the template override files with the default/parent files. Right now this is or can be done mostly folder-by-folder rather than template-to-template. I've found a way around that, but I also see that too often individuals are recommended in the forum to ditch their old template and either start anew or with something newer. Statement is made for various reasons whether legitimate or not, but it partially surprises me that keeping a template up-to-date is being identified as I see it as pretty much the primary concern. I'm glad to see it, but surprised. I do also get the "seasonal" template, I tried that early on in my working with Zen Cart and thought I had it all figured out, but then too came the "plugins" part of ensuring everything was everywhere it needed to be, worked pretty well for the year used, but haven't done that again since. It was a full different template rather than just say a color change. Would be willing to revisit the idea of seasonal templating, preferably I guess with minimal file adjustment. |
Beta Was this translation helpful? Give feedback.
-
It helps because you only copy the files you change, rather than ALL of them. So on the next upgrade, if a file you haven't changed is fixed, you get the fix without needing to do any merging or copying. |
Beta Was this translation helpful? Give feedback.
-
I'd forgotten to ask this earlier: Would it make sense to think in terms of "parent" instead of "child"? Or is that what you had in mind but just hadn't stated it that way? A question arises then: to what degree does any version-control become crucial when naming the parent? |
Beta Was this translation helpful? Give feedback.
-
I used the nomenclature that WordPress uses. That's all. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Parent is always the latest and greatest. Child is where merging needs to be done to pull in changes. |
Beta Was this translation helpful? Give feedback.
-
Here's my current 'take' on the changes required for this feature:
Catalog FilesThe following files make use of
Admin FilesChanges needed to:
|
Beta Was this translation helpful? Give feedback.
-
The to-be-posted comment below serves as the design documentation for the feature. It'll be updated on an as-needed basis, with the low-level design changes added once the high-level description of the processing is agreed to. |
Beta Was this translation helpful? Give feedback.
-
Zen Cart Child TemplatesOverviewStorefront ConsiderationsThe "Child Template" feature is an extension of Zen Cart's current template structure. For example, the built-in
1 For multi-language sites, When the site's active template is a 'child', the Zen Cart handling of While Zen Cart's current template structure provides the above fall-back for
|
Beta Was this translation helpful? Give feedback.
-
Yep.
Right, and when the 'parent' template is updated any non-overridden files for the 'child' template just 'activate'.
Also correct. Fewer files to check for updates (only those overridden by the 'child').
|
Beta Was this translation helpful? Give feedback.
-
Note: Functional description updated to enable a 'child' template to be copied to another 'child' and for a 'child' template to be removed. |
Beta Was this translation helpful? Give feedback.
-
Please take a look at how we implemented templating. -- The basis is that we have a "default" template To easily see it in action:
Changes made in that new file, should show. In this way, user can do as they want outside the core files...obviously leading to a scenario where a core update should take not more than a few moments to complete. Give it a go, it'll give you ideas for sure. Making a new template is super-simple. I am currently working on a template that radically changes the look of Phoenix - when I'm done, it'll be a "drop in" folder to |
Beta Was this translation helpful? Give feedback.
-
WordPress has this notion of a Child Theme where you only customize the stuff you want to change and get everything else from the regular theme directory, which can be updated with bug fixes, etc.
It would not be hard to do this for Zen Cart. If approved I'd be happy to add it. The first use case would be a child theme for Responsive Classic, which could perhaps be provided as a plugin after the release of 1.5.8.
Beta Was this translation helpful? Give feedback.
All reactions