News:

Support the VirtueMart project and become a member

Main Menu

Order numbers

Started by brycom, June 08, 2012, 14:36:39 PM

Previous topic - Next topic

brycom

Hi All,

Can anyone tell me how to define my own order numbers instead of (example) 143ec056

I am using VM 2 and Joomla 2.5

Thanks

Thomas Kuschel

Can't be 143ec056 ;-), ...
the number e.g. f50e0529 is built :
the first 4 digits of the number (f50e) is a randomized, generated number; the last 4 are consecutively numbered - here: Order No. 0529 .
Thomas

brycom

I may have altered the numbers slightly to mask anything :)

Can I alter it so it is something like I000100, I000101 ?

Thanks Thomas

Thomas Kuschel

You could, but this means changing the source.
Thomas

Thomas Kuschel

In addition: the order number is also used for linking to your order status etc.  pp, so why changing? -  Therefore, it's also a security option.
You could display it as you want in your template, by just manipulationg the order number itself in the invoice - tmeplate.
e.g. in mail_html_vendor.php in your template:
There is the $this->orderDetails['details']['BT']->order_number
You could change it to 'I000'.substr($this->orderDetails['details']['BT']->order_number,4)

Regards, Thomas.

brycom

Hi Thomas,

As you have probably guessed today, I am new to this.

Which of the mail_html_vendor.php files to I modify?:

components\com_virtuemart\components\com_virtuemart\views\invoice\tmpl

or

components\com_virtuemart\views\cart\tmpl

or

components\com_virtuemart\views\invoice\tmpl

Many thanks!

Chris

Thomas Kuschel

Hi Chris,

do not change any php files inside those directories. I don't know, but there are several descriptions how to change the invoice mail or other templates within VirtueMart or Joomla in general.
Surely, you have a template in Joomla or maybe a template for virtuemart in use?

Note:
QuoteI only have a components/com_virtuemart/views/invoice/tmpl/mail_html_vendor.php on my system AND
nearly the same and editable (and only there, you should edit only this file) at  my template folder:
templates/lucid2/html/com_virtuemart/invoice/mail_html_vendor.php  (lucid2 is my template)

First, you have to copy all those files, which you want to change in your views to the folder of your template, e.g. that file mail_html_vendor.php
That is:
make a directory within your active template e.g. template/lucid2/html/com_virtuemart/invoice/
then copy the components/com_virtuemart/views/invoice/tmpl/mail_html_vendor.php file to this directory.
Then edit this file in the template folder;

So if you install a new version of VirtueMart, the file within components/... are overwritten, but not your template folder! - This makes sense?
VirtueMart (and all other joomla components/modules etc) automatically recognizes the new template file (if there's no typo hi hi) and uses the template file instead of the original file.

Regards
Thomas
ps. Read the manual of joomla and virtuemart for using templates and adjusting your own stuff at your template folder.

alatak

Hi,

QuoteCan anyone tell me how to define my own order numbers instead of (example) 143ec056
The best way is to create a plugin of type vmshopper.
The trigger plgVmOnUserOrder will set the order_number .
You can have a look in the file adminsitrator/componenets/com_virtuemart/models/orders.php
function _createOrder()

vigier

#8
Is there any documentation on how to write such a plugin? Or is there an example available?
I thought I could go live next monday, but today the people from the tax authorities (is that the right translation? Or is it tax administration?) told me that it's mandatory to have consecutive order numbers... If I start my shop, use the current weird numbers, and they want to check my administration, I'll get a fine and am not allowed to go further with my business.

Changing the way the number is displayed doesn't change anything to my administration. If someone wants to reopen an order on my site, they still need to know the first 4 characters, right?

Milbo

No they just can use the provided link in the email, which stays always valid. The order numbers are consecutive. As Thomas said, just remove the first 4 chars. It is a security thing, because you can check your orders just with the number and a small password. But you can also just login and you see your orders listed.

A plugin, hmm quite easy thing actually. Learn the "hallo world" plugin of joomla, then search for the trigger and you can easily adjust it. You can also exactly describe how you want it. But ask your tax consultant again, btw, where do you come from?

Because in germany we were also forced to have one consequent part and vm2 is following this rule. But in germany we can now do what we want, as long it is unique. Ah yes and they are not interested in the ordernumber actually, they wanna know the invoice number.

You can also adjust the invoice number. The system of the invoice number is Date.random.countallinvoices+offset. The date has the format yymmdd, so a typical invoice number of vm2 is then for today 120713rje0345
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

tez

Quote from: alatak on June 08, 2012, 19:42:42 PM
Hi,

QuoteCan anyone tell me how to define my own order numbers instead of (example) 143ec056
The best way is to create a plugin of type vmshopper.
The trigger plgVmOnUserOrder will set the order_number .
You can have a look in the file adminsitrator/componenets/com_virtuemart/models/orders.php
function _createOrder()


So would I copy/rename the vmshopperplugin.php file and edit that? what parts would i need to change? Where are some examples of simple plugins which drop in and work.

How do you intercept the order number?

Is the attached file heading in the right direction?

[attachment cleanup by admin]

reinhold

#11
Quote from: alatak on June 08, 2012, 19:42:42 PM
Hi,

QuoteCan anyone tell me how to define my own order numbers instead of (example) 143ec056
The best way is to create a plugin of type vmshopper.

I have now created such a plugin, which allows the shop owner to change the order number, order password and invoice number at will:
http://open-tools.net/virtuemart-2-extensions/40-vm2-ordernumber.html

The format is given as a text string, where [...] is understood as a variable and replaced by its value (e.g. [year] by the current year).

The running counter is indicated by #. The counter can be configured to be global (e.g. not reset each year/month/..) or a separate counter for each year/month/...

I hope you like the plugin and it does what you need. If you have any suggestions or further needs, just tell me: office@open-tools.net

lindapowers

Milbo I think this is a serious issue in VM2, is the same for us here in Spain, we have to use consecutive numbers or Invoices are not valid.

Actually is like that in most european countries.

Would be nice if you could add some kind of configuration for it, or a little plugin so we can use the core invoices instead of vm_invoice from artio or other components.

Regards

Milbo

The numbers ARE consecutive. The numbers are according to the old german law with consecutive numbers.

Read exactly. I am almost 100% sure that no country demands a pure consecutive number. Most of them demand a consecutive PART ! For example

KudlleMuddle-0001_whatashit,
KudlleMuddle-0002_whatashit,
KudlleMuddle-0003_whatashit,
KudlleMuddle-0004_whatashit,

is a consecutive number.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bytelord

The last three digits are the order numbering of the invoice the rest is a zero and random chrs. So there is a prefix (so security also) and then is the ordering, you could use some php to printout a second order_id for your customers/invoices/etc. You could use for example substr to printout only the last 3 digits or everything after finding a 0.
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!