Jump to content

Where is order number generated?


Guest

Recommended Posts

Because I use the same mals-e.com secure cart to gather my credit card info, I prefix the order numbers with the initials of my store (MC for MysticConvergence.com, GP for Gothicplus.com etc). I haven't been able to find where the order numbers are generated in CC3. Any one have an idea?

Link to comment
Share on other sites

Hello Mysty. The order is generated in the order section of administration. Click on the orders and you will see all of the orders made with generated numbers next to the order.

Go to administration and scroll down until you get to Customers. The links will appear as below.

Customers

View Customers

Email Customers

Orders

Link to comment
Share on other sites

Yes, I know where the orders display, what I meant was where in the php codes is the order number generated now?

I change the order number scheme to include my shop initials and shorten the number (I have 7 websites sending orders to Mals-e.com so need to know which store the order is from). I knew where it was in v2x but cannot find it in v3.

Link to comment
Share on other sites

Yeah, that was MY problem! I *swear* I looked in almost every file - though never thought it might be in the gateway stuff! I thought it was generated before that step :)

Thanks Booker!

For anyone else that wants to change the number, it's about line 60. I increased the random part to 9 digits and removed the second section in the date line. I also added "LB." before the "date(" section to put my store initials in the order # for mals. :)

Link to comment
Share on other sites

  • 4 weeks later...
Guest canda

Thanks for your information.

Btw, just wondering if you are still using random number to generate the order no. coz I think that not unique enough, that's still possible to have repeating number.

so if without the date & time stamp, it's very confuse. do you have a better idea on this to share?

Link to comment
Share on other sites

  • 2 months later...

I increased the number of digits in the random area which increases the odds of it repeating. I also left the day & month....

  $cart_order_id = "CD-".date("md-").rand(10000000,99999999);

Is my line in CrossdressFashions (what the CD stands for) :whistle:

Link to comment
Share on other sites

Why remove the time portion from the number? The current format is the day "YYMMDD" followed by the time "HHMMSS" (in 24 hour format) followed by a random 4 digit number. As I've explored in another post, it is impossible to get two duplicate cart numbers in this method. The other benefit is that you can look at an order number and know exactly when it was placed also. Now your method does not give any indication of the order time. I can completely understand prefixing with a store code, but you can safely decrease back down to 4 random digits and put the time back in. The code was generated that way for a reason after all. :w00t:

Link to comment
Share on other sites

  • 2 weeks later...

I increased the number of digits in the random area which increases the odds of it repeating. I also left the day & month....

  $cart_order_id = "CD-".date("md-").rand(10000000,99999999);

Is there a way to get the random number to be an incremental number? ;)

Link to comment
Share on other sites

  • 5 months later...

OK I officially hate these crazy order numbers (sorry!).

I really want to try for something a bit less insane. Like normal incremental order numbers. I know there must be a way to make this work without running the risk of overwriting an order, and gawdammit I'm gonna find it.

So what do people think about this idea? We count the orders in the database, add one (plus 100 or whatever we want to be our smallest order number), and then append the time and random code to it in parenthesis. Now here's the part that's different: We don't show that crazy stuff in parenthesis to customers (it will scare them; it scares me) It's there to guarantee uniqueness, but we can split the string at the first paren and lop off the gobbledygook.

Any reason why this wouldn't work? The only thing I can think of is that it's possible for the same customer to get multiple orders that seem to have the same number if they click repeatedly. But in that case this really would be a duplicate order, so we'd want to deal with that anyway, no?

Here's some same code I just threw together which will create order numbers like I've described:

$order_numbers = mysql_query("SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum") or die ("ERROR " . mysql_error());

$count_orders = mysql_num_rows($order_numbers);

$order_count = $count_orders + 100;  // add 100 to total so all orders are at least three digits

$cart_order_id = $order_count + 1;   // add one to the total

$cart_order_id .= ' ('.date("ymd-His-").rand(1000,9999).')'; // adds date, time, and random number to end just in case of duplicates

Comments? Suggestions? Warnings?

Hmm...

Now that I think about it a count of orders is not the best approach... If you delete some orders, your order numbers will regress also. Seems like we need a real autoincrement value (easy enough to add as a next order number setting, no?).

That would be a much quicker query also (although it would require an update as well).

Link to comment
Share on other sites

  • 1 month later...
Guest Per Øyvind Kindem

I've implemented this, but only the number-part, not the date and time.

In my shop the orders are not to be deleted, because the customer must have access to old orders/history at hte customer pages in the shop. I only change the status to completed when it is shipped to the customer.

I then use the order as the invoice, and the "print packing slip" are changed to "print invoice copy" in the shop.

Some mod's to the print.php are neededhere in norway in order to make the invoice-copy(Packing slip) meet the demands of the book-keeping laws in norway!

;-)

Link to comment
Share on other sites

Guest Brivtech

I can see what you guys are on about here - Random numbers are all very well, fair enough they include the date, but if you're trying to transfer those numbers into an accounts package for instance, not having a consecutive numbering format can give an accounting nightmare having to go through them all trying to figure out which order was placed when.

Perhaps CubeCart could provide 2 options for numbering like this:-

__ Consecutive __ Random

... where the user can select 1 or both (To combine consecutive and random as a prefix and suffix respectively)

> Here's a further suggestion: I'd prefer to see a consecutive numbering system with a check digit - Like bar codes use. This could follow a conventional bar codeing system, and be used in a warehouse when picking goods using a light-pen or portable scanner linked to a portable system.

just because CuebCart is desgned for the internet, doesn't mean it has to stay that way

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...