Page 1 of 1

SKU in Cart

Posted: Sat Sep 12, 2015 1:54 am
by juanrapma
Hola, quisiera saber si se puede colocar el SKU en el Cart???

Saludos

Re: SKU in Cart

Posted: Sat Sep 12, 2015 11:57 pm
by viethemes
Are you using a custom theme or the default theme?

Re: SKU in Cart

Posted: Sun Sep 13, 2015 3:08 am
by Time111
viethemes wrote:Are you using a custom theme or the default theme?
Im using custom theme. Interested to know how to add SKU in shopping cart, order history and order confirmation email

~Time
Version 2.0.3.1

Re: SKU in Cart

Posted: Mon Sep 14, 2015 5:24 am
by Time111
hi,

there is no problem, I just want to know is there any code i can modify so that we can put SKU not just model.

~Time
Version 2.0.3.1

Re: SKU in Cart

Posted: Mon Sep 14, 2015 7:13 am
by straightlight
One quick way would be to modify the catalog/controller/checkout/confirm.php file:

Find:

Code: Select all

$products = $this->cart->getProducts();
Add after:

Code: Select all

$this->load->model('catalog/product');
Then, find:

Code: Select all

foreach ($products as $product) {
add after:

Code: Select all

$store_product = $this->model_catalog_product->getProduct($product['product_id']);
Then, find twice:

Code: Select all

'model'      => $product['model'],
add after both:

Code: Select all

'sku'        => $store_product['sku'],
Then, find:

Code: Select all

foreach ($this->cart->getProducts() as $product) {
add after:

Code: Select all

$store_product = $this->model_catalog_product->getProduct($product['product_id']);
In catalog/model/checkout/order.php file,

find:

Code: Select all

model = '" . $this->db->escape($product['model']) . "',
add after (same line):

Code: Select all

sku = '" . $this->db->escape($product['sku']) . "',
In PHPMyAdmin SQL tab console, in your Opencart database, execute:

Code: Select all

ALTER TABLE `oc_order_product` ADD `sku` VARCHAR(64) NOT NULL AFTER `model`;
Note: Replace oc_ with your current database table prefix of Opencart.

This should resolved the problem.

While I do agree with the fact that SKU strings should be entered along with the model within each orders, previous SKU strings that has not been entered into the orders should rather be considered as a chronnologic task from the back-end or on the store-front end; order product by order product query.

Re: SKU in Cart

Posted: Wed Sep 16, 2015 12:41 am
by clorne
Try a new FREE extension from ocextensions - Display Product SKU

http://www.opencart.com/index.php?route ... n_id=23901

Re: SKU in Cart

Posted: Wed Sep 16, 2015 2:14 am
by Time111
clorne wrote:Try a new FREE extension from ocextensions - Display Product SKU

http://www.opencart.com/index.php?route ... n_id=23901
Hi,

thanx it work. anyone know any tweak to this so that we can see SKU in Admin > Products List also

And want to say the above long code also work given by @straightlight

~Time
Version 2.0.3.1

Re: SKU in Cart

Posted: Wed Sep 16, 2015 4:59 am
by straightlight
And want to say the above long code also work given by @straightlight
Thanks for the update. One quick way regarding your request would be to duplicate all instances of: filter_model into the:

- admin/controller/catalog/product.php
- admin/model/catalog/product.php file (inside the: getProducts paragraph)
- admin/view/template/catalog/product_list.tpl

Then, rename the duplicated variable names of: filter_model to: filter_sku. Otherwise, posting such modifications on the forum could resolved in very long steps to follow.