Page 1 of 2
Add Manufacturer or Model to Category page - 1.5.x
Posted: Sat Jun 25, 2011 7:56 am
by cmikel
I would like to ideally ad manufacturer to my category page layout. if it is easier i would settle for model.
So that it displays like so:
image
manufacturer
product name
price
Can someone please help in editing the controller file?
I've seen many solutions for 1.4.x. but the solutions do not apply to 1.5.x.
thanks!
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sat Jun 25, 2011 11:16 am
by inactiveaccount9912
Here you will find a free vqmod that will allow you to set and display manufacturer/module and other fields on product listings: http://forum.opencart.com/viewtopic.php?f=131&t=54442
In controller , after line
'name' => $result['name'],
add
'model' => $result['model'],
In the tpl , find the line
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
change it to
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a><br /><?php echo $product['model']; ?></div>
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Mon Jun 27, 2011 1:36 am
by cmikel
thank you!! works perfectly!
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Oct 23, 2011 1:11 pm
by sinbad
I was trying to display the mfg name in the same manner without luck.
using 1.5.1
tried adding in category.php
Code: Select all
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'rating' => $result['rating'],
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']),
'manufacturer' => $result['manufacturer']
);
}
and in the TPL file
Code: Select all
<?php echo $products['manufacturer']; ?>
however nothing is shown and I don't get any error.
anyone mind correcting me please?
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Oct 23, 2011 6:00 pm
by inactiveaccount9912
You either modify the grid list view js and a a new div manufacturer or you include the manufacturer in one of the existing divs, like name or description.
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Oct 23, 2011 8:18 pm
by sinbad
thanks for the reply.
I want the manufacture name there in both grid/list views,
So I tried to add the manufacture as part of the link.
here is the full stanza I have now but I get just the product name
Code: Select all
<div class="name"><a href="<?php echo $product['href']; ?>">
<?php echo $products['manufacturer']; ?>
-
<?php echo $product['name']; ?></a></div>
tried also like that without luck
Code: Select all
<div class="name"><a href="<?php echo $product['href']; ?>">
<?php echo $products[$j]['manufacturer']; ?>
-
<?php echo $product['name']; ?></a></div>
and
Code: Select all
<div class="name"><a href="<?php echo $product['href']; ?>">
<?php echo $product['manufacturer']; ?>
-
<?php echo $product['name']; ?></a></div>
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Oct 23, 2011 8:28 pm
by sinbad
oppps sorry got it.
I was editing eclipse cached files and I'm working on localhost.... dummy.
Thanks for the quick reply again.
edit: played with vqmod a little.
here is the xml in case someone else wants.
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Mon Oct 24, 2011 12:03 am
by sinbad
I wanted to do the same for the home page modules latest and featured.
Latest is working fine using same code but Featured gives me an error
Code: Select all
Undefined variable: result in /var/www/html/opencart/catalog/controller/module/featured.php on line 52
line 52 reads
Code: Select all
'manufacturer' => $result['manufacturer'],
I can't figure what other part I need to copy to featured.php controller so I can show manufacture name there as well?
TIA for any help...
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Mon Oct 24, 2011 1:52 pm
by inactiveaccount9912
for featured in controller is $product_info instead of $result.
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Mon Oct 24, 2011 8:56 pm
by sinbad
sweet. thanks a lot florinsith it looks much better now

Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Tue Nov 22, 2011 4:58 am
by Digital Sushi
florinsith wrote:In controller , after line
'name' => $result['name'],
add
'model' => $result['model'],
In the tpl , find the line
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
change it to
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a><br /><?php echo $product['model']; ?></div>
I tried this in 1.5.1.3, but it doesn't seem to work. Any suggestions?
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Tue Nov 22, 2011 11:02 pm
by inactiveaccount9912
It should work in 1.5.1.3 too. Are you sure you did it right?
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Nov 27, 2011 3:32 pm
by Digital Sushi
I've managed to fix it.
Would I be able to do the same for a product's stock status?
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sat Dec 10, 2011 1:28 am
by remcofaasse
florinsith wrote:You either modify the grid list view js and a a new div manufacturer or you include the manufacturer in one of the existing divs, like name or description.
Do I need to put the following code: ><br /><?php echo $product['model']; ?></ also in the js? Or what is the right code for the js?
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sat Dec 10, 2011 3:29 am
by inactiveaccount9912
It should be like this - the modifs are bolded and underlined.
<script type="text/javascript"><!--
function display(view) {
if (view == 'list') {
$('.product-grid').attr('class', 'product-list');
$('.product-list > div').each(function(index, element) {
html = '<div class="right">';
html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>';
html += ' <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>';
html += '</div>';
html += '<div class="left">';
var image = $(element).find('.image').html();
if (image != null) {
html += '<div class="image">' + image + '</div>';
}
var price = $(element).find('.price').html();
if (price != null) {
html += '<div class="price">' + price + '</div>';
}
html += ' <div class="name">' + $(element).find('.name').html() + '</div>';
html += ' <div class="model">' + $(element).find('.model').html() + '</div>';
html += ' <div class="description">' + $(element).find('.description').html() + '</div>';
var rating = $(element).find('.rating').html();
if (rating != null) {
html += '<div class="rating">' + rating + '</div>';
}
html += '</div>';
$(element).html(html);
});
$('.display').html('<b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display(\'grid\');"><?php echo $text_grid; ?></a>');
$.cookie('display', 'list');
} else {
$('.product-list').attr('class', 'product-grid');
$('.product-grid > div').each(function(index, element) {
html = '';
var image = $(element).find('.image').html();
if (image != null) {
html += '<div class="image">' + image + '</div>';
}
html += '<div class="name">' + $(element).find('.name').html() + '</div>';
html += '<div class="model">' + $(element).find('.model').html() + '</div>';
html += '<div class="description">' + $(element).find('.description').html() + '</div>';
var price = $(element).find('.price').html();
if (price != null) {
html += '<div class="price">' + price + '</div>';
}
var rating = $(element).find('.rating').html();
if (rating != null) {
html += '<div class="rating">' + rating + '</div>';
}
html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
html += '<div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
html += '<div class="compare">' + $(element).find('.compare').html() + '</div>';
$(element).html(html);
});
$('.display').html('<b><?php echo $text_display; ?></b> <a onclick="display(\'list\');"><?php echo $text_list; ?></a> <b>/</b> <?php echo $text_grid; ?>');
$.cookie('display', 'grid');
}
}
view = $.cookie('display');
if (view) {
display(view);
} else {
display('list');
}
//--></script>
And if you add it with sepparate div it should look like this: (you can style the class in the css:
<div class="product-list">
<?php foreach ($products as $product) { ?>
<div>
<?php if ($product['thumb']) { ?>
<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
<?php } ?>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<div class="model"><?php echo $product['model']; ?></div>
<div class="description"><?php echo $product['description']; ?></div>
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<br />
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
<?php } ?>
</div>
<?php } ?>
<?php if ($product['rating']) { ?>
<div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
<?php } ?>
<div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a></div>
<div class="wishlist"><a onclick="addToWishList('<?php echo $product['product_id']; ?>');"><?php echo $button_wishlist; ?></a></div>
<div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');"><?php echo $button_compare; ?></a></div>
</div>
<?php } ?>
</div>
/div
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sat Dec 10, 2011 3:34 am
by uksitebuilder
looks like we are posting in different forums on the same topic flo.
I just knocked up a free vqmod for adding manufacturer to category, specials and search pages for someone
http://forum.opencart.com/viewtopic.php?f=131&t=48123
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Mon Dec 12, 2011 3:21 am
by remcofaasse
Thanks florinsith! It works great.
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Feb 26, 2012 10:39 pm
by eclipse005
Ok nice work. maybe i missed something out, but how can I display the product model under the product title/thumb in the categories pages (grid and list view)?
I noticed that JS, and which JS file is that? I am using the latest version of Opencart!
tx
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Feb 26, 2012 11:16 pm
by inactiveaccount9912
Its not another file, that js is in the same file in the category.tpl at the bottom.
Re: Add Manufacturer or Model to Category page - 1.5.x
Posted: Sun Feb 26, 2012 11:34 pm
by eclipse005
florinsith wrote:Its not another file, that js is in the same file in the category.tpl at the bottom.
We are talking about the category.tpl located in the Catalog / View / Template / Product, right?