Hi all.
Any ideas for the following situation:
Ecommerce site with standard category pages (with thumbnails of contained products) and product pages (with product details).
Category 1
|--- Product 1
|--- Product 2
|--- Product 3
The category page uses a very different template (or content TV) than the product pages. The problem I’m having is that if I set the folders to the "category" template/TV, the products will inherit it...
What it seems like I’d need is something like an "inherit override", where the folder could itself be "category", but it would pass on "product" for the product pages to inherit.
Am I confusing the issue? There are a lot of workarounds, like just hiding the unneeded stuff with CSS, but is there a better way? While it’s not a show stopper to have to manually set new products to the "product" TV/template, it is one extra step for the client to screw up.
Thanks for any ideas.
-Brett
-
MODX Staff
- 1,535 Posts
A slightly modified version of the ’Inherit Template from Parent’ plugin should be able to handle this.
Instead of defaulting the template on a child page to that of the parent, you can adjust the plugin to check the template id of the parent and if it corresponds to the ’Category’ template, then make the plugin assign the ’Product’ template to the child page. This would only need be a small addition in logic to implement.
Hope that helps,
Garry
Garry Nutting
Senior Developer
MODX, LLC
Email:
[email protected]
Twitter: @garryn
Web: modx.com
Huh, that’s a great idea. I’ll see what I can come up with and post it if I get anything working.
Thanks Garry. Greatly appreciated.
Followup question:
I’ve gotten into the habit of using a single template, and controling the layout with a TV called contentLayout. So, I’d probably be looking for a solution like that but with the @INHERIT binding rather than the inherit plugin. ... Maybe a snippet as the default value that checks to see what it’s inheriting and changes to "product" if it inherits "category"?
Don’t know how that would work with subcategories, but does that make sense, or is there a better idea?
Thanks again.