Page 1 of 1
[MOD] How to show SKU in the Catalog
Posted: Wed Feb 17, 2010 10:22 pm
by electron
Is there a way to display the product's SKU in the catalog ?
For example if there is something like a variable or tag to use in the code like in wordpress?
And also would be great if the search can work with SKUs as well..
Thanks.
Re: How to show SKU in the Catalog
Posted: Thu Feb 18, 2010 9:56 pm
by Qphoria
1. EDIT: catalog/controller/product/product.php
2. FIND:
Code: Select all
$product_info = $this->model_catalog_product->getProduct($product_id);
3. AFTER, ADD:
Code: Select all
$this->data['product_info'] = $product_info;
That will bring ALL product db values to be available from the tpl for any future fields you want to add later.
Now, you can display them where you want on the template
1. EDIT: catalog/view/theme/YOURTHEME/template/product/product.tpl
2. FIND:
Code: Select all
<tr>
<td><b><?php echo $text_model; ?></b></td>
<td><?php echo $model; ?></td>
</tr>
3. AFTER, ADD:
Code: Select all
<tr>
<td><b>SKU</b></td>
<td><?php echo $product_info['sku']; ?></td>
</tr>
Re: [MOD] How to show SKU in the Catalog
Posted: Fri Feb 19, 2010 11:02 pm
by electron
Thanks!
That's exactly what i was asking for.
And another thing would be very nice if it was indexed by the search as well.
Thanks again !
Re: [MOD] How to show SKU in the Catalog
Posted: Fri Feb 19, 2010 11:18 pm
by i2Paq
electron wrote:Thanks!
That's exactly what i was asking for.
And another thing would be very nice if it was indexed by the search as well.
Thanks again !
There is a topic about that:
[MOD] how to widen search on my shop.
I'm not sure it covers what you ask.
Re: [MOD] How to show SKU in the Catalog
Posted: Tue Mar 15, 2011 4:16 pm
by sketchi
1. EDIT: catalog/controller/product/product.php
2. FIND:
$product_info = $this->model_catalog_product->getProduct($product_id);
3. AFTER, ADD:
$this->data['product_info'] = $product_info;
That will bring ALL product db values to be available from the tpl for any future fields you want to add later.
How would I go about doing the same thing but for the header template, so I could use any product data there, such as the thumbnail or SKU? I'm guessing the file to edit is catalog/controller/common/header.php...?
I've tried adding this, but with no luck:
Code: Select all
$this->data['product_info'] = $product_info;
Any help would be much appreciated, as usual
Re: [MOD] How to show SKU in the Catalog
Posted: Thu Mar 24, 2011 5:25 pm
by sketchi
Re: [MOD] How to show SKU in the Catalog
Posted: Thu Sep 15, 2011 6:16 pm
by ronin
Awesome! made a quick fix coz of this! Thanks again.
Re: [MOD] How to show SKU in the Catalog
Posted: Thu Sep 26, 2013 9:21 pm
by Mrlele
Hello, I d like to do the same on the Category Page. I did it yesterday and it was working, did some change and cant figure it out how I did it earlier
Thank you for your help
Re: [MOD] How to show SKU in the Catalog
Posted: Thu Dec 19, 2013 11:22 pm
by maffu
Mrlele wrote:Hello, I d like to do the same on the Category Page. I did it yesterday and it was working, did some change and cant figure it out how I did it earlier
Thank you for your help
Hi, i've the same problem! I need to show sku on the Category page.
I've do the same things to the controller->catalog>product->category.php and i've call on the category template: echo $product_info['sku'], but nothing appears.
Re: [MOD] How to show SKU in the Catalog
Posted: Fri Jan 10, 2014 3:14 am
by krneki
Will that mod show SKU of product options as well?
Re: [MOD] How to show SKU in the Catalog
Posted: Mon Jun 23, 2014 2:48 am
by Ilia_bg
Hello colleagues, I am from Bulgaria and I have a problem with my Opencart, I need help, I have the following errors: 2014-06-22 20:46:17 - PHP Warning: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: Access denied for user 'root'@'localhost' (using password: NO) in /home/xxxxxx/public_html/vqmod/vqcache/vq2-admin_model_catalog_product.php on line 538
2014-06-22 20:46:17 - PHP Warning: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: A link to the server could not be established in /home/xxxxx/public_html/vqmod/vqcache/vq2-admin_model_catalog_product.php on line 538
Re: [MOD] How to show SKU in the Catalog
Posted: Fri Oct 24, 2014 9:58 pm
by VanCleef
Hi,
I created a new table column in the oc_product table named "link". I can print its values in the admin side but I can't print it's values to the front product page. I tried numerious ways to do that. But I couldn't get anything from db. There are some tutorials in the forum but all of them are for outdated versions of Opencart (like this). So none of them (neither this one) work unfortunately... I think I'm so close to the solution
Do you know anything to solve this problem?
Thank you,
VC
Re: [MOD] How to show SKU in the Catalog
Posted: Tue Sep 27, 2016 5:17 am
by platinum
I got the sku to show up on my product page but how do i get it show up in the catalog view. LIST and GRID view. Thank you
Re: [MOD] How to show SKU in the Catalog
Posted: Tue Sep 27, 2016 8:18 am
by IP_CAM
platinum wrote:I got the sku to show up on my product page but how do i get it show up in the catalog view. LIST and GRID view. Thank you
But you did not tell us, for wich Version you want this !
Ernie
---
[VQMOD] SKU in Product List by viethemes free, OC v.2.0.0.0 - 2.2.0.0
http://www.opencart.com/index.php?route ... n_id=23091
Re: [MOD] How to show SKU in the Catalog
Posted: Wed Nov 09, 2016 8:43 pm
by VanioBoy
Hi
how do filter "model" in admin / products to search by SKU in database?
The problem is that some products from the database can not be seen by search by name
Use Opencart v2.3.0.2
regards,