- Posts: 137
- Thank you received: 2
Change order number format
- emergentec
-
Topic Author
- Offline
I already know WHERE I can change the order number format, but I don't know how to change it to a custom order number.
Best regards!
Please Log in or Create an account to join the conversation.
We explain that in the documentation:
www.hikashop.com/support/documentation/5...hop-config.html#main
Order number format : This option enables you to set the format of order numbers. It is only available in commercial versions of HikaShop. By default, the order number uses letters and numbers interleaved together. this is represented here with the tag {automatic_code}. If you want to use the order number directly, you can use the tag {id}. In the tag id, you can specify the number of numbers with the size attribute. For example, {id size="5"} will result in 00123 for the order with the id 123. You can also use the date tag in order to insert date information. For example, {date format="m/Y"} will result in 02/11 for an order made in February 2011. You can combine them to generate pretty advanced order numbers like the format RE-{id size="5"}/{date format="m/Y"} used for German accounting which will result in RE-00123/02/11 for the order 123 made on February 2011.
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Is there a possibility to adapt the use of {date format="Y"}. Due to the fact that our accounting year ends in February of the following year, we would like to display 2011 still in January 2012.
Best regards
Please Log in or Create an account to join the conversation.
www.php.net/manual/en/function.date.php
However, you won't be able to change the date like that.
You would have to create a hikashop plugin and implement the onBeforeOrderCreate(&$order,&$do) event in order to set the order_number field of the order before the order is created. More information on that here: www.hikashop.com/en/support/documentatio...r-documentation.html
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Please Log in or Create an account to join the conversation.
If you don't, the system will generate the order_number automatically when the order is created.
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
Why is it not needed with mysql? When I want to check which is the last order number before creating a new order number, couldn't it be, that two users get the same result?There is no lock table in the joomla framework and joomla extensions do not use that method as it's not needed with mysql. If you want to use it, you will have to do it in your code.
Please Log in or Create an account to join the conversation.
$id = $database->insertid()
There is of course a small probability that an insert has been done between your insert and that function call, in which case you wouldn't get the correct id. That's however how Joomla handles the inserts and I've never seen a problem with that. Of course, you can always add your lock table yourself in your code to reduce that probability to 0.
Please Log in or Create an account to join the conversation.
- emergentec
-
Topic Author
- Offline
- Posts: 137
- Thank you received: 2
E.g. bought on
31.1.2011 > order number = 2010-05421
1.2.2011 > order number = 2011-00001
Therefore I have to use LOCK TABLE in the plugin.
Thanks for the explanation!
Please Log in or Create an account to join the conversation.
VAT NUMBER have 8 numbers+ invoice numer with 3 digits+ {date format="m-y"}
Thanks to everyone...
Andrej
Please Log in or Create an account to join the conversation.
What you could do is unpublish the address VAT number custom field via the menu Display->Custom fields and create a new custom USER field for the VAT number.
For example, if you called it user_vat, your order numbers would look like :
{user user_vat}-{id size="3"}-{date format="m-Y"}
The downside of using a custom user field instead of the one already in HikaShop is that the customers type (with or without a vat number) won't be detected by HikaShop's tax system so if you need to have the VAT applied based on whether the user provided that information or not, that won't be possible. Also, there won't be any check on the VAT number validity.
Please Log in or Create an account to join the conversation.
HikaShop Essential 3.4.0
Is it possible to generate order numerc/codes in this format:
EHTRPSUSK
IQCDCFGEQ
QHOFPZSOC
etc.
etc.
Rgds,
Petter
Please Log in or Create an account to join the conversation.
There is no option for that.
However, you can implement the trigger onBeforeOrderNumberGenerate(&$order, &$result) in a plugin of the group "hikashop"
Just set the order number you generated with your custom code in $result so that the order being created will use that number.
docs.joomla.org/J3.x:Creating_a_Plugin_for_Joomla
Please Log in or Create an account to join the conversation.
I suppose it's doable.
Anyone done this?
Rgds,
Petter
Please Log in or Create an account to join the conversation.
We did for some client, but we can't share the code.
Note however that it's really not difficult for an average PHP developer.
If you want, you can ask our partners:
www.hikashop.com/home/our-partners.html
Please Log in or Create an account to join the conversation.