Post by jirkaA » Mon Mar 31, 2008 11:08 pm

Hi all,

have someone idea how to replace this strange long random number reference of order by order_id in e-mails, invoices etc..?

thank you, Jiri

Newbie

Posts

Joined
Mon Mar 24, 2008 8:10 pm

Post by jirkaA » Mon Mar 31, 2008 11:33 pm

:-[  little bit screwing my head about this problem and see, that it is not so easy, because value of order_id arise after confirmation of order (in /library/cart/order.php, function process). It's logical, because there can't be continuous line of reference IDs, in situations where meets more than one customer at time, some of them can confirm their order, some not.. But I would like to use order_id instead of reference in confirmation e-mail to customer and in invoice page.. Simply too complex reference id cannot be used as variable symbol for bank transfer and my accountant will loose his hairs when he will must pair payments with orders with this kind of ID...
Sorry for wasting this forum with my brainstorm, but maybe someone come upon a solution..

Newbie

Posts

Joined
Mon Mar 24, 2008 8:10 pm

Post by bruce » Tue Apr 01, 2008 9:57 am

If you have a look here

Code: Select all

http://forum.opencart.com/index.php/topic,875.0.html
you will see how I make the reference values unique instead of just random. You could use this as a basis for what you want to do by putting your own logic in the function getNewReference() and you will not have to change code anywhere else in OpenCart.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by jirkaA » Wed Apr 02, 2008 5:46 pm

Thank You Bruce.

I solve it partially by modification of reference string creation, converting unique value to decadic and use 8 left chars. I guess that it is enough for order reference, because i have not heavy traffic in my shop and possibility that two orders got the same reference is very low.

Code: Select all

          $random    = hexdec(uniqid ());		
          $reference  = substr((sprintf("%013d",$random)),5,8);

Newbie

Posts

Joined
Mon Mar 24, 2008 8:10 pm

Post by bruce » Wed Apr 02, 2008 6:28 pm

Yes, the possibility of duplicates is low, but the impact of duplicates is high. That is why you should create a solution that guarantees a unique reference.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm
Who is online

Users browsing this forum: No registered users and 1 guest