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
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
and on line 387
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
and on line 384
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.