Post by cmikel » Sat Jun 25, 2011 7:56 am

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!

Newbie

Posts

Joined
Sat Jun 25, 2011 7:52 am

Post by florinsith » Sat Jun 25, 2011 11:16 am

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>

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by cmikel » Mon Jun 27, 2011 1:36 am

thank you!! works perfectly!

Newbie

Posts

Joined
Sat Jun 25, 2011 7:52 am

Post by sinbad » Sun Oct 23, 2011 1:11 pm

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?

User avatar
New member

Posts

Joined
Sun Oct 23, 2011 12:52 pm

Post by florinsith » Sun Oct 23, 2011 6:00 pm

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.

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by sinbad » Sun Oct 23, 2011 8:18 pm

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>

User avatar
New member

Posts

Joined
Sun Oct 23, 2011 12:52 pm

Post by sinbad » Sun Oct 23, 2011 8:28 pm

oppps sorry got it.

I was editing eclipse cached files and I'm working on localhost.... dummy. :crazy:
Thanks for the quick reply again.

edit: played with vqmod a little.
here is the xml in case someone else wants.

Attachments


User avatar
New member

Posts

Joined
Sun Oct 23, 2011 12:52 pm

Post by sinbad » Mon Oct 24, 2011 12:03 am

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...

User avatar
New member

Posts

Joined
Sun Oct 23, 2011 12:52 pm

Post by florinsith » Mon Oct 24, 2011 1:52 pm

for featured in controller is $product_info instead of $result.

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by sinbad » Mon Oct 24, 2011 8:56 pm

sweet. thanks a lot florinsith it looks much better now :)

User avatar
New member

Posts

Joined
Sun Oct 23, 2011 12:52 pm

Post by Digital Sushi » Tue Nov 22, 2011 4:58 am

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?

Active Member

Posts

Joined
Mon Oct 18, 2010 10:23 pm
Location - South Africa

Post by florinsith » Tue Nov 22, 2011 11:02 pm

It should work in 1.5.1.3 too. Are you sure you did it right?

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by Digital Sushi » Sun Nov 27, 2011 3:32 pm

I've managed to fix it.

Would I be able to do the same for a product's stock status?

Active Member

Posts

Joined
Mon Oct 18, 2010 10:23 pm
Location - South Africa

Post by remcofaasse » Sat Dec 10, 2011 1:28 am

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?

New member

Posts

Joined
Mon Dec 05, 2011 2:20 am

Post by florinsith » Sat Dec 10, 2011 3:29 am

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

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by uksitebuilder » Sat Dec 10, 2011 3:34 am

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

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by remcofaasse » Mon Dec 12, 2011 3:21 am

Thanks florinsith! It works great.

New member

Posts

Joined
Mon Dec 05, 2011 2:20 am

Post by eclipse005 » Sun Feb 26, 2012 10:39 pm

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

New member

Posts

Joined
Sat Oct 08, 2011 7:40 pm

Post by florinsith » Sun Feb 26, 2012 11:16 pm

Its not another file, that js is in the same file in the category.tpl at the bottom.

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by eclipse005 » Sun Feb 26, 2012 11:34 pm

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?

New member

Posts

Joined
Sat Oct 08, 2011 7:40 pm
Who is online

Users browsing this forum: No registered users and 9 guests