hello,
i would like to show in the home the product description and the manufacturer. Any help?
thanks!
i would like to show in the home the product description and the manufacturer. Any help?
thanks!
LOL, I've been just doing that 
So basically you need to edit 2 files:
home.php in catalog\controller\common
home.tpl in the catalog\view\theme\default\template\common
home.php:
find line 46 or so
under it there is:
pay attention to the comma at the end.
home.tpl:
in the html where you want to put the description you add:
----------------------------------------------
Now I have a problem with this, so maybe someone can help:
the description shows the html tags, have no idea why.. also "strip_tags" does not have any effect.
Thanks

So basically you need to edit 2 files:
home.php in catalog\controller\common
home.tpl in the catalog\view\theme\default\template\common
home.php:
find line 46 or so
Code: Select all
$this->data['products'][] = array(
under it add line:'name' => $result['name'],
Code: Select all
'description' => $result['description'],
home.tpl:
in the html where you want to put the description you add:
Code: Select all
<?php echo $products[$j]['description'];?>
Now I have a problem with this, so maybe someone can help:
the description shows the html tags, have no idea why.. also "strip_tags" does not have any effect.
Thanks
When description is saved, special characters are escaped.
You just need to convert back to characters you need in you display.
You can check out the manual on php special character handling as well as mysql have some docs
You just need to convert back to characters you need in you display.
You can check out the manual on php special character handling as well as mysql have some docs
Hi, I see this post really helpfull, but what about the manufacturer, can you post what to change to add the manufacturer down the product name in home??
Thanks,
Wilma
Thanks,
Wilma
Wilma
(Don't speak english)
Hello!
I found my answer trying antrying, so I post it here maybe can help somebody else.
1) Modify this PHP files:
catalog/controller/product/category.php
catalog/controller/product/manufacturer.php
catalog/controller/product/search.php
catalog/controller/product/special.php
After this:
$this->data['products'][] = array(
'name' => $result['name'],
Add this:
'manufacturer' => $result['manufacturer'],
2) Modify this TPL files:
catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer.tpl
catalog/view/theme/default/template/product/search.tpl
catalog/view/theme/default/template/product/special.tpl
After this:
<a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
Add this:
<span style="color: #666; font-size: 11px;"><?php echo $products[$j]['manufacturer']; ?></span><br>
ERROR NOTE: I just couldn't do it in home.php and home.tpl, it gave me an error, so I don't have in my index, just in other pages. If some one solve this error please post it. The error message I received is:
Notice: Undefined index: manufacturer in /home/wilma/public_html/waohzone.com/catalog/controller/common/home.php on line 47
Warning: Cannot modify header information - headers already sent by (output started at /home/wilma/public_html/waohzone.com/catalog/controller/common/home.php:47) in /home/wilma/public_html/waohzone.com/system/library/response.php on line 65
Wilma
I found my answer trying antrying, so I post it here maybe can help somebody else.
1) Modify this PHP files:
catalog/controller/product/category.php
catalog/controller/product/manufacturer.php
catalog/controller/product/search.php
catalog/controller/product/special.php
After this:
$this->data['products'][] = array(
'name' => $result['name'],
Add this:
'manufacturer' => $result['manufacturer'],
2) Modify this TPL files:
catalog/view/theme/default/template/product/category.tpl
catalog/view/theme/default/template/product/manufacturer.tpl
catalog/view/theme/default/template/product/search.tpl
catalog/view/theme/default/template/product/special.tpl
After this:
<a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
Add this:
<span style="color: #666; font-size: 11px;"><?php echo $products[$j]['manufacturer']; ?></span><br>
ERROR NOTE: I just couldn't do it in home.php and home.tpl, it gave me an error, so I don't have in my index, just in other pages. If some one solve this error please post it. The error message I received is:
Notice: Undefined index: manufacturer in /home/wilma/public_html/waohzone.com/catalog/controller/common/home.php on line 47
Warning: Cannot modify header information - headers already sent by (output started at /home/wilma/public_html/waohzone.com/catalog/controller/common/home.php:47) in /home/wilma/public_html/waohzone.com/system/library/response.php on line 65
Wilma
Wilma
(Don't speak english)
Wilma...
If this will help you... I was able to get the manufacturer to show up on the Home page by doing the following:
1. In home.tpl (opencart/catalog/view/theme/default/template/common/home.tpl), find:
and then place this before OR after (whichever your prefer):
2. In home.php (opencart/catalog/controller/common/home.php), find
and place this before OR after (whichever you prefer):
(make sure to include the comma (,) at the end of the line).
======================
Note: I thought about what would happen if the field was left blank, and tried to come up with an "if" statement, but it did not work. I don't desperately need that feature, but I'm putting the code I tried here, in case someone wants to use it as a starting point. I had put this in home.tpl, instead of the other working example (the example above works, and will always show whatever is in the manufacturer field, so ignore the following if you're happy with that.)
If this will help you... I was able to get the manufacturer to show up on the Home page by doing the following:
1. In home.tpl (opencart/catalog/view/theme/default/template/common/home.tpl), find:
Code: Select all
<span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
Code: Select all
<span style="color: #999; font-size: 11px;"><?php echo $products[$j]['manufacturer']; ?></span><br />
Code: Select all
'model' => $result['model'],
Code: Select all
'model' => $result['manufacturer'],
======================
Note: I thought about what would happen if the field was left blank, and tried to come up with an "if" statement, but it did not work. I don't desperately need that feature, but I'm putting the code I tried here, in case someone wants to use it as a starting point. I had put this in home.tpl, instead of the other working example (the example above works, and will always show whatever is in the manufacturer field, so ignore the following if you're happy with that.)
Code: Select all
<?php if ($manufacturer) { ?>
<tr>
<td><b><?php echo $products[$j]['manufacturer']; ?></b></td>
<td><a href="<?php echo str_replace('&', '&', $products[$j]['href']); ?>"><?php echo $products[$j]['manufacturer']; ?></a></td>
</tr>
<?php } ?>
Who is online
Users browsing this forum: Bing [Bot] and 27 guests