Post by th16 » Sat Jan 23, 2016 1:46 am

Hello,

Changing an order is not possible when a product is out of stock. What happens is that someone orders 2 iphones(3 in stock), the order is added to sales and orders. But when I want to change the address of the order it is not possible. All the time the system tells me that the product is not available. I find this strange because the order is already done and I am wondering what the stock has to do with changing an address in the order.

Also is the system sending an email to the custmer with every change, is there a way to enable this because I only want to send an update if I want to and not all the time, that will make customers angry.

Thanks

Newbie

Posts

Joined
Sat Jan 23, 2016 1:33 am

Post by Qphoria » Sat Jan 23, 2016 3:43 am

I've seen this error once and it was when I tried opening 2 edit windows at the same time in different tabs.
The product had over 1000 in stock but it threw the error.
I just refreshed the page and started over and it worked so I didn't bother to investigate.. did a refresh help?

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by th16 » Sat Jan 23, 2016 5:00 am

I do not have 2 windows open at the same time.

I do not understand what you mean with refresh. I just open the order, see the order info, click next, on the product page and it gives me the system message that there are not enough available products, I click next etc. but when I want to save it does nothing because I have the system message and I only can cancel or go back to orders list. Why does i give me the system message, the order is already made!!!

Newbie

Posts

Joined
Sat Jan 23, 2016 1:33 am

Post by daniGo » Sat Jan 23, 2016 4:10 pm

Because the system does't void order when start edit, but after allows you to save.

I think that the right way should be:
- when you start edit order, the system void the order (add stock, unconfirm all totals)
- you save the order, the system put all back (remove stock, confirm all totals)
- if you don't save the order, the order remain voided

http://www.gombac.si


Active Member

Posts

Joined
Wed Mar 20, 2013 4:49 pm
Location - Slovenia

Post by Qphoria » Sun Jan 24, 2016 12:47 am

You might have a good point here.. When saving, things like coupons and rewards should be unconfirmed first so that they are voided, then reconfirmed. Or additional admin edit logic should be used to ignore stock limits, coupon limits, etc.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by th16 » Tue Jan 26, 2016 2:13 am

I find this a big problem and huge bug. Today I had an order and the house number not filled in. I clicked on edit order, filled in the house number and went to the end to save the order. After I cclicked save I checked the amount of product in my stock and it was not right. What happend was that the order took 1 product of my stock and when I edit the order the system added 1 product to my stock again while the order was still there. If this is the case I need to check my stock every day, not good :-[

Newbie

Posts

Joined
Sat Jan 23, 2016 1:33 am

Post by daniGo » Tue Jan 26, 2016 4:04 am

If everything is set right, when you edit the order system firstly:

Code: Select all

$this->addOrderHistory($order_id, 0);

// Restock
$product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

foreach($product_query->rows as $product) {
	$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int)$product['quantity'] . ") WHERE product_id = '" . (int)$product['product_id'] . "' AND subtract = '1'");

	$option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'");

	foreach ($option_query->rows as $option) {
		$this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity + " . (int)$product['quantity'] . ") WHERE product_option_value_id = '" . (int)$option['product_option_value_id'] . "' AND subtract = '1'");
	}
}
and then after is saved

Code: Select all

$this->model_checkout_order->addOrderHistory($order_id, $order_status_id);

// Stock subtraction
$order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

	foreach ($order_product_query->rows as $order_product) {
		$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_id = '" . (int)$order_product['product_id'] . "' AND subtract = '1'");

		$order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product['order_product_id'] . "'");

		foreach ($order_option_query->rows as $option) {
			$this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_option_value_id = '" . (int)$option['product_option_value_id'] . "' AND subtract = '1'");
		}
}
I think the stock is calculated correctly, but the first part should be done at the moment when you start editing the order. This way you start editing with products in stock.

http://www.gombac.si


Active Member

Posts

Joined
Wed Mar 20, 2013 4:49 pm
Location - Slovenia

Post by th16 » Tue Feb 02, 2016 9:56 pm

It seems there is an item on github about this matter, but did you managed to solve it by using the code above?

This is the link to the github item: https://github.com/opencart/opencart/is ... -174064591

Newbie

Posts

Joined
Sat Jan 23, 2016 1:33 am

Post by th16 » Thu Feb 11, 2016 5:34 am

The problem is even worse, when I edit an order and change the order status to for instance shipped, it puts back the products that are bought. Any idea why that happens?

Newbie

Posts

