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!
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!
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
In controller , after line
add'name' => $result['name'],
In the tpl , find the line'model' => $result['model'],
change it to<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a><br /><?php echo $product['model']; ?></div>
I was trying to display the mfg name in the same manner without luck.
using 1.5.1
tried adding in category.php
and in the TPL file
however nothing is shown and I don't get any error.
anyone mind correcting me please?
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']; ?>
anyone mind correcting me please?
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.
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
tried also like that without luck
and
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>
Code: Select all
<div class="name"><a href="<?php echo $product['href']; ?>">
<?php echo $products[$j]['manufacturer']; ?>
-
<?php echo $product['name']; ?></a></div>
Code: Select all
<div class="name"><a href="<?php echo $product['href']; ?>">
<?php echo $product['manufacturer']; ?>
-
<?php echo $product['name']; ?></a></div>
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.
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.
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
line 52 reads
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...
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
Code: Select all
'manufacturer' => $result['manufacturer'],
TIA for any help...
I tried this in 1.5.1.3, but it doesn't seem to work. Any suggestions?florinsith wrote:In controller , after lineadd'name' => $result['name'],
In the tpl , find the line'model' => $result['model'],
change it to<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a><br /><?php echo $product['model']; ?></div>
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?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.
It should be like this - the modifs are bolded and underlined.
And if you add it with sepparate div it should look like this: (you can style the class in the css:<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>
/div<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>
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
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
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
I noticed that JS, and which JS file is that? I am using the latest version of Opencart!
tx
We are talking about the category.tpl located in the Catalog / View / Template / Product, right?florinsith wrote:Its not another file, that js is in the same file in the category.tpl at the bottom.
Who is online
Users browsing this forum: No registered users and 26 guests