VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: LanFish1 on November 27, 2016, 17:36:25 PM

Title: order_number = virtuemart_order_id
Post by: LanFish1 on November 27, 2016, 17:36:25 PM
HI,
I want make some changes to the code where the function used to save new orders. In particular  I want to find the INSERT Query regarding new orders and write the virtuemart_order_id (last order ID+1) instead of the order_number. Anyone has an idea where is the file to chenge?Or other suggestions?
Thanks
Title: Re: order_number = virtuemart_order_id
Post by: GJC Web Design on November 27, 2016, 18:03:48 PM
there are at least two plugins for VM to choose the order numbers
Title: Re: order_number = virtuemart_order_id
Post by: LanFish1 on November 27, 2016, 21:30:49 PM
I found the function that generate the order number. It's /administrator/components/com_virtuemart/models/orders.php
I manipulate in this way:

/**
* Generate a unique ordernumber using getHumanToken, which is a random token
* with only upper case chars and without 0 and O to prevent missreadings
* @author Max Milbers
* @param integer $virtuemart_vendor_id For the correct count
* @return string A unique ordernumber
*/
static public function genStdOrderNumber($virtuemart_vendor_id=1, $length = 4){

$db = JFactory::getDBO();

$q='SELECT  `virtuemart_order_id` from r9uc1_virtuemart_orders ORDER BY  `virtuemart_order_id` DESC   limit 1';
$db->setQuery($q);
$c = $db->loadResult();
return ($c+1);
}


The problem now is how I can override this function. Anyone has an idea?
Thanks
Title: Re: order_number = virtuemart_order_id
Post by: jenkinhill on November 27, 2016, 22:29:00 PM
Core functions are overriden by plugins, "there are at least two plugins for VM to choose the order numbers"
Title: Re: order_number = virtuemart_order_id
Post by: LanFish1 on November 28, 2016, 09:22:31 AM
Quote from: jenkinhill on November 27, 2016, 22:29:00 PM
Core functions are overriden by plugins, "there are at least two plugins for VM to choose the order numbers"
Thanks,
I would like to develop this plugin on my own. Con you give me a link where I can  study how to do?
A.
Title: Re: order_number = virtuemart_order_id
Post by: mcmannehan2002 on November 28, 2016, 16:51:00 PM
Google Search "Create a plug-in for Joomla 3.x"
Here: https://docs.joomla.org/J3.x:Creating_a_Plugin_for_Joomla (https://docs.joomla.org/J3.x:Creating_a_Plugin_for_Joomla)

First hit in Google...  8) 8) 8)