Ofcourse, in a few minutes u will have it!
I do now one last test, i wanna be sure that everything is 100% working!
I do now one last test, i wanna be sure that everything is 100% working!
A small fix, if editing a 'Missing Order', the stock quantites were incrmented when they shouldn't have been.
To fix, in the editOrder function move
above
To fix, in the editOrder function move
Code: Select all
$order_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` WHERE order_status_id > '0' AND order_id = '" . (int)$order_id . "'");
if ($order_query->num_rows) {
$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'");
}
}
}
Code: Select all
$this->db->query("UPDATE `" . DB_PREFIX . "order` SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($payment_country) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($payment_zone) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($payment_address_format) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($shipping_country) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($shipping_zone) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($shipping_address_format) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', order_status_id = '" . (int)$data['order_status_id'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'");
Done! But i havent test it yet, i will test it also and see if all ok, but from what i see all should be ok.
Hi guys,
This is exactly the problem I run into, too - what happens with stock when editing or creating order.
Could you please share the final code as it is a bit difficult to follow all the back and forth versions?
Btw, I am also using this free extension "Auto Update Product Quantity From Product Options":
http://www.opencart.com/index.php?route ... on_id=7647
... in order to manage stock dynamically from options.
Thanks!
This is exactly the problem I run into, too - what happens with stock when editing or creating order.
Could you please share the final code as it is a bit difficult to follow all the back and forth versions?
Btw, I am also using this free extension "Auto Update Product Quantity From Product Options":
http://www.opencart.com/index.php?route ... on_id=7647
... in order to manage stock dynamically from options.
Thanks!
This is the latest admin\model\sale\order.php for 1.5.4.1 with the changes if anyone wants to try it.
The changes are marked with comments so you should be able to make the changes to other versions.
The changes are marked with comments so you should be able to make the changes to other versions.
Attachments
admin\model\sale\order.php with edit quantities for 1.5.4.1
Thx a lot
. Well... it is needed only by those who really use opencart as a real online-shop. But for me to run my shops with opencart i had to do A LOT of modifications, even in the core, the system, the shippings, payment... invoices (print in 3 copies, each copy with different color, and keep the header and the footer, invoice datas, design), checkout.... so it can fit the laws, the accountancy... the everything... i had to make STORNO system for invoice cancellation, had to make a system to insert invoices from my suppliers, warehouse management, bar code system for bar code devices to create invoices, subtract and add stock... i had to make a full system behind opencart... Hope in the future OC will have all this by default, but deppends on every country system...

Many thanks all! Looks like everything is working well on 1.5.3.1 (changed my order.php manually).
This should really be in core. Having stock management + options without proper support of these feature when editing or creating order makes them a bit pointless, IMO.
This should really be in core. Having stock management + options without proper support of these feature when editing or creating order makes them a bit pointless, IMO.
In the future, future=soon, very soon, i will make a storno system for invoices, who works in domain, or has a real life shop knows what i am talking about:). Opencart also needs this. Every country asks for this by commercial law.
I have submitted as a pull request to GitHub. https://github.com/opencart/opencart/pull/173
Code changes can be view here. https://github.com/opencart/opencart/pull/173/files
Code changes can be view here. https://github.com/opencart/opencart/pull/173/files
I just don't understand this git hib process. Your changes I assume are accepted, does that mean they appear in the next version of OC?
If so, and I want to add the changes to the existing 1.5.4.1 what must I do?
Sorry if this is basic but I see lots of changes also in the bug thread but have no idea how I update my 1.5.4.1 store before the next iteration of OC
If so, and I want to add the changes to the existing 1.5.4.1 what must I do?
Sorry if this is basic but I see lots of changes also in the bug thread but have no idea how I update my 1.5.4.1 store before the next iteration of OC

You are not the only one having these questions.Calcite wrote:I just don't understand this git hib process. Your changes I assume are accepted, does that mean they appear in the next version of OC?
If so, and I want to add the changes to the existing 1.5.4.1 what must I do?
Sorry if this is basic but I see lots of changes also in the bug thread but have no idea how I update my 1.5.4.1 store before the next iteration of OC
The switch from Google Code to Github was made because we (normal users) could easily extract code changes and bug fixes for a certain version of OC from the Github.
Sadly the way the Github is currently setup and used does not allow that.
So basically you must wait for the next release where the whole shebang starts again as new versions will introduce new bugs.
It is like a never ending story

Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.
Yes, they should be in the next version.Calcite wrote:I just don't understand this git hib process. Your changes I assume are accepted, does that mean they appear in the next version of OC?
If so, and I want to add the changes to the existing 1.5.4.1 what must I do?
Sorry if this is basic but I see lots of changes also in the bug thread but have no idea how I update my 1.5.4.1 store before the next iteration of OC
To update your store you need to change the admin\model\sale\order.php. You can do this manualy by looking at https://github.com/opencart/opencart/pull/173/files and adding all the lines in green prefexed with a +.
Or if you have no extinsions that mod that file replace it with the one in this post. http://forum.opencart.com/viewtopic.php ... 19#p346219
thanks a lot for order.php
This is what I need. I have an online shop and when user comes to my shop, pick up some items then I create an order but it cannot subtract. I will fix my order.php right away.
This is what I need. I have an online shop and when user comes to my shop, pick up some items then I create an order but it cannot subtract. I will fix my order.php right away.
Hi all, I read this post and i run into this problem too. I downloaded the file as attached here and got a try, it runs well!
But i have some question here
1. Why this function is not been activated in core module? Actually this will helps us as admin a lot to adjust stock details at admin site when we got a notice or call from customer.
2. I implemented these functions to my sale-order.php, i still face some problem which is
I Go to Sale - Order - Click Edit - Go to Tab Products.
Now the problem is eg. Product with code T0-2011 qty in inventory is: 10. When I add a new product of this code T0-2011 with qty 11 to the product order list, and the list is directly updated with T0-2011 quantity 11, at the same time it prompted me 2 messages: (I added new product using "Add Product" button)
1st is "Warning: Please check the form carefully for errors!"
2nd is "Products marked with *** are not available in the desired quantity or not in stock!"
And the weird is i supposed can't get to continue saving it, but it can! After i click button "Save" in the top right corner, it succeed to save it. And i got this message "Success: You have modified orders!".
And the result in my stock quantity of T0-2011 become -1 (10-11=-1).
So is it a bug? or Am i doing something wrong here? I'm using OC version 1.5.4 and clean install.
This is my thread http://forum.opencart.com/viewtopic.php?f=20&t=90404but nobody answer it yet
Please help and guide. Thanks.
But i have some question here
1. Why this function is not been activated in core module? Actually this will helps us as admin a lot to adjust stock details at admin site when we got a notice or call from customer.
2. I implemented these functions to my sale-order.php, i still face some problem which is
I Go to Sale - Order - Click Edit - Go to Tab Products.
Now the problem is eg. Product with code T0-2011 qty in inventory is: 10. When I add a new product of this code T0-2011 with qty 11 to the product order list, and the list is directly updated with T0-2011 quantity 11, at the same time it prompted me 2 messages: (I added new product using "Add Product" button)
1st is "Warning: Please check the form carefully for errors!"
2nd is "Products marked with *** are not available in the desired quantity or not in stock!"
And the weird is i supposed can't get to continue saving it, but it can! After i click button "Save" in the top right corner, it succeed to save it. And i got this message "Success: You have modified orders!".
And the result in my stock quantity of T0-2011 become -1 (10-11=-1).
So is it a bug? or Am i doing something wrong here? I'm using OC version 1.5.4 and clean install.
This is my thread http://forum.opencart.com/viewtopic.php?f=20&t=90404but nobody answer it yet

Please help and guide. Thanks.
Who is online
Users browsing this forum: No registered users and 5 guests