Hi guys, just curious about how to customize the page for a particular category.
For instance, "category/path/27" "category/path/26" and "category/path/24" should all be controlled by category.tpl
How do I set up a file to control just "category/path/25" ?
Thanks for any help. Let me know if I need to clarify more.
For instance, "category/path/27" "category/path/26" and "category/path/24" should all be controlled by category.tpl
How do I set up a file to control just "category/path/25" ?
Thanks for any help. Let me know if I need to clarify more.
I just noticed that someone asked a similar question below. Sorry to post it again but that one didn't make sense anyway .
I'll show you a very easy and cool dynamic way to do this:
Edit: catalog/controller/product/category.php
Find:
Replace with:
Now, anytime you want a custom category template. Create a clone of the category.tpl file using the category path as part of the name. For example:
category_25.tpl
category_25_38.tpl
category_25_38_72.tpl
etc.
The code will first check for the existence of an override file. If there is one it will use it. If there is none for that category, then it will default to the original file.
This can be done for virtually any file. Products, information, etc.
Edit: catalog/controller/product/category.php
Find:
Code: Select all
$this->template = $this->config->get('config_template') . 'product/category.tpl';
Code: Select all
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl';
if (!file_exists(DIR_TEMPLATE . $this->template)) {
$this->template = $this->config->get('config_template') . 'product/category.tpl';
}
category_25.tpl
category_25_38.tpl
category_25_38_72.tpl
etc.
The code will first check for the existence of an override file. If there is one it will use it. If there is none for that category, then it will default to the original file.
This can be done for virtually any file. Products, information, etc.
Uh oh... I do not have any folders inside of catalog/controller/
I checked it against the latest download of OpenCart. I'm assuming I have a slightly older version of OpenCart. Can't find the version listed anywhere, though.
Any chance there's a way to do this with the older versions of OpenCart?
I checked it against the latest download of OpenCart. I'm assuming I have a slightly older version of OpenCart. Can't find the version listed anywhere, though.
Any chance there's a way to do this with the older versions of OpenCart?
And now I see the OpenCart 0.x part of the forum and it's locked. I'm scattered today.
Assuming it's now unsupported. Is there documentation on how to upgrade?
Assuming it's now unsupported. Is there documentation on how to upgrade?
Hi Q,
Sorry i'm confused. What is the difference between opencart and opencart zero?
Sorry i'm confused. What is the difference between opencart and opencart zero?
I already installed opencart in my server ( i like it so far ) and maybe opencart zero has a little bit more advantage than this one.Qphoria wrote:OpenCart 0.x is now its own cart system with its own forums:
OpenCart Zero
It is very much alive, and yes a similar feature can be accomplished with 0.x as well:
Posted here
OpenCart version 0.x was the original version of OpenCart. After the release of OpenCart 1.x, it was deemed that the 2 projects were so different that they needed to progress their own separate ways.
OpenCart Zero, just refers to the 0.x branch. It's been around a bit longer so it has a leg up on stability, but both carts have different features, so it comes down to what you are looking for in a cart. I am currently ramping up for a new v0.8 release of OpenCart Zero within a week (hopefully) that will have a whole new assortment of features, improvements (imo), and a new default look.
OpenCart Zero, just refers to the 0.x branch. It's been around a bit longer so it has a leg up on stability, but both carts have different features, so it comes down to what you are looking for in a cart. I am currently ramping up for a new v0.8 release of OpenCart Zero within a week (hopefully) that will have a whole new assortment of features, improvements (imo), and a new default look.
Thankz a lot Q. That's a relief. hehe I thought opencart v1.x will loosing its support. I'm still getting my self acquainted with this system and first time to accept this online shopping project. Thankz again Q. I'll post the URL of my project here when i'm done and open to public.
I made some changes on the template and i'm glad to share it with you.
I made some changes on the template and i'm glad to share it with you.
How would I go about using dynamic templates for products/categories in 1.4.8? The code currently in my category.php appears slightly different...
Qphoria wrote:I'll show you a very easy and cool dynamic way to do this:
Edit: catalog/controller/product/category.php
Find:Replace with:Code: Select all
$this->template = $this->config->get('config_template') . 'product/category.tpl';
Now, anytime you want a custom category template. Create a clone of the category.tpl file using the category path as part of the name. For example:Code: Select all
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl'; if (!file_exists(DIR_TEMPLATE . $this->template)) { $this->template = $this->config->get('config_template') . 'product/category.tpl'; }
category_25.tpl
category_25_38.tpl
category_25_38_72.tpl
etc.
The code will first check for the existence of an override file. If there is one it will use it. If there is none for that category, then it will default to the original file.
This can be done for virtually any file. Products, information, etc.
Does anyone have any solutions for doing this in the current version?
I have two main categories of products but need a slightly different layout for the product pages for each and have so far been unable to achieve this.
Would really appreciate any assistance with this, thanks.
I have two main categories of products but need a slightly different layout for the product pages for each and have so far been unable to achieve this.
Would really appreciate any assistance with this, thanks.
In 1.4.0 and later you can do it this way.
1. FIND (All instances):
2. REPLACE WITH:
1. FIND (All instances):
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';
}
Code: Select all
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category_' . $this->request->get['path'] . '.tpl')) {
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl';
} elseif (file_exists(DIR_TEMPLATE . 'default/template/product/category_' . $this->request->get['path'] . '.tpl')) {
$this->template = 'defaul/template/product/category_' . $this->request->get['path'] . '.tpl';
} elseif (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';
}
Awesome.. that's a great help with my category pages.
In case anyone else just copies and pastes the above code, I had to make a couple of tiny corrections:
On the third line
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl';
needed: /template/ in front of 'product/category_'
and default is missing a 't' on the end on the sixth line.
Works a treat though as I say...
How easy is it to apply this approach, or something similar to product templates?
Really I would want to have a different template according to the category the product resides in, as my products only have one category assigned to them.
In case anyone else just copies and pastes the above code, I had to make a couple of tiny corrections:
On the third line
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl';
needed: /template/ in front of 'product/category_'
and default is missing a 't' on the end on the sixth line.
Works a treat though as I say...
How easy is it to apply this approach, or something similar to product templates?
Really I would want to have a different template according to the category the product resides in, as my products only have one category assigned to them.
Hello.. back on this project again (been juggling magento, wordpress e-commerce and opencart projects!)
I'd rather not have to do it via product id's to keep things flexible, but I'd like to have different templates for products in different categories.
I'd rather not have to do it via product id's to keep things flexible, but I'd like to have different templates for products in different categories.
I made a mod for this very thing, You select the template from the category / product page in the admin area. So no need to hardcode every page.timkirtley wrote:Awesome.. that's a great help with my category pages.
In case anyone else just copies and pastes the above code, I had to make a couple of tiny corrections:
On the third line
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl';
needed: /template/ in front of 'product/category_'
and default is missing a 't' on the end on the sixth line.
Works a treat though as I say...
How easy is it to apply this approach, or something similar to product templates?
Really I would want to have a different template according to the category the product resides in, as my products only have one category assigned to them.
http://forum.opencart.com/viewtopic.php?f=23&t=12935
Wedding Invitations and Stationery by Love2print
Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds
Have I helped you out or saved you some time? Please donate
Sounds perfect.. downloaded it any got so far but ran in to a small problem as described in the other thread... But yeah, this sounds like it will be perfect.
Hi Qphoria,
Does this mod works in 1.5.1? I have a site (www.bodybebe.ro) with 6 templates, one for each category, one intro&about. I made a clone of category.tpl (in view/theme/default/product ) as category_59_60.tpl; category_59_63.tpl;category_59_65.tpl;category_59_66.tpl;category_59_67.tpl
and the code was :
if (file_exists(DIR_TEMPLATE . $this->config->get
('config_template') . '/template/product/category_' . $this->request->get['path'] . '.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/category_' . $this->request->get['path'] . '.tpl';
} elseif (file_exists(DIR_TEMPLATE . 'default/template/product/category_' . $this->request->get['path'] . '.tpl')) {
$this->template = 'default/template/product/category_' . $this->request->get['path'] . '.tpl';
} elseif (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';
}
But nothing happened, seems code don't work. Any sugestions?
Does this mod works in 1.5.1? I have a site (www.bodybebe.ro) with 6 templates, one for each category, one intro&about. I made a clone of category.tpl (in view/theme/default/product ) as category_59_60.tpl; category_59_63.tpl;category_59_65.tpl;category_59_66.tpl;category_59_67.tpl
and the code was :
if (file_exists(DIR_TEMPLATE . $this->config->get
('config_template') . '/template/product/category_' . $this->request->get['path'] . '.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/category_' . $this->request->get['path'] . '.tpl';
} elseif (file_exists(DIR_TEMPLATE . 'default/template/product/category_' . $this->request->get['path'] . '.tpl')) {
$this->template = 'default/template/product/category_' . $this->request->get['path'] . '.tpl';
} elseif (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';
}
But nothing happened, seems code don't work. Any sugestions?
Hi, i need to identify the category NOT by path or id, but by SKU or Model or something else..i can do this?
ps: sorry for my bad english ^^'
ps: sorry for my bad english ^^'
Qphoria wrote:I'll show you a very easy and cool dynamic way to do this:
Edit: catalog/controller/product/category.php
Find:Replace with:Code: Select all
$this->template = $this->config->get('config_template') . 'product/category.tpl';
Now, anytime you want a custom category template. Create a clone of the category.tpl file using the category path as part of the name. For example:Code: Select all
$this->template = $this->config->get('config_template') . 'product/category_' . $this->request->get['path'] . '.tpl'; if (!file_exists(DIR_TEMPLATE . $this->template)) { $this->template = $this->config->get('config_template') . 'product/category.tpl'; }
category_25.tpl
category_25_38.tpl
category_25_38_72.tpl
etc.
The code will first check for the existence of an override file. If there is one it will use it. If there is none for that category, then it will default to the original file.
This can be done for virtually any file. Products, information, etc.
Who is online
Users browsing this forum: No registered users and 27 guests