Author Topic: Bug In Stock update virtuemart 2.0.4  (Read 4607 times)

teobgeno

  • Jr. Member
  • **
  • Posts: 55
    • www.netpin.gr
Bug In Stock update virtuemart 2.0.4
« on: April 10, 2012, 04:37:05 am »
When i change an order status from (pending,cancel...) to  shipped  In Stock value at product get +(Booked, ordered products) instead of - (Booked, ordered products)

At components/com_virtuemart/models/orders.php line 728

if ($isOut && !$wasOut)     $product_in_stock = '-';
else if ($wasOut && !$isOut ) $product_in_stock = '+';
else $product_in_stock = '=';

i think should be

if ($isOut && !$wasOut)     $product_in_stock = '+';
else if ($wasOut && !$isOut ) $product_in_stock = '-';
else $product_in_stock = '=';

Onother issue is when i delete an order and is for example pending the product(s) of that order (pending also)  does not update in their previous state.
ex. (In Stock 8 Booked, ordered products -1) If i delete this order although the values must change to (In Stock 8 Booked, ordered products 0) they remain  (In Stock 8 Booked, ordered products -1) . So in order to properly delete the order without conflicts in product(s) amounts i must cancel the order first before delete.If someone has a solution for that please reply.
Thank you

teobgeno

  • Jr. Member
  • **
  • Posts: 55
    • www.netpin.gr
Re: Bug In Stock update virtuemart 2.0.4
« Reply #1 on: April 10, 2012, 05:21:03 am »
To complete this i finally find a solution for the issue when you delete an order and products quantity not properly updated.

At components/com_virtuemart/models/orders.php line 1237
You will see

//TODO Why should the stock change, when the order is deleted? Paypal? Valerie?
//$this->handleStockAfterStatusChangedPerProduct('C', $item->order_status,$item, $item->product_quantity);

I can't figure out what this comment means and if anyone has something for this i would appreciate a reply. Does payment plugins update quantity when redirecting back to site from the payment gateway and in order to prevent conflict from an order delete the delete action does not change quantity ?

So for my case that i have only pay on delivery the quantity is handled only by the actions of the shop's administrator. I uncomment this line

$this->handleStockAfterStatusChangedPerProduct('C', $item->order_status,$item, $item->product_quantity);

and it does not worked :)

The handleStockAfterStatusChangedPerProduct passes C (confirmed) when the product removed from the order and that is not correct. This line must be modified to

$this->handleStockAfterStatusChangedPerProduct('X', $item->order_status,$item, $item->product_quantity);

simbus82

  • Jr. Member
  • **
  • Posts: 109
    • Simbus82 Web & Tech
Re: Bug In Stock update virtuemart 2.0.4
« Reply #2 on: April 10, 2012, 09:23:04 am »
To complete this i finally find a solution for the issue when you delete an order and products quantity not properly updated.


Thanks but...please use code tags! ;-)

At components/com_virtuemart/models/orders.php line 1237 change

Code: [Select]
//TODO Why should the stock change, when the order is deleted? Paypal? Valerie?
//$this->handleStockAfterStatusChangedPerProduct('C', $item->order_status,$item, $item->product_quantity);

to

Code: [Select]
//TODO Why should the stock change, when the order is deleted? Paypal? Valerie?
$this->handleStockAfterStatusChangedPerProduct('X', $item->order_status,$item, $item->product_quantity);

Joomla! 2.5.16 & VM 2.0.24b

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Bug In Stock update virtuemart 2.0.4
« Reply #3 on: April 10, 2012, 15:31:24 pm »
Hi,

If you use 2.04 you must update tables (in normal case the installer do it) and verify the stock updates.

It's only implemented since some weeks but now you can decide how to manage your stock with the status changes in order and add more status but handle correctly with your specifications.

Patrick

simbus82

  • Jr. Member
  • **
  • Posts: 109
    • Simbus82 Web & Tech
Re: Bug In Stock update virtuemart 2.0.4
« Reply #4 on: April 10, 2012, 16:04:20 pm »
Hi,

If you use 2.04 you must update tables (in normal case the installer do it) and verify the stock updates.

It's only implemented since some weeks but now you can decide how to manage your stock with the status changes in order and add more status but handle correctly with your specifications.

Patrick


In the upgrade from 2.0.2 to 2.0.4, how we can verfy if we need to upadate tables after the upgrade too?
Joomla! 2.5.16 & VM 2.0.24b

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Bug In Stock update virtuemart 2.0.4
« Reply #5 on: April 10, 2012, 17:24:34 pm »
in ROOT/administrator/index.php?option=com_virtuemart&view=updatesmigration
or menu
Tools
> Control Panel

Tab : DB Tools
Click >>
Install tables
or if necessary
update them

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Bug In Stock update virtuemart 2.0.4
« Reply #6 on: April 10, 2012, 17:51:22 pm »
in ROOT/administrator/index.php?option=com_virtuemart&view=updatesmigration
Install tables
or if necessary
update them

For the stock you are right i have invert the states.
Fixed now see attached files or update from SVN

overide \administrator\components\com_virtuemart\models\orders.php

[attachment cleanup by admin]

simbus82

  • Jr. Member
  • **
  • Posts: 109
    • Simbus82 Web & Tech
Re: Bug In Stock update virtuemart 2.0.4
« Reply #7 on: April 10, 2012, 18:21:38 pm »
in ROOT/administrator/index.php?option=com_virtuemart&view=updatesmigration
or menu
Tools
> Control Panel

Tab : DB Tools
Click >>
Install tables
or if necessary
update them


if anyone run this without having problems... nothing appens or it is a bad action?

thanks for the file for orders!
Joomla! 2.5.16 & VM 2.0.24b

teobgeno

  • Jr. Member
  • **
  • Posts: 55
    • www.netpin.gr
Re: Bug In Stock update virtuemart 2.0.4
« Reply #8 on: April 10, 2012, 18:26:33 pm »
Can you also explain me the

//TODO Why should the stock change, when the order is deleted? Paypal? Valerie?

At components/com_virtuemart/models/orders.php line 1237

Code: [Select]
//TODO Why should the stock change, when the order is deleted? Paypal? Valerie?
//$this->handleStockAfterStatusChangedPerProduct('C', $item->order_status,$item, $item->product_quantity);

Because i have uncomment this line and modified it to
Code: [Select]
//TODO Why should the stock change, when the order is deleted? Paypal? Valerie?
$this->handleStockAfterStatusChangedPerProduct('X', $item->order_status,$item, $item->product_quantity);

Thank you