Joined
Sat Jan 23, 2016 1:33 am

Post by itaishi » Wed Apr 20, 2016 1:53 am

any news about this problem?

i am on OC.2020 (upgraded from OC.1564) ,
i cant edit order that took the last item from the stock.

thanks,
itai.

Newbie

Posts

Joined
Tue Sep 29, 2015 9:28 am

Post by tomeda » Thu Mar 28, 2019 5:54 pm

Hi,

I'm stuck with the same problem. In my store we constantly have products with low stock and editing order is a nightmare, I must go to the product to add some stock than go back to the order editing and so on...

Does anybody found any solution?!

OpenCart SEO Services
http://tomeda.bg


User avatar
New member

Posts

Joined
Thu Mar 19, 2015 4:48 am


Post by straightlight » Thu Mar 28, 2019 6:01 pm

tomeda wrote:
Thu Mar 28, 2019 5:54 pm
Hi,

I'm stuck with the same problem. In my store we constantly have products with low stock and editing order is a nightmare, I must go to the product to add some stock than go back to the order editing and so on...

Does anybody found any solution?!
OC version?

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

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

Post by tomeda » Thu Mar 28, 2019 6:08 pm

OC 2.1.0.2

OpenCart SEO Services
http://tomeda.bg


User avatar
New member

Posts

Joined
Thu Mar 19, 2015 4:48 am


Post by rhorne » Tue Jan 28, 2020 4:53 pm

I am surprised to see that in 2020 with OC 2.3.0.2 this is still an issue.

I just came to report the exact same thing happening but found numerous threads. I too went to simply change the shipping address on an order but because the customer had bought the last of the stock of a product, the change wasn't committed because there isn't sufficient stock.

Active Member

Posts

Joined
Wed Jan 18, 2012 3:07 am

Post by xxvirusxx » Tue Jan 28, 2020 5:38 pm

Can you make a video?

OC 2.3.0.2 | OC 3.0.3.6 | Extensions converted by me | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by rhorne » Tue Jan 28, 2020 9:50 pm

I'm not sure a video is necessary. When I go to edit an order, I click continue from tab 1 and am taken to tab 2 where I get the following:

https://pasteboard.co/IS418Jz.png

Even though I can continue to Tab 3 and change the delivery address, the changes aren't saved because of this quantity issue.

Active Member

Posts

Joined
Wed Jan 18, 2012 3:07 am

Post by straightlight » Tue Jan 28, 2020 9:53 pm

The provided screenshot link above is not working as it even leads to a false-positive infection page.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

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

Post by rhorne » Tue Jan 28, 2020 10:25 pm

That's strange, I get no such errors or warnings. What about the following:

https://snipboard.io/huejHm.jpg

Active Member

Posts

Joined
Wed Jan 18, 2012 3:07 am

Post by xxvirusxx » Tue Jan 28, 2020 10:30 pm

You have upload on forum :)

Attachments

12e2f3a9-a79c-43f6-969f-8addda37702f.png

12e2f3a9-a79c-43f6-969f-8addda37702f.png (29.01 KiB) Viewed 719 times


OC 2.3.0.2 | OC 3.0.3.6 | Extensions converted by me | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Wed Jan 29, 2020 3:28 am

rhorne wrote:
Tue Jan 28, 2020 10:25 pm
That's strange, I get no such errors or warnings. What about the following:

https://snipboard.io/huejHm.jpg
Yes, this one works better. I would, then, suggest to remove the previous link you posted above for security purposes.

As for the out of stock, the thing is that the products are being pulled from the same location whether it's from the API in the admin sales orders or from the catalog product page in order to maintain the stock levels and the service levels between store owners and the customers. If you're looking for a push order strategy based on a stock level that cannot be guaranteed to the customer, then you'd be affecting the utility of the product value when using the API orders as compared to the catalog product page.

In order to rectify that issue, since each stores also have their own settings defined from the admin systems settings, the stock levels would need to be overwritten individually on the stock levels whenever the API is used but, even there, manufacturers and products being copied categorically could also exclude those remarks as well as store owners feeding their products with their stocks via a service provider where this method can also become quite complex.

Therefore, by creating a product group page (which I believe one or multiple extensions on the Marketplace already exists for this) could create part of the solution where the stock levels could be re-balanced since product groups could also involved using the APIs as an additional group. This way, the product page and the checkout process from the catalog-end side won't be interfered with any customers whether it's for guests or registered customers and affiliates.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

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

Users browsing this forum: No registered users and 26 guests