VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: annpaul on May 27, 2023, 18:38:41 PM

Title: How to customize Invoice number to remove random part.
Post by: annpaul on May 27, 2023, 18:38:41 PM
Using VM 4.0.12 on Joomla 4.2.6

I need to tweak VM invoice number generation a little bit. I don't want the random part in it. In which file may I find the logic of invoice number generation? I am guessing that all I need to do is comment out the part that generates the random sequence. Right?

Title: Re: How to customize Invoice number to remove random part.
Post by: annpaul on May 27, 2023, 19:29:29 PM
Well, it seems I just need to modify the following line in administrator/components/com_virtuemart/models/invoice.php

$data['invoice_number'] = str_replace('-', '', substr($date,2,8)).vmCrypt::getHumanToken(4).'0'.$count;

Title: Re: How to customize Invoice number to remove random part.
Post by: Milbo on May 29, 2023, 20:46:28 PM
This one does it for you update proof.
https://extensions.virtuemart.net/shopper-order/orders/automated-numbers-detail
Title: Re: How to customize Invoice number to remove random part.
Post by: Gingerweb on January 19, 2024, 12:23:15 PM
Quote from: annpaul on May 27, 2023, 19:29:29 PM
Well, it seems I just need to modify the following line in administrator/components/com_virtuemart/models/invoice.php

$data['invoice_number'] = str_replace('-', '', substr($date,2,8)).vmCrypt::getHumanToken(4).'0'.$count;

Hi - Can you tell me how you modified this file? I also need consecutive numbering and the VM plugin Milbo mentioned doesnt have any instructions so having bought it, i cant get it to work!
Title: Re: How to customize Invoice number to remove random part.
Post by: Milbo on January 24, 2024, 21:04:24 PM
The main instruction is in the plugin directly. I also fixed the docs problem. The main problem is, that the old SEF worked with Ids, but the new page has new ids, so the old links do not work anylonger. http://extensions.virtuemart.net/all-tutorials/shopper-fields-plugins/automated-numbers