News:

Support the VirtueMart project and become a member

Main Menu

Stock decreasing doubled when customfield present

Started by supermac, January 27, 2012, 15:59:17 PM

Previous topic - Next topic

supermac

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

supermac

#1
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)

Milbo

Which customfield did you add? This is very important to know for understanding
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

supermac

#3
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]

supermac

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.

supermac

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

Studio 42

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

supermac

#7
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]

Studio 42

Last think,

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


Studio 42

Arf, i found the bug :)
forgot and test last dev revison or wait next release...

supermac

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)

supermac

up
I cannot pass to 2.0.1, please let me know if I can substitute only some files in VM2 backend