Author Topic: Stock decreasing doubled when customfield present  (Read 3351 times)

supermac

  • Jr. Member
  • **
  • Posts: 68
Stock decreasing doubled when customfield present
« 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....

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #1 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)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Stock decreasing doubled when customfield present
« Reply #2 on: January 30, 2012, 22:13:27 pm »
Which customfield did you add? This is very important to know for understanding
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #3 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]

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #4 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.

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #5 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

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4347
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Stock decreasing doubled when customfield present
« Reply #6 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

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #7 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]

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4347
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Stock decreasing doubled when customfield present
« Reply #8 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) ?

 

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4347
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Stock decreasing doubled when customfield present
« Reply #9 on: February 01, 2012, 22:46:06 pm »
Arf, i found the bug :)
forgot and test last dev revison or wait next release...

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #10 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)

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #11 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

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stock decreasing doubled when customfield present
« Reply #12 on: February 09, 2012, 10:59:30 am »
 :'(