Post by MrMax15 » Fri Feb 13, 2015 6:12 am

Hi.
Every product in my store has purchase price. I want to save the value of this field in the database table 'order_product' when order is confirmed.

So I did this steps:
[*] Altered table 'order_product' to add column
[*] changed /catalog/model/checkout/order.php:modified SQL query in functions addOrder and editOrder

Code: Select all

INSERT INTO [default code] . "', purchase_price = '" . (float)$product['purchase_price'] . "'"
[*] added in /catalog/controller/checkout/confirm.php last string (line 226)

Code: Select all

	$order_data['products'][] = array(
					'product_id' => $product['product_id'],
					'name'       => $product['name'],
					'model'      => $product['model'],
					'option'     => $option_data,
					'download'   => $product['download'],
					'quantity'   => $product['quantity'],
					'subtract'   => $product['subtract'],
					'price'      => $product['price'],
					'total'      => $product['total'],
					'tax'        => $this->tax->getTax($product['price'], $product['tax_class_id']),
					'reward'     => $product['reward'],
					'purchase_price' => $product['purchase_price']
				);
Nevertheless, on the Step 6: Confirming order I get an error: Notice: Undefined index: purchase_price in /catalog/controller/checkout/confirm.php on line 226 and value of "purchase price" is saved in DB as "0.00".
What am I doing wrong?

Newbie

Posts

Joined
Fri Feb 13, 2015 5:53 am
Who is online

Users browsing this forum: No registered users and 2 guests