VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: supermac on January 27, 2012, 15:59:17 PM

Title: Stock decreasing doubled when customfield present
Post by: supermac on January 27, 2012, 15:59:17 PM
If I order 10pcs of a product, when Administrator from his admin-panel read my order see 10pcs but in product page or stock page he see 20pcs ordered....
Even in productdetail page (customer side) the available stock is calculated counting 20pcs orderd.
When he change status of the order from pending to confirmed the quantity effectively scaled down from stock is 20.

Don't tell me I've to set double stock quantity in product configuration  ::)

Maybe this behaviour could be related to product's customfields but still I didn't realized how....
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on January 30, 2012, 11:31:01 AM
I confirm the bug is related to customfield.
I made this test.
1- created a test product with 100units in stock
2- ordered 10units
3- in admin panel appears correctly 10 units ordered; I changed the order status from "pending" to "confirmed"
4- in admin panel now appears correctly 0 units ordered and stock decreased by 10 units to 90
5- in admin panel added a customfield to product (customfield was a cart option with 2 possible values showed as dropdownlist)
6- ordered other 10 units
7- in admin panel appears correctly 10 units ordered; I changed the order status from "pending" to "confirmed"
8- in admin panel now appears correctly 0 units ordered BUT stock decreased by 20 units to 70!!!!

HELLP!  :'(

(J 1.7 and VM 2.0.0)
Title: Re: Stock decreasing doubled when customfield present
Post by: Milbo on January 30, 2012, 22:13:27 PM
Which customfield did you add? This is very important to know for understanding
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on January 31, 2012, 12:27:53 PM
Hi Milbo
I attached 2 jpg to show my situation.
I wish you understand italian interface, however in vm2.jpg you see customfields list: they are 'cart variant' ("variante carrello").
In cfields.jpg you see customfields added to a product with them option/values and related discounts.

In the meanwhile I'll to try to subsitute
\administrator\components\cm_virtuemart\models\customfields.php
and
\administrator\components\cm_virtuemart\plugins\vmcustomplugins.php
with the SVN version... an them I'll tell you if the situation changes.


[attachment cleanup by admin]
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on January 31, 2012, 12:49:09 PM
Update
I'm sorry, I wrote a wrong thing about the bug: when product has customfields even the ordered quantity is doubled, not only stock after order confirmation!

I tried to substitute php pages taking the ones from SVN: itchanges nothing on the bug's front, more it makes disappear customfields description on admin panel... I restore previous php pages.
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on February 01, 2012, 15:02:15 PM
Is it possible to know wich php pages/db tables are involved in cart>order elaboration?
I'd like to try to debug step by step the process, following stored data in mysql too, to understand what goes wrong when cart is transformed in order.
thx
Title: Re: Stock decreasing doubled when customfield present
Post by: Studio 42 on February 01, 2012, 16:33:09 PM
HI,
I must know at which step the qunatity is doubled ?
on click add to cart button.
On confirm order(in mail)
after this steps ?

THanks
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on February 01, 2012, 17:08:00 PM
Ok, thank you for your support!
Look at my attachments.

step1 - my product's status before an order: it signs 0 items ordered.

step2 - the order made by a customer as seen in admin panel: he ordered 10 items.

step3 - the product's status after the order. It signs 20 items!
At step3, admin didn't yet changed the order status from pending to confirmed: in this moment, in front end, items availability for customers (stock level) is lower than its real value (stock level for customers is the difference between product's stock - ordered item, in front end VM2 is considering he has 110-20=90 item!)

step4 - When admin changes the order status from pending to confirmed, the stock quantity decrease by 20 to 90. In confirmed order, ordered quantity is always 10.

(I still apologize for my terrible english, that's why I attached pics)

EDIT: all this doesn't happen if I try the same process with a product without customfields: in this case all counts are correct.

[attachment cleanup by admin]
Title: Re: Stock decreasing doubled when customfield present
Post by: Studio 42 on February 01, 2012, 22:44:07 PM
Last think,

Because i know the step now.
Is it for all customfields type or product plugins(customfields plugin) ?

Title: Re: Stock decreasing doubled when customfield present
Post by: Studio 42 on February 01, 2012, 22:46:06 PM
Arf, i found the bug :)
forgot and test last dev revison or wait next release...
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on February 02, 2012, 08:33:20 AM
Great! I'm happy about the solution!
Cannot wait next release, please may you tell me how to patch my VM installation? (I'm really not a skilled VM user)
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on February 06, 2012, 10:57:31 AM
up
I cannot pass to 2.0.1, please let me know if I can substitute only some files in VM2 backend
Title: Re: Stock decreasing doubled when customfield present
Post by: supermac on February 09, 2012, 10:59:30 AM
 :'(