Post by DBI » Tue Nov 04, 2014 8:55 am

Hi,

I imagine this is a common question but I couldn't find much via Google or searching this forum:

I'm trying to create an alternate category template which can be assigned to some categories, while others will continue to use the default category template.

I have made the following changes:

- Created a new category controller (category2.php) and changed the relevant filenames to point to the new template.
- Created a new category template (category2.tpl).

This works in the sense that I can now change the URL for a given category and get the new content generated by the alternate template and controller.

The problem is that I haven't been able to find a way to assign this alternate template to a given category in admin. I could of course make changes in the database to get around this but it needs to be accessible to non techie admin users so that's not a good solution.

I did try adding the alternate template to system->design->layouts, along with the alternate route, but this did not seem to make any difference.

Posting in hopes that someone will know a way to make this work without core code changes.

DBI
New member

Posts

Joined
Tue Oct 14, 2014 10:58 am

Post by uksitebuilder » Tue Nov 04, 2014 4:14 pm

You are almost there

When you edit a category, on the Design tab, you can choose the layout overide for your new layout that you created i nSystem - Designs - Layouts

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by DBI » Wed Nov 05, 2014 5:00 am

I of course did that after I created the new layout in admin. It has no effect.

By effect I mean that the menu links do not change, any link to the category in question continues to point to the default category route.

To reiterate, it does work correctly at the correct link (route=product/category2) but OpenCart is not using the new link when generating menu links.

My understanding is that this is because the layout system is not meant to allow for additional templates, only to control positioning of elements on the page. My hope is that there is some easy way to get around this, while maintaining usability.

DBI
New member

Posts

Joined
Tue Oct 14, 2014 10:58 am

Post by DBI » Thu Nov 06, 2014 4:44 am

For posterity, after skimming the relevant core code, reading pretty much everything on the net about his issue, as well as getting no replies here, I'm concluding that there is no workaround.

I have solved the problem temporarily with mod rewrite (links to specific categories are 301ed to the category2 route). When I get time I'll use VQMOD to solve it in a more user friendly way.

DBI
New member

Posts

Joined
Tue Oct 14, 2014 10:58 am
Who is online

Users browsing this forum: No registered users and 3 guests