Its not actually an issue, the orders created via admin dont have the substract stock feature yet. maybe it will be added in the next release.
In admin/model/sale/order.php file,
find twice:
add after both:
find twice:
Code: Select all
$order_product_id = $this->db->getLastId();
Code: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET `quantity` = (quantity - " . (int)$order_product['quantity'] . ") WHERE `product_id` = '" . (int)$order_product_id . "' AND `quantity` > '0'");
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
firstly sorry for my horrible english :\ .
I put this code on my store and solve my problem partially.
when i create the order the quantity does not decrease, but when i delete an order created ,the quantity of product increases
maybe i put this code in wrong place ?
Thanks for helping, and sorry again for my english :/
I put this code on my store and solve my problem partially.
Code: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET `quantity` = (quantity - " . (int)$order_product['quantity'] . ") WHERE `product_id` = '" . (int)$order_product_id . "' AND `quantity` > '0'");
maybe i put this code in wrong place ?
Code: Select all
$order_product_id = $this->db->getLastId();
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET `quantity` = (quantity - " . (int)$order_product['quantity'] . ") WHERE `product_id` = '" . (int)$order_product_id . "' AND `quantity` > '0'");
if (isset($order_product['order_option'])) {
foreach ($order_product['order_option'] as $order_option) {
$this->db->query("INSERT INTO " . DB_PREFIX . "order_option SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', product_option_id = '" . (int)$order_option['product_option_id'] . "', product_option_value_id = '" . (int)$order_option['product_option_value_id'] . "', name = '" . $this->db->escape($order_option['name']) . "', `value` = '" . $this->db->escape($order_option['value']) . "', `type` = '" . $this->db->escape($order_option['type']) . "'");
}
}
This code
Is located in your file twice. Once on line 173 and another time on line 278 (OpenCart 1.5.4) At both these locations you have to add
in the other location as well.
The problem you are having is easily solved if you put the code in the right place..
Hope this helps!
Code: Select all
$order_product_id = $this->db->getLastId();
Code: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET `quantity` = (quantity - " . (int)$order_product['quantity'] . ") WHERE `product_id` = '" . (int)$order_product_id . "' AND `quantity` > '0'");
The problem you are having is easily solved if you put the code in the right place..
Hope this helps!
Donate | Confirm Email when registering or during guest checkout | Print Order Information
Fixed ;-) including option(s) support... with v1.5.5.1 is not ?florinsith wrote:Its not actually an issue, the orders created via admin dont have the substract stock feature yet. maybe it will be added in the next release.
OC 3.0.3.7 EN (default theme) running on PHP 7.3 MariaDB 10.3 Linux / Apache 2.4
in case people are still looking for the answer like i was:
solution with mod files in thread here:
http://forum.opencart.com/viewtopic.php ... der+delete
solution with mod files in thread here:
http://forum.opencart.com/viewtopic.php ... der+delete
Who is online
Users browsing this forum: No registered users and 58 guests