Post by electron » Wed Feb 17, 2010 10:22 pm

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.
Last edited by i2Paq on Thu Feb 18, 2010 9:59 pm, edited 2 times in total.
Reason: Title fix + topic moved

Newbie

Posts

Joined
Wed Feb 17, 2010 10:01 pm

Post by Qphoria » Thu Feb 18, 2010 9:56 pm

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>

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by electron » Fri Feb 19, 2010 11:02 pm

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 !

Newbie

Posts

Joined
Wed Feb 17, 2010 10:01 pm

Post by i2Paq » Fri Feb 19, 2010 11:18 pm

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.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

UPGRADE to 2.x: Contemplate before thou begins!

Our FREE search: Find your answer FAST!.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by sketchi » Tue Mar 15, 2011 4:16 pm

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 :)

User avatar
New member

Posts

Joined
Wed Sep 22, 2010 5:04 pm

Post by sketchi » Thu Mar 24, 2011 5:25 pm

I found the solution in this great extension :)
http://www.opencart.com/index.php?route ... on_id=1701

User avatar
New member

Posts

Joined
Wed Sep 22, 2010 5:04 pm

Post by ronin » Thu Sep 15, 2011 6:16 pm

Awesome! made a quick fix coz of this! Thanks again.

Newbie

Posts

Joined
Mon Sep 12, 2011 11:52 am

Post by Mrlele » Thu Sep 26, 2013 9:21 pm

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

Newbie

Posts

Joined
Wed Sep 04, 2013 10:16 pm

Post by maffu » Thu Dec 19, 2013 11:22 pm

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.

:(

Newbie

Posts

Joined
Thu Dec 12, 2013 4:45 pm

Post by krneki » Fri Jan 10, 2014 3:14 am

Will that mod show SKU of product options as well?

Active Member

Posts

Joined
Tue Jul 17, 2012 9:58 pm

Post by Ilia_bg » Mon Jun 23, 2014 2:48 am

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

Newbie

Posts

Joined
Mon Jun 23, 2014 2:46 am

Post by VanCleef » Fri Oct 24, 2014 9:58 pm

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

Newbie

Posts

Joined
Thu Oct 02, 2014 5:41 pm

Post by platinum » Tue Sep 27, 2016 5:17 am

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

Newbie

Posts

Joined
Thu Nov 03, 2011 9:15 am

Post by IP_CAM » Tue Sep 27, 2016 8:18 am

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

Ernie's OpenCart v.1.5.6.5 LIGHT + OpenShop Admin v.1.75 Test Sites
http://www.ebikes.li - http://www.evelo.li - http://www.openshop.li
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by VanioBoy » Wed Nov 09, 2016 8:43 pm

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,

Newbie

Posts

Joined
Wed Nov 09, 2016 5:52 pm
Who is online

Users browsing this forum: No registered users and 10 guests