VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: vigier on May 24, 2012, 17:53:38 PM

Title: Notice: Undefined index: order_stock_handle
Post by: vigier on May 24, 2012, 17:53:38 PM
Hi,

when the order is paid and confirmed, I get a few errors.
The first
Notice: Undefined index: order_stock_handle in C:\wamp\www\Joomla\administrator\components\com_virtuemart\models\orders.php on line 718
Call Stack
#   Time   Memory   Function   Location
1   0.0005   651760   {main}( )   ..\index.php:0
2   0.1073   12215304   JSite->dispatch( )   ..\index.php:42
3   0.1077   12218960   JComponentHelper::renderComponent( )   ..\application.php:198
4   0.1106   12366768   JComponentHelper::executeComponent( )   ..\helper.php:357
5   0.1108   12472520   require_once( 'C:\wamp\www\Joomla\components\com_virtuemart\virtuemart.php' )   ..\helper.php:388
6   0.1315   14798664   JController->execute( )   ..\virtuemart.php:103
7   0.1315   14798744   VirtueMartControllerCart->confirm( )   ..\controller.php:754
8   0.1535   16859488   VirtueMartCart->confirmDone( )   ..\cart.php:397
9   0.3808   21480616   VirtueMartCart->confirmedOrder( )   ..\cart.php:696
10   0.3835   22045048   VirtueMartModelOrders->createOrderFromCart( )   ..\cart.php:982
11   0.4228   23205832   VirtueMartModelOrders->_createOrderLines( )   ..\orders.php:479
12   0.4271   23822168   VirtueMartModelOrders->handleStockAfterStatusChangedPerProduct( )

The second
Notice: Undefined index: order_stock_handle in C:\wamp\www\Joomla\administrator\components\com_virtuemart\models\orders.php on line 731
Call Stack
#   Time   Memory   Function   Location
1   0.0005   651760   {main}( )   ..\index.php:0
2   0.1073   12215304   JSite->dispatch( )   ..\index.php:42
3   0.1077   12218960   JComponentHelper::renderComponent( )   ..\application.php:198
4   0.1106   12366768   JComponentHelper::executeComponent( )   ..\helper.php:357
5   0.1108   12472520   require_once( 'C:\wamp\www\Joomla\components\com_virtuemart\virtuemart.php' )   ..\helper.php:388
6   0.1315   14798664   JController->execute( )   ..\virtuemart.php:103
7   0.1315   14798744   VirtueMartControllerCart->confirm( )   ..\controller.php:754
8   0.1535   16859488   VirtueMartCart->confirmDone( )   ..\cart.php:397
9   0.3808   21480616   VirtueMartCart->confirmedOrder( )   ..\cart.php:696
10   0.3835   22045048   VirtueMartModelOrders->createOrderFromCart( )   ..\cart.php:982
11   0.4228   23205832   VirtueMartModelOrders->_createOrderLines( )   ..\orders.php:479
12   0.4271   23822168   VirtueMartModelOrders->handleStockAfterStatusChangedPerProduct( )

I get these errors for each item I had in the shopping cart. I don't want to have a product_in_stock value since there is unlimited stock.
I happens when product_in_stock is 0 and also when it's at 100000.

Line 718: if ($StatutWhiteList[$newState]['order_stock_handle'] == 'O') $isOut = 1;
Line 731:    if ($StatutWhiteList[$newState]['order_stock_handle'] == 'R') $isReserved = 1;

What am I doing wrong?

P.S. Using VM2.0.6 and Joomla 2.5.4
Title: Re: Notice: Undefined index: order_stock_handle
Post by: vigier on May 25, 2012, 17:25:23 PM
When installing the new 2.0.7 version I got the next set of errors:
Error: Install alterTable Unknown column 'order_stock_handle' in 'field list' SQL=UPDATE `tblSR_virtuemart_orderstates` SET `order_stock_handle`="R" WHERE `order_status_code`="P" ;
Error: Install alterTable Unknown column 'order_stock_handle' in 'field list' SQL=UPDATE `tblSR_virtuemart_orderstates` SET `order_stock_handle`="R" WHERE `order_status_code`="C" ;
Error: Install alterTable Unknown column 'order_stock_handle' in 'field list' SQL=UPDATE `tblSR_virtuemart_orderstates` SET `order_stock_handle`="A" WHERE `order_status_code`="X" ;
Error: Install alterTable Unknown column 'order_stock_handle' in 'field list' SQL=UPDATE `tblSR_virtuemart_orderstates` SET `order_stock_handle`="A" WHERE `order_status_code`="R" ;
Error: Install alterTable Unknown column 'order_stock_handle' in 'field list' SQL=UPDATE `tblSR_virtuemart_orderstates` SET `order_stock_handle`="O" WHERE `order_status_code`="S" ;

So I think I miss the column order_stock_handle... How can I fix this?
Title: Re: Notice: Undefined index: order_stock_handle
Post by: Milbo on May 25, 2012, 19:38:26 PM
It is very strange, the tableupdater should do it for you. Did you edited the virtuemart.cfg?
Title: Re: Notice: Undefined index: order_stock_handle
Post by: vigier on May 27, 2012, 01:23:11 AM
No, I didn't. Actually I had to search for it to find it, since I don't like editing things in the administrator map. I usually only edit plugins, CSS files and PHP files.
The strange thing (at least to me) is that the date of virtuemart.cfg is 22 feb 2012 and all the other files in that map are from 25th may 2012 (the day I went from 2.0.6 to 2.0.7).
As far as I can recall 22 feb is the day that I installed the whole VirtueMart for the first time.

P.S. Ohh crap, now I see that going to 2.0.7 might not have been a good idea, since there's already an a/b/c and d version. But I'll wait for going to another version until I know what to do with the missing field in my database.
Title: Re: Notice: Undefined index: order_stock_handle
Post by: vigier on May 27, 2012, 02:00:12 AM
Hmm... would it work if I just add a char(1) field order_stock_handle and fill it with the values as are shown in my post above?
Or do I have to do more?