News:

Support the VirtueMart project and become a member

Main Menu

order_number = virtuemart_order_id

Started by LanFish1, November 27, 2016, 17:36:25 PM

Previous topic - Next topic

LanFish1

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

GJC Web Design

there are at least two plugins for VM to choose the order numbers
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

LanFish1

#2
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

jenkinhill

Core functions are overriden by plugins, "there are at least two plugins for VM to choose the order numbers"
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

LanFish1

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.

mcmannehan2002

Google Search "Create a plug-in for Joomla 3.x"
Here: https://docs.joomla.org/J3.x:Creating_a_Plugin_for_Joomla

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