VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: eliotrayner on July 24, 2018, 14:31:34 PM

Title: Order Model CreateOrderHead issue
Post by: eliotrayner on July 24, 2018, 14:31:34 PM
Hi Guys

I use the Orders model to create orders from a plugin.

I have been using CreateOrderHead() successfully for a while until it seems it broke in 3.2.14?

administrator\components\com_virtuemart\models\orders.php around line 2508

$orderTable -> bindChecknStore($_orderData);

$db = JFactory::getDBO();
$_orderID = $db->insertid();


$_orderID doesn't return a virtuemart_order_id.

I updated administrator\components\com_virtuemart\models\orders.php around line 2508 to

$orderTable -> bindChecknStore($_orderData);

$db = JFactory::getDBO();
$_orderID = $orderTable->virtuemart_order_id;


Now it works for me again,

regards
Eliot
Title: Re: Order Model CreateOrderHead issue
Post by: Milbo on July 24, 2018, 19:11:30 PM
Thank you, yes that is the right pattern to use. I add it to the core
Title: Re: Order Model CreateOrderHead issue
Post by: diri on July 26, 2018, 14:51:50 PM
Hi Milbo,

little typo:
$_orderID = $orderTable->virtuemart_order_id;;

$_orderID = $orderTable->virtuemart_order_id;
might be better.

cu, diri