[Skip to main content](#vessel-content)

#   Format order number format and invoice number format with autoincremental

##

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

8 years 8 months ago [\#288831](#288831) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  *[Format order number format and invoice number format with autoincremental](/forum/35-orders-management/893955-format-order-number-format-and-invoice-number-format-with-autoincremental#288831 "-- HikaShop version -- : 3.3.0 -- Joomla version -- : 3.8.1  Hi,  I'm adjusting the format for &quot;Order number format&quot; and &quot;Invoice Number Format&quot;, and now I have something like that:  M{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for order number F{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for invoice number  But that's not what I need. I need the &quot;id&quot; to be an autoincremental number (begining with 1) that every year resets.  For example, if in 2018 we have 300 orders, the last format it would be &quot;M180300&quot; and the next year it will begin with &quot;M190001&quot;.  I'm doing it in the Hikashop configuration options -&gt; Main -&gt; order.  How can I do this?  Thanks in advance.  -- Victor")* was created by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")*

-- HikaShop version -- : 3.3.0
-- Joomla version -- : 3.8.1

Hi,

I'm adjusting the format for "Order number format" and "Invoice Number Format", and now I have something like that:

M{date format="y"}{id size="4"} -&gt; for order number
F{date format="y"}{id size="4"} -&gt; for invoice number

But that's not what I need. I need the "id" to be an autoincremental number (begining with 1) that every year resets.

For example, if in 2018 we have 300 orders, the last format it would be "M180300" and the next year it will begin with "M190001".

I'm doing it in the Hikashop configuration options -&gt; Main -&gt; order.

[ ![Capturadepantalla2018-03-01ales8.24.03.png](/forum/attachment/42806) ](/forum/attachment/42806 "...les8.24.03.png")

How can I do this?

Thanks in advance.

--
Victor

- [ ![Capturadepantalla2018-03-01ales8.24.03.png](/forum/attachment/42806) ](/forum/attachment/42806 "...les8.24.03.png") [ ](/forum/attachment/42806?download=1 "...les8.24.03.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mzk1NS1mb3JtYXQtb3JkZXItbnVtYmVyLWZvcm1hdC1hbmQtaW52b2ljZS1udW1iZXItZm9ybWF0LXdpdGgtYXV0b2luY3JlbWVudGFsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

8 years 8 months ago [\#288833](#288833) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Format order number format and invoice number format with autoincremental](/forum/35-orders-management/893955-format-order-number-format-and-invoice-number-format-with-autoincremental#288833 "-- HikaShop version -- : 3.3.0 -- Joomla version -- : 3.8.1  Hi,  I'm adjusting the format for &quot;Order number format&quot; and &quot;Invoice Number Format&quot;, and now I have something like that:  M{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for order number F{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for invoice number  But that's not what I need. I need the &quot;id&quot; to be an autoincremental number (begining with 1) that every year resets.  For example, if in 2018 we have 300 orders, the last format it would be &quot;M180300&quot; and the next year it will begin with &quot;M190001&quot;.  I'm doing it in the Hikashop configuration options -&gt; Main -&gt; order.  How can I do this?  Thanks in advance.  -- Victor")*

Hi,

For the invoice number, it's configured properly to do that.
So you should already have the invoice number reset like you want at each new year.
However, there is no such capability for the order number. The order number is based on the order_id which is incremented automatically by MySQL when it adds a new entry in the hikashop_order table. There is no way to reset that number every year besides deleting all the orders and resetting the auto_increment of the MySQL table, which is probably not something you'll want to do.
In that case, the only solution would be to develop a plugin and implement the onBeforeOrderNumberGenerate(&amp;$data, &amp;$result) trigger and set the order number you want in order $result variable based on the data of the order in $data. And for that, you would have to create a custom order field to store the increment, updating it manually yourself in your plugin, and reseting it when necessary yourself in your plugin.

The following user(s) said Thank You: [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mzk1NS1mb3JtYXQtb3JkZXItbnVtYmVyLWZvcm1hdC1hbmQtaW52b2ljZS1udW1iZXItZm9ybWF0LXdpdGgtYXV0b2luY3JlbWVudGFsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

8 years 8 months ago [\#288898](#288898) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  Replied by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")* on topic *[Format order number format and invoice number format with autoincremental](/forum/35-orders-management/893955-format-order-number-format-and-invoice-number-format-with-autoincremental#288898 "-- HikaShop version -- : 3.3.0 -- Joomla version -- : 3.8.1  Hi,  I'm adjusting the format for &quot;Order number format&quot; and &quot;Invoice Number Format&quot;, and now I have something like that:  M{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for order number F{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for invoice number  But that's not what I need. I need the &quot;id&quot; to be an autoincremental number (begining with 1) that every year resets.  For example, if in 2018 we have 300 orders, the last format it would be &quot;M180300&quot; and the next year it will begin with &quot;M190001&quot;.  I'm doing it in the Hikashop configuration options -&gt; Main -&gt; order.  How can I do this?  Thanks in advance.  -- Victor")*

Hi again,

So, there's no token besides id to count numbers periodically, like {COUNT} or {AUTOINCREMENTAL} or something like that?

Thanks in advance, and thanks for the idea.

--
Victor

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mzk1NS1mb3JtYXQtb3JkZXItbnVtYmVyLWZvcm1hdC1hbmQtaW52b2ljZS1udW1iZXItZm9ybWF0LXdpdGgtYXV0b2luY3JlbWVudGFsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

8 years 8 months ago [\#288900](#288900) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Format order number format and invoice number format with autoincremental](/forum/35-orders-management/893955-format-order-number-format-and-invoice-number-format-with-autoincremental#288900 "-- HikaShop version -- : 3.3.0 -- Joomla version -- : 3.8.1  Hi,  I'm adjusting the format for &quot;Order number format&quot; and &quot;Invoice Number Format&quot;, and now I have something like that:  M{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for order number F{date format=&quot;y&quot;}{id size=&quot;4&quot;} -&gt; for invoice number  But that's not what I need. I need the &quot;id&quot; to be an autoincremental number (begining with 1) that every year resets.  For example, if in 2018 we have 300 orders, the last format it would be &quot;M180300&quot; and the next year it will begin with &quot;M190001&quot;.  I'm doing it in the Hikashop configuration options -&gt; Main -&gt; order.  How can I do this?  Thanks in advance.  -- Victor")*

Hi,

No, there is no other tag for that. The system bases itself on the order_id and order_invoice_id columns of the hikashop_order table.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5Mzk1NS1mb3JtYXQtb3JkZXItbnVtYmVyLWZvcm1hdC1hbmQtaW52b2ljZS1udW1iZXItZm9ybWF0LXdpdGgtYXV0b2luY3JlbWVudGFsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.062 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
