Post by waps » Sat Dec 10, 2011 6:54 pm

Hi Guys

How do I show the model number next to each product shown in the related products div in the product.tpl.

I tried $product['model'] but it doesnt work ?

Newbie

Posts

Joined
Mon Dec 05, 2011 12:52 am

Post by waps » Sat Dec 10, 2011 8:37 pm

not to worry guys,

managed to get it working

Newbie

Posts

Joined
Mon Dec 05, 2011 12:52 am

Post by Brook » Thu Dec 15, 2011 12:16 pm

How did you display Product Model next to Product Name when selecting Related Products? I have multiple Products with the same Product Name. Product Model uniquely identifies my Products.

Any suggestions?

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by straightlight » Thu Dec 15, 2011 12:34 pm

For v1.5.x:

In catalog/controller/product/product.php file,

find:

Code: Select all

'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
add after:

Code: Select all

'model'		 => $result['model'],
Then, in view/theme/default/template/product/product.tpl file,

find:

Code: Select all

<div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
        <?php } ?>
        <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
replace with:

Code: Select all

 <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?> (<?php echo $product['model']; ?>)" title="<?php echo $product['name']; ?> (<?php echo $product['model']; ?>)"/></a></div>
        <?php } ?>
        <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a> (<?php echo $product['model']; ?>)</div>
Last edited by straightlight on Wed Mar 07, 2012 9:04 pm, edited 3 times in total.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Brook » Thu Dec 15, 2011 10:16 pm

I have OpenCart 1.5.1.3 installed. How do I display Product Model next to Product Name in Related Products?

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by straightlight » Fri Dec 16, 2011 12:15 am

The above instructions are for v1.5.1.3 and does work as described.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Brook » Fri Dec 16, 2011 12:50 am

Thank you. I wasn't sure if this was for 1.4.9.6 or 1.5.1.3 I will try this out.

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by straightlight » Fri Dec 16, 2011 12:58 am

Right. I have now modified the instructions above stating these modifications are for v1.5.1.3 release.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Brook » Sun Dec 18, 2011 12:35 am

How do I display the Product SKU next to the Product Name in the "Admin" when selecting Related Products? (OpenCart version 1.5.1.3)

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by straightlight » Sun Dec 18, 2011 12:43 am

In admin/controller/catalog/product.php file,

find:

Code: Select all

'name'       => $related_info['name']
add above:

Code: Select all

'model'       => $related_info['model'],
In admin/view/template/catalog/product_form.tpl file,

find:

Code: Select all

<div id="product-related<?php echo $product_related['product_id']; ?>" class="<?php echo $class; ?>"> <?php echo $product_related['name']; ?><img src="view/image/delete.png" />
replace with:

Code: Select all

<div id="product-related<?php echo $product_related['product_id']; ?>" class="<?php echo $class; ?>"> <?php echo $product_related['name']; ?> (<?php echo $product_related['model']; ?>)<img src="view/image/delete.png" />
This should work as expected.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Brook » Sun Dec 18, 2011 12:48 am

Thank you. I will give it a try.

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by Brook » Sun Dec 18, 2011 1:33 am

Works great! When using the AutoComplete feature when selecting a Product to add to the Related Products currently only the Product Name is displayed when I begin typing. How do I display Product Model next to the Product Name when I begin typing?

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by straightlight » Sun Dec 18, 2011 1:41 am

Untested so make a backup of admin/view/template/catalog/product_form.tpl file,

in this section:

Code: Select all

$('input[name=\'related\']').autocomplete({
find:

Code: Select all

label: item.name,
replace with:

Code: Select all

label: item.name + '(' + item.model + ')',
This could probably work.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Brook » Sun Dec 18, 2011 2:20 am

Thank you again for you help. Good news! Your Product Model code works

Code: Select all

label: item.name + '(' + item.model + ')',
If I want to display Product SKU next to Product Name when typing in the AutoComplete Related Products box what code should I use? I tried the following code

Code: Select all

label: item.name + '(' + item.sku + ')',
But this did not work, when I typed in the Product Name using the AutoComplete Feature, the Product Name would display, but the Product SKU would not display next to the Product Name, instead it would display as "Product Name (undefined)" instead of "Product Name (SKU)".

Any ideas?

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by straightlight » Sun Dec 18, 2011 2:24 am

Inclusively, yes.

However, you'd also need to state the following from admin/controller/catalog/product.php file

where:

Code: Select all

'name'       => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'),
'model'      => $result['model'],
to add below:

Code: Select all

'sku'      => $result['sku'],

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Brook » Sun Dec 18, 2011 2:31 am

You are the man! Thank you. Thank you. Works great! This is a big deal to the way my cart works since my Products are uniquely idenitified by Product SKU.

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by straightlight » Sun Dec 18, 2011 2:35 am

You're making the right choice by displaying the products by SKU politically. Most eCommerce manufacturers does not provide this solution while this should be included at least as an option. :)

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mirza » Fri Mar 30, 2012 10:16 am

it's good...
but i have a lot of same names products.(~500)
how can i search by product model_?
thanks for your replies..

Newbie

Posts

Joined
Fri Mar 30, 2012 10:13 am

Post by straightlight » Fri Mar 30, 2012 10:23 am

Simply follow all my instructions above but in your case from this post:

http://forum.opencart.com/viewtopic.php ... 63#p231290

replace the last step

from:

Code: Select all

<div id="product-related<?php echo $product_related['product_id']; ?>" class="<?php echo $class; ?>"> <?php echo $product_related['name']; ?> (<?php echo $product_related['model']; ?>)<img src="view/image/delete.png" />
to read:

Code: Select all

<div id="product-related<?php echo $product_related['product_id']; ?>" class="<?php echo $class; ?>"> <?php echo $product_related['model']; ?><img src="view/image/delete.png" />
exceptionally. This should work as expected. If you need to search by models, I would strongly recommend the use of the SKU inclusively.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by richdtt » Sat Mar 09, 2013 3:20 am

It's a nice feature to show the sku/model while you're doing a search by name in the add related products.

How would you modify it so it autocompletes based on name OR sku instead?

Newbie

Posts

Joined
Wed Mar 21, 2012 9:26 am
Who is online

Users browsing this forum: No registered users and 56 guests