Post by clinton4 » Thu Apr 25, 2013 8:25 pm

Hi,

I am trying to create a custom category layout which i need to use for a specific category.

This is what i have done:

1. In System -> Design -> Layouts i have created a new layout.
- Layout Name: Category (catname)
- Store: Default
- Route: product/category_catname

2. In Catalog -> Categories -> Catname -> Design i have set Layout Override to my new Category (catname)

3. In /catalog/view/theme/mytheme/template/product/ i have made a copy of category.tpl and renamed it to category_catname.tpl, then made some changes to category_catname.tpl.

But when i now visit this category page, i cant se any of my changes. I looks like it falls back to the category.tpl file. Why is this happening?

I have read several docs and forum posts regarding layouts and my understanding is that i am doing it the right way, or?

Spam blocking PHP script, use it!


Active Member

Posts

Joined
Sun Jan 17, 2010 11:54 am

Post by justcurious » Thu Apr 25, 2013 10:02 pm

You don't need to create a new .tpl file.

What the layouts system does is allow you to change the layout around the content . The content is what is produced by your category.tpl, but you can have different modules around the content. For example you may have the categories module in the left column for normal categories, but for your custom layout, you may want to add the manufacturers module, Special Offers and / or Featured modules.

I suspect that you are wanting to display the content of your custom category differently to all of the other categories?

The layout system is not designed to do this

Google Product Feed - Get your products into Google Shopping. Includes a bulk update facility.
Backup Pro - Backup (on demand or scheduled), Restore and Clone your store.
Freestyle Box - Add multiple information boxes on multiple pages of your store. Includes optional "Code Mode".
View my other extensions


User avatar
Active Member

Posts

Joined
Sat Dec 24, 2011 4:36 pm
Location - UK

Post by clinton4 » Thu Apr 25, 2013 10:09 pm

I see, thanks for that info :)

You are right, i want to display the content of a spesific category differently then all other categories. Is there any recommended methods to achive this?

Spam blocking PHP script, use it!


Active Member

Posts

Joined
Sun Jan 17, 2010 11:54 am

Post by rupaknepali » Fri Apr 26, 2013 12:03 am

While inserting the category at the layout tab select your preferred tab by which the category showing style differs

Hope this helps you

Rupak Nepali
webocreation.com@gmail.com
http://webocreation.com
Enjoy! Tips and tricks as well as free module.


Active Member

Posts

Joined
Mon Apr 25, 2011 7:04 pm

Post by clinton4 » Fri Apr 26, 2013 12:09 am

rupaknepali wrote:While inserting the category at the layout tab select your preferred tab by which the category showing style differs

Hope this helps you
Sorry, i dont understand what you are saying :)

Spam blocking PHP script, use it!


Active Member

Posts

Joined
Sun Jan 17, 2010 11:54 am

Post by justcurious » Fri Apr 26, 2013 11:25 pm

If you will only ever have one specific category that you want the different page layout for, here's what to do:

In catalog/controller/product/category.php, find:

Code: Select all

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
	$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
} else {
	$this->template = 'default/template/product/category.tpl';
}
and replace with:

Code: Select all

			
if ($category_id == 25) {
   $this->template = $this->config->get('config_template') . '/template/product/category_catname.tpl';
} else {
   if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
	$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
   } else {
	$this->template = 'default/template/product/category.tpl';
   }
}
Change the 25 on the first line of the revised code to the category id of the category you are targetting.

If you want the flexibility to choose more than one category for the "special" template, this can also be done, but it is more complex. Pm me if it is something you want and would like my help

Kind regards

Google Product Feed - Get your products into Google Shopping. Includes a bulk update facility.
Backup Pro - Backup (on demand or scheduled), Restore and Clone your store.
Freestyle Box - Add multiple information boxes on multiple pages of your store. Includes optional "Code Mode".
View my other extensions


User avatar
Active Member

Posts

Joined
Sat Dec 24, 2011 4:36 pm
Location - UK

Post by clinton4 » Sat Apr 27, 2013 6:18 pm

Ok, thanks :)

Spam blocking PHP script, use it!


Active Member

Posts

Joined
Sun Jan 17, 2010 11:54 am

Post by dizovi » Fri Dec 21, 2018 6:56 pm

how can i do same for opencart 2.3.0.2

Newbie

Posts

Joined
Sat Dec 15, 2018 6:16 pm
Who is online

Users browsing this forum: Amazon [Bot] and 97 guests