Post by Hare76 » Mon Sep 21, 2015 7:31 pm

In Opencart 1.5.6.4 substracted.
In Opencart 2.0.3.1 not substracted (status order not write to database)

Newbie

Posts

Joined
Mon Sep 21, 2015 5:18 am

Post by sirszor » Tue Sep 22, 2015 2:00 am

I have similar issue with OC2.0.3.1.
There is a strange issue with product quantity subtraction. If I select ’Process’ in admin-> Extensions-> Payments -> Order status, the quantity decrease when I get an order. It is ok.
But when I update order status to shipped, quantity reset to earlier status. I have tested it more time and I am sure this is existing. Is there any fix or good setting for this? I usually update my orders because I can follow my orders according their status. I would like to update my order status without the system automaticaly increase the product stock.

Newbie

Posts

Joined
Sun Mar 06, 2011 12:15 am

Post by sirszor » Tue Sep 22, 2015 3:52 am

I guess I found the solution.
I have to select the correct order options in Admin->System->Settings->Option->Processing order status and Complete order status. If you select an ordering option that is not checked in Processing order list, the quantity will set the earlier value.

Newbie

Posts

Joined
Sun Mar 06, 2011 12:15 am

Post by Hare76 » Tue Sep 22, 2015 1:47 pm

Thank Sirszor. It works. I selected some values and products decreased from stock. But I think that it is not logical and it is not intuitive.
Thanks again. I hope that the developers will pay attention to this point.

Newbie

Posts

Joined
Mon Sep 21, 2015 5:18 am

Post by Hare76 » Tue Sep 22, 2015 1:53 pm

In the course of the experiments I found that different variants of choices lead to different results. For example:
"Complete" + "Pending" = "Out of stock"
"Complete" + "Processing" ( or "Processed" ) = "2-3 Days"
Where can I find all possible variants of choices and their results?

Newbie

Posts

Joined
Mon Sep 21, 2015 5:18 am

Post by sirszor » Sat Sep 26, 2015 4:20 am

Hi, I thing it works logically.
The selected items in in Admin->System->Settings->Option->Processing order status will decrease the stock. The unselected items will reset to original state.
It is same in Complete order status settings, too.
My settings:

Processing status:
1. selected: Paid, Pending, Processing, Shipped, prepared for shipping, waiting for payment, waiting for supply, etc
2. unselected: cancelled, refunded, change, chargeback, failed, done

Complete order status settings:
1. selcted: only the Done
2. Others unselected.

It works for me.

Newbie

Posts

Joined
Sun Mar 06, 2011 12:15 am

Post by IP_CAM » Sun Sep 27, 2015 12:43 am

It would be easier to understand, how all this works, if, finally, someone up TOP would decide, to
create a complete Owners Manual. It's been just about a Year now (October 1, 2014), since it's first debut... :-\
Very unique..., for something, different to handle, in so much, to it's predecessor.

(just thinking)
Ernie

PS: ...exept for iSense Lab's nice OC2 Info, just to mention it:
https://isenselabs.com/books/getacopy/47
Last edited by IP_CAM on Sun Sep 27, 2015 11:33 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Sun Sep 27, 2015 9:08 am

In catalog/model/checkout/order.php file,

find:

Code: Select all

// If order status in the complete range create any vouchers that where in the order need to be made available.
			if (in_array($order_info['order_status_id'], $this->config->get('config_complete_status'))) {
				// Send out any gift voucher mails
				$this->load->model('checkout/voucher');

				$this->model_checkout_voucher->confirm($order_id);
			}
add after:

Code: Select all

if (!empty($order_info['order_id']) && !empty($order_info['order_status_id']) && (int)$order_info['order_status_id'] == (int)$this->config->get('config_complete_status_id')) {
				$order_product_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_product` WHERE `order_id` = '" . (int)$order_info['order_id'] . "' GROUP BY `product_id`");
				
				if ($order_product_query->num_rows) {
					foreach ($order_product_query->rows as $product) {
						$this->db->query("UPDATE `" . DB_PREFIX . "product` SET `quantity` = 'quantity - 1' WHERE `product_id` = '" . (int)$product['product_id'] . "' AND `quantity` > '0'");
					}
				}
			}
This should resolved the problem.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Sun Sep 27, 2015 9:13 am

Post edited above.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Google [Bot] and 40 guests