Quote from: bs135 on June 23, 2012, 05:40:57 AM
My quantity in product option is not decreased after order confirm.
I view my database, table 'ac_products', value of field 'subtract' is '1' for all products.
But in table 'ac_order_products', value of field 'subtract' is '0' for all products.
And in file \storefront\model\checkout\order.php - line 150:
Why hasn't it update 'subtract' value for 'ac_order_products'.Code Select
foreach ($data['products'] as $product) {
$this->db->query("INSERT INTO " . DB_PREFIX . "order_products
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'] . "'");
Please help me.?
wait. quantity of product option you have to look in control_panel->catalog->products->options. not in general section. Total quantity and quantities of some kinds of this product are not the same. If you decide to set options for product total quantity will ignore.
You show me code that write quantity in order. Please check line 220 in the same model file:
Code Select
$order_option_query = $this->db->query("SELECT *
FROM " . DB_PREFIX . "order_options
WHERE order_id = '" . (int)$order_id . "'
AND order_product_id = '" . (int)$product['order_product_id'] . "'");
foreach ($order_option_query->rows as $option) {
$this->db->query("UPDATE " . DB_PREFIX . "product_option_values
SET quantity = (quantity - " . (int)$product['quantity'] . ")
WHERE product_option_value_id = '" . (int)$option['product_option_value_id'] . "'
AND subtract = '1'");
}


