Post by tomeda » Wed Jan 29, 2020 4:03 am

straightlight wrote:
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:
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.
I really don't have a clue what are you talking about?!

The issue is simple. Admin user is editing existing order, why is OC pulling stock for an existing order twice? If admin increases quantity for that order OK, but when the actual change is not on quantity it's regarding address, name or something else beside quantity, I don't see any meaningful explanation why OC should reduce the stock of that products in the existing order again?!

OpenCart SEO Services

User avatar
New member


Thu Mar 19, 2015 4:48 am

Post by straightlight » Wed Jan 29, 2020 4:31 am

I don't see any meaningful explanation why OC should reduce the stock of that products in the existing order again?!
That was already explained above. It's because the API calls the same method on the catalog-end to calculate the stock.

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.

Programmer / Opencart Tester

Legendary Member


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

Post by mupcku » Tue Jul 21, 2020 8:43 pm

straightlight wrote:
Wed Jan 29, 2020 4:31 am
That was already explained above. It's because the API calls the same method on the catalog-end to calculate the stock.
BUT we are searching for a solution, not for an explaination.

Active Member


Tue Jan 24, 2017 8:12 pm

Post by francesco.bragagna » Sun Oct 04, 2020 10:26 pm


not sure I can help, I'm using
Note: I'm a developer, but I'm not using in general php, so sometimes I have difficulties in understanding when a controlled is used from one or more page, or if a template is used in only one context or more than one.

I know that there is a way to configure when the items are subtracted from stock. In my installation, I decided to subtract them as soon the order is sent by the customer. In this way my online shop shows the item really present, considering the items containend in the order received as sold (also if not payed yet).

The problem editing the orders is that: when an ADMINISTRATOR edit an order, the page using order api prepare a cart with all the item in the order.
But, the item in that order can be not more available of course, beause sold exactly in that order.
Let's me say and example: a customer make order #1200 with only one item in it, a jurassic park t-shirt. My stock has only one of this shirt, so when the order is received the stock it's updated and the shirt it not more available. Than I need to edit order #1200 (to change address, to change payment method, to add items ... not important what), but editing it the shirt it's out of stock and marked ***, beacuse it was the last one.

One solution is manage the answer on client side: when it's called api to load the cart with items in the order, checking the response I consider really out of stock only when the item present in the page are more than originally ordered. That's need a development on javascript of order_form.tpl (it's used only by administrator?)

The problem becomes more complicated when (for example) I have 3 instance of one item. The original order order two of them. Editing the order I want to increase the quantity of that product, but the page must shown an error if I choose 4 or more, and not if I set 3.

Note: I dont' know if the problem is mitigated or solved in newest version of opencart (e.g. 3.x or 2.1.x because I use an old one) but I can't change deployed version in my installation, and I prefere to solve the issue with custom code (if I can). I very surprised that this issue is still unsolved anyway, editing an order should be something that everyone using oc in production make daily.


Sat May 05, 2018 7:10 am
Who is online

Users browsing this forum: No registered users and 23 guests