Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order item quantity and total keep inflating #2589

Closed
Tea56 opened this issue Jan 22, 2015 · 4 comments
Closed

Order item quantity and total keep inflating #2589

Tea56 opened this issue Jan 22, 2015 · 4 comments

Comments

@Tea56
Copy link

Tea56 commented Jan 22, 2015

I am seeing the quantity and total inflation when editing same order. (quantity is going up and sometimes a second instance of the product gets added.)

Just tried with a clean installation adding one of the demo products to cart and checking out.

Go to orders, edit. click next. then back, then next, now it's 2 quantity.
if you click on order again to edit, it's now 2 and gets more.

it's the last call
index.php?route=sale/order/api&token=...&api=api/cart/products&store_id=0 that keeps getting inflated results.
database is not affected. i am not familiar with curl, but curl response has the incremented quantity and total.

checked locally and on a live site.

I would appreciate some help. At least point me in the right direction.

thank you!

@Tea56
Copy link
Author

Tea56 commented Jan 22, 2015

For what it's worth, it looks like multiple ControllerSaleOrder Controllers are getting instantiated.

@Tea56
Copy link
Author

Tea56 commented Jan 22, 2015

The easiest to recreate it, is to edit order, continue, then back, continue and back and continue before the last ajax call finished. This will cause curl to cache the data and the quantity and totals double each time.

Without the fix (i honestly don't know if this is fixing it, but it works for me. like i said, no curl experience)
once the order is "messed up" it never goes back to the original quantity and total.

With the fix, even if the above scenario happens, when starting to edit from scratch, the original order quantity and totals are restored. i.e. the curl call is not cached.
order

So, in admin/controller/sale/order.php I added
curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
$header = array("Cache-Control: no-cache");
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);

after each $curl = curl_init();

and closed curl in info() where it hasn't been closed.
curl_close($curl);

*attached, clean install from this repo, using existing products. the order was for only one item. when editing, the order doubles.

@danielkerr
Copy link
Member

this was fixed in the last release. I think you are using an old 2.0

@Tea56
Copy link
Author

Tea56 commented Feb 1, 2015

I am using 2.0.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants