Post by Melanie » Wed Jul 07, 2010 7:36 am

Hi,

I have the SKU showing on my products page, but how can I show it on the cart?
Thanks for any help.


Kind regards,
Melanie

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by JAY6390 » Wed Jul 07, 2010 10:12 am

Which cart do you mean? The one on the sidebar or the checkout cart (basket) page?

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Melanie » Wed Jul 07, 2010 10:55 am

JAY6390 wrote:Which cart do you mean? The one on the sidebar or the checkout cart (basket) page?
Hi Jay!

The checkout cart (basket) page.


Thanks,
Melanie

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by JAY6390 » Wed Jul 07, 2010 7:15 pm

In that case you should be able to echo out $product['model'] in the catalog/view/theme/default/template/checkout/cart.tpl within the foreach loop of the $products

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Wed Jul 07, 2010 9:31 pm

model is set but sku isn't.
For that one you need to make 2 edits.

1 to the cart controller
and
1 to the cart library

1. EDIT: system/library/cart.php
2. FIND:

Code: Select all

'model'        => $product_query->row['model'], 
3. AFTER, ADD:

Code: Select all

'sku'           => $product_query->row['sku'], 
4 EDIT: catalog/controller/checkout/cart.php
5. FIND:

Code: Select all

'model'    => $result['model'], 
6. AFTER, ADD:

Code: Select all

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

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Wed Jul 07, 2010 9:54 pm

ah my bad :)

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Melanie » Thu Jul 08, 2010 9:21 am

All done, perfect, thanks!!!
Mel

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by Melanie » Wed Jul 14, 2010 9:17 am

Hi guys!

Another quick one.

How can I show the SKU on the admin and the INVOICE?

Thanks,
Mel

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by Qphoria » Wed Jul 14, 2010 9:35 pm

that is a lot more difficult. columns will need to be added to the order_product table

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bedo02 » Wed Aug 11, 2010 7:20 pm

Hey Guys,

I would need such feature as well and as far I can see, it was dropped from the 1.4.8 to do list and I don`t know if this will come in the 1.4.9 release as there are mostly only fixes. Anyway I can not wait so long ;) So I am trying to add this feature by myself.

I managed to alter the order_product table and files so the SKU is pulled on the invoice, so far I have to add the sku to the table manually, but I would like, that it would be added to the table row automatically at the time of purchase.

Does anyone know which file is responsible for the processing of the final order? Meaning -> pulling data from the cart and placing them to the tables? I am reading through the code, but have no luck to find the right functions.

As soon I will finish this, I will post a how to in this topic.

Thank you all!

using oc 1.5.6


Newbie

Posts

Joined
Mon Oct 26, 2009 9:43 pm

Post by bedo02 » Thu Aug 12, 2010 12:58 am

you know what forget my question, who can read has an advantage :)

Folks got it working.

1) add the table row for "order_product"

MySQL edit :

go to phpMyAdmin or whatever you are using, go to "your_opencart_db" and open the "order_product" table (may be called otherwise if you are using prefixes) and execute the following SQL query

Code: Select all

ALTER TABLE order_product ADD sku VARCHAR(60);
the new row named "sku" should appear.

Note : existing orders need to be populated with skus manually. Best way is to export a CSV File

of "order_product" table and "product" table and use vlookup function to match Product IDs

with SKUs and reupload. For troubleshooting see -> SQL Alter Table
http://www.tech-recipes.com/rx/378/add- ... sql-table/

2) Now the Opencart alterations :

\admin\controller\sale\order.php

Add :

on line 1199

Code: Select all

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


in

admin\view\template\sale\order_invoice.tpl // so it will be printed out on the invoice

add

on line 59

Code: Select all

<td><b><?php echo 'SKU'; ?></b></td>

on line 67

Code: Select all

<td><?php echo $product['model']; ?></td>
edit line 82

from

Code: Select all

      <td align="right" colspan="4"><b><?php echo $total['title']; ?></b></td>
to

Code: Select all

      <td align="right" colspan="5"><b><?php echo $total['title']; ?></b></td>

Change :

\catalog\model\checkout\order.php line 75 // so the SKU is automatically added to the Database

from

Code: Select all

			$this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET 

order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name 

= '" . $this->db->escape($product['name']) . "', model = '" . $this->db->escape($product

['model']) . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product

['total']. "', tax = '" . (float)$product['tax'] . "', quantity = '" . (int)$product

['quantity'] . "'");
to

Code: Select all

			$this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET 

order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name 

= '" . $this->db->escape($product['name']) . "', model = '" . $this->db->escape($product

['model']) . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product

['total']. "', sku = '" . (float)$product['sku'] . "', tax = '" . (float)$product['tax'] . "', 

quantity = '" . (int)$product['quantity'] . "'");
Add

catalog\controller\checkout\confirm.php // this will pull and show the SKUs to the shopping cart confirmation page and then they can be pulled to DB

on line 171

Code: Select all

        		'sku'        => $product['sku'],
and on line 387

Code: Select all

        		'sku'        => $product['sku'],
Add

catalog\controller\checkout\guest_step_3.php // this will pull and show the SKUs to the shopping cart confirmation page and then they can be pulled to DB

on line 164

Code: Select all

        		'sku'        => $product['sku'],
and on line 384

Code: Select all

        		'sku'        => $product['sku'],
in catalog\view\theme\your_theme\template\checkout\confirm.tpl // this will display the SKUs at the order confirmation page

add

on line 43

Code: Select all

<th align="left"><?php echo 'SKU'; ?></th>
and on line 52

Code: Select all

<td align="left" valign="top"><?php echo $product['sku']; ?></td>
Note : Tested with opencart 1.4.8, tested with paypal sandbox and pre-paid order payments. Let me know if it is working with other payment types as well.
Note : currently not working with manually adding parts through admin. Maybe somebody can play with it :)
Note : I give no warranty or any support on it, should something break, you are on your own, as I was ;) But I can try..
Note : feel free to copy, alter or redistribute. For god sick just don´t sell it, it is opensource :)

Have fun with it.

using oc 1.5.6


Newbie

Posts

Joined
Mon Oct 26, 2009 9:43 pm

Post by Hashishim » Mon Aug 22, 2011 8:11 am

Do you know how to configure this for 1.5.1? I require this well not the SKU, another custom field i made to be pulled. I did follow it accordingly but it is not populating the Order ID Db with the new field

New member

Posts

Joined
Mon Jul 25, 2011 5:44 am

Post by H2O » Thu Mar 29, 2012 7:17 am

A HOW-TO has been created on how to add SKU numbers to the Invoice. It was done to version 1.5.2.1.

It can be found here:
http://forum.opencart.com/viewtopic.php?f=121&t=57412

A good site for e-commerce advice.


H2O
New member

Posts

Joined
Wed Feb 29, 2012 7:36 am

Post by aljawaid » Sat May 30, 2015 6:37 am

Does anyone know if this would work for 2.0.2.0?

Total e-commerce newbie bravely testing OC v2.0.3.1 before rolling it live...getting there slowly, somehow. Maybe not. I dunno.


Active Member

Posts

Joined
Fri Oct 10, 2014 10:33 pm
Location - UK

Post by aljawaid » Sat May 30, 2015 6:39 am

Qphoria wrote:model is set but sku isn't.
For that one you need to make 2 edits.

1 to the cart controller
and
1 to the cart library

1. EDIT: system/library/cart.php
2. FIND:

Code: Select all

'model'        => $product_query->row['model'],
3. AFTER, ADD:

Code: Select all

'sku'           => $product_query->row['sku'],
4 EDIT: catalog/controller/checkout/cart.php
5. FIND:

Code: Select all

'model'    => $result['model'],
6. AFTER, ADD:

Code: Select all

'sku'        => $result['sku'],
Hello, do you think this would work for both cart.php and checkout.php in both folders on OC v2.0.2.0?

Total e-commerce newbie bravely testing OC v2.0.3.1 before rolling it live...getting there slowly, somehow. Maybe not. I dunno.


Active Member

Posts

Joined
Fri Oct 10, 2014 10:33 pm
Location - UK
Who is online

Users browsing this forum: No registered users and 19 guests