Feature request: use random order number

Phoca Cart - complex e-commerce extension
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 50
Joined: 14 Nov 2022, 12:04

Feature request: use random order number

Post by keep2000 »

If I see it correctly, Phoca Cart can use the following fields when generating the order number: {prefix}{year}{month}{day}{orderid}{suffix}. To make it unique, the {orderid} field must be included, but this means that visitors can see approximately how many orders the online store has.
Is it possible to have a randomly generated character set of a specified length as the order identifier? For example, A5HJ7K9L4P

Tags:
mino182
Phoca Professional
Phoca Professional
Posts: 188
Joined: 12 Feb 2015, 13:30

Re: Feature request: use random order number

Post by mino182 »

And when will he receive invoice? Invoice should have continuous numbering...
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 50
Joined: 14 Nov 2022, 12:04

Re: Feature request: use random order number

Post by keep2000 »

I'm new to Phoca Cart. I've built e-shops using several different ecommerce solutions, but none of my shops generate invoices. In our country, it's not possible to use a webshop-generated PDF as an invoice. Is invoice generation mandatory in Phoca Cart, or can I disable it?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48345
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Feature request: use random order number

Post by Jan »

Hi, invoice feature is here for users who want to use invoices in Phoca Cart. Usually, users create invoices in accounting software. It is just up to you if you will use the invoicing system in Phoca Cart or you just use the order id and create invoice in your accounting software. The invoice is generated dynamically so if you just don't create invoice and download it and use it, such just does not exist and nobody forces you to use invoicing in Phoca Cart.

Jan
If you find Phoca extensions useful, please support the project
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 50
Joined: 14 Nov 2022, 12:04

Re: Feature request: use random order number

Post by keep2000 »

Thanks, Jan. This is how I use it. Returning to the original question: is it possible to use a random string as the order number? I am assisting a client in migrating from another e-commerce system, and they previously used that logic. They have inquired if it's possible to implement the same approach here.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48345
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Feature request: use random order number

Post by Jan »

Hi, the order number is created by database - autoincrement feature, to avoid duplicates, so the only way will be to change the number function (function which produces order number from order ID):

administrator/components/com_phocacart/libraries/phocacart/order/order.php
public static function getOrderNumber($orderId, $date = false, $orderNumber = false, $orderNumberId = false)

Jan
If you find Phoca extensions useful, please support the project
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 50
Joined: 14 Nov 2022, 12:04

Re: Feature request: use random order number

Post by keep2000 »

"Hi, the order number is created by database - autoincrement feature, to avoid duplicates"
That is because the order number contains {orderid}. But the question is if it's possible for it not to contain it. Like the orderid is still from the database; it's autoincremental, but the order number could be a {randomstring} like A5HJ7K9L4P, with a simple check to see if it's already taken or not.
The question arises because this is how our current shop works, and the customer wants to have this feature. Because if the order number contains the orderid, then when I place an order now and place an order next week, I'll know how many orders were in between my two. The shop owner doesn't want to use this as public information :)
mino182
Phoca Professional
Phoca Professional
Posts: 188
Joined: 12 Feb 2015, 13:30

Re: Feature request: use random order number

Post by mino182 »

I understand, but can I have one question? It's usecase without payments? That customer, who make 2 orders, will not receive any invoice (from any source)?
keep2000
Phoca Enthusiast
Phoca Enthusiast
Posts: 50
Joined: 14 Nov 2022, 12:04

Re: Feature request: use random order number

Post by keep2000 »

Yes, they receive their invoice from a totally independent billing solution. Sometimes we use external_order_number in the billing software API as parameter for the billing, but it's not mandatory.
We never use the shop system's internal billing mechanism.
Also the invoice numbers must be incremental, but we issue the invoice when the order is shipped which is totally not the same as we received the orders, so the invoice number must generated from the billing software, not the ecommerce software. At least in Hungary :)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48345
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Feature request: use random order number

Post by Jan »

Hi, the questions:

- how to avoid possible duplicates with random number?
- the ID is still used in e.g. links, etc, so even if there is random number for order number (not order ID), there is still some chance, user can get the ID e.g. in links, etc. :idea:

there is no problem to add new variable {randomstring}, but the question still remains, how to prevent from possible duplicate?

Jan
If you find Phoca extensions useful, please support the project
Post Reply