Post by Alexisander » Thu Sep 27, 2012 9:24 pm

Ofcourse, in a few minutes u will have it!

I do now one last test, i wanna be sure that everything is 100% working!

Active Member

Posts

Joined
Mon Jul 18, 2011 10:11 pm

Post by ADD Creative » Fri Sep 28, 2012 5:47 pm

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

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'");
				}
			}
		}
above

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 . "'");

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Alexisander » Fri Sep 28, 2012 11:42 pm

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.

Active Member

Posts

Joined
Mon Jul 18, 2011 10:11 pm

Post by Enso_san » Sat Sep 29, 2012 6:42 pm

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!

Newbie

Posts

Joined
Sat Sep 29, 2012 6:27 pm

Post by opencart.mx » Sun Sep 30, 2012 9:13 am

The BIG QUESTION IS: ¿When is going to be officially solved?

New member

Posts

Joined
Wed Sep 26, 2012 4:24 am

Post by Antoni4 » Sun Sep 30, 2012 5:27 pm

Alexander, can you upload the file as attachment?
(And if you can, attach a text file with description of the fixes, just for reference.)

Thanks.

User avatar
New member

Posts

Joined
Sat Sep 29, 2012 7:03 am

Post by ADD Creative » Sun Sep 30, 2012 7:21 pm

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.

Attachments

admin\model\sale\order.php with edit quantities for 1.5.4.1


www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Antoni4 » Sun Sep 30, 2012 9:41 pm

Sweet... good work guys.

User avatar
New member

Posts

Joined
Sat Sep 29, 2012 7:03 am

Post by Alexisander » Mon Oct 01, 2012 6:47 am

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...

Active Member

Posts

Joined
Mon Jul 18, 2011 10:11 pm

Post by Enso_san » Tue Oct 02, 2012 4:47 am

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.

Newbie

Posts

Joined
Sat Sep 29, 2012 6:27 pm

Post by Alexisander » Tue Oct 02, 2012 11:58 pm

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.

Active Member

Posts

Joined
Mon Jul 18, 2011 10:11 pm

Post by Calcite » Wed Oct 03, 2012 9:05 pm

Perhaps this change should be highlighted to the OC development team as it's a real important feature to avoid stock headaches ;)

Active Member

Posts

Joined
Fri Dec 30, 2011 3:21 am

Post by ADD Creative » Thu Oct 04, 2012 5:02 pm

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

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Calcite » Tue Oct 16, 2012 6:36 am

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 :-*

Active Member

Posts

Joined
Fri Dec 30, 2011 3:21 am

Post by i2Paq » Tue Oct 16, 2012 12:58 pm

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 :-*
You are not the only one having these questions.

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.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by ADD Creative » Tue Oct 16, 2012 8:29 pm

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 :-*
Yes, they should be in the next version.

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

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Calcite » Tue Oct 30, 2012 10:42 pm

Worked great - Many thanks for your help on this, it was one thing that really bugged me and really a core part of any software for managing a store.

Active Member

Posts

Joined
Fri Dec 30, 2011 3:21 am

Post by antoniokam » Thu Nov 01, 2012 5:14 pm

thanks a lot for the file, that's what I'm looking for!!!

Newbie

Posts

Joined
Thu Aug 18, 2011 2:46 pm

Post by johmach » Thu Nov 08, 2012 9:47 pm

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.

The bridgeview


Newbie

Posts

Joined
Thu Nov 08, 2012 9:43 pm


Post by qiux » Wed Dec 05, 2012 8:55 pm

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.

Newbie

Posts

Joined
Wed Aug 22, 2012 10:17 pm
Who is online

Users browsing this forum: No registered users and 3 guests