Post by designbuyers » Sun May 15, 2011 3:45 am

How to make order number not according to how much orders has been placed ?

Something like 846744659304

or 507883203815

OpenCart :
The best Open Source Cart for eCommerce


User avatar
Active Member

Posts

Joined
Tue Nov 09, 2010 4:25 pm

Post by Qphoria » Sun May 15, 2011 3:59 am

Can't really be done that way as random numbers could potentially hit twice and you'd have a conflict there. You can set it to start really high like "55255789" and then it would start incrementing by 1 from there

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by designbuyers » Sun May 15, 2011 4:11 am

I do not want customers to know how many orders store getting.

OpenCart :
The best Open Source Cart for eCommerce


User avatar
Active Member

Posts

Joined
Tue Nov 09, 2010 4:25 pm

Post by Qphoria » Sun May 15, 2011 5:53 am

designbuyers wrote:I do not want customers to know how many orders store getting.
Thats fine but they don't know that anyway

If your order number is 12545252 they don't know if you got 12 million orders or if there is some code involved

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by grgr » Sun May 15, 2011 5:17 pm

Not entirely true, if they order again next week and the order number has gone up by 3 then it is quite obvious how may orders the store is getting.

A solution is to use a function of the date appended with the number of orders for that day. Something that i've started to look at but being completely rubbish at programming it's taking a while!

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by Qphoria » Sun May 15, 2011 11:52 pm

grgr wrote:Not entirely true, if they order again next week and the order number has gone up by 3 then it is quite obvious how may orders the store is getting.

A solution is to use a function of the date appended with the number of orders for that day. Something that i've started to look at but being completely rubbish at programming it's taking a while!
Sure, but why do you think people care?
And if it is random, and they see order "12405" and then the next week they get random again and its coincidentally "14052" then they assume the count. Then they could get "12301" after that... but who cares?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by imadam » Mon May 16, 2011 2:54 am

i can understand this issue. if you're trying to give a proffesional image of a site that sells more then it does you don't want the customer to order to see an invoice of 12223 then 12224 then 12225 then perhaps you get a couple more then them again so 12229 etc. doesn't look too good and may put doubt into the customers minds about your store.

the issue with random order numbers is at the end of it all when you try to organise your orders the numbers will be so random you wont know if you've missed one out.

i'd say best solution would be to edit the script so it increments in 10 or even better maybe 12 as then the customer will never know how many actual orders you're getting.

my opencart carpet cleaning woking guildford and Office Cleaning Services in Guildford


Active Member

Posts

Joined
Sun Jan 10, 2010 10:47 pm
Location - Surrey

Post by Havlock » Wed May 18, 2011 5:49 am

Was an answer that worked ever provided for this question?

This is exactly the same issue we are facing. We want the order number to be able to increase by a value greater than 1 each time an order is placed. This is especially true for when you are starting out and you have few customers, you want to make sure that the same customer does not get consecutive order numbers if no one else has purchased from your shop since.

So if a customer places 3 orders in a week and is the only customer that week, we do not want them to get order numbers 1, 2 and 3, but instead would rather them get orders 1, 5 and 10.

Can someone tell me how and where the next order number is created by the system? Is this something in the code that tells it to increment the next order number by 1?

Thanks
Joey

New member

Posts

Joined
Sun Oct 24, 2010 8:39 am

Post by fabioDexus » Wed May 18, 2011 6:18 am

I would strongly advise to NOT mess with the order number but instead create a new unique number that you show to the clients.
I guess that the order number is created by the auto increment table and the file that basically handle that is:
ModelCheckoutOrder em catalog/model/checkout/order.php , DON'T change the core files, instead create a new one that suit your needs

New member

Posts

Joined
Fri May 13, 2011 5:53 am

Post by Havlock » Wed May 18, 2011 7:18 am

I am not sure what you mean fabioDexus... What do you mean create a new one? Create a new what?

We just want the order number to increment by a number other than 1 when a new order number is needed. If order number 12 was the last one created, rather than the next one being order number 13, we would like it to be 18 for example. We would like the order number increment to increase by 5 say, instead of 1. So if a person places 2 orders back to back, the order numbers would not be consecutive.

How else would we create a unique number to show to clients. The system does that itself when the order is placed.

Is there code somewhere that looks at the database, gets the last order number and then adds +1 to it to get the next order number? If so, we just want to make that code add +5 (or some other number) instead of +1.

Thanks
Joey

New member

Posts

Joined
Sun Oct 24, 2010 8:39 am

Post by fabioDexus » Wed May 18, 2011 8:20 am

Havlock, what you would do is make a new checkout and implement a new payment method that uses it i guess.
The part of code you are looking for is in the file that i said in the previous post in the create method.

New member

Posts

Joined
Fri May 13, 2011 5:53 am

Post by Havlock » Wed May 18, 2011 8:44 am

Thanks for the reply fabioDexus...I am not sure how to implement what you are talking re a new checkout, but all I really want to know is where in the code is the part that adds +1 to the new order number as I cannot seem to locate it in the code.

Basically I want the order numbers moving forward to jump by a value of +5, so if my latest order number is 101, then the next one would be 106, then 111, then 116, etc, instead of just incrementing by 1 each time.

Thanks
Joey

New member

Posts

Joined
Sun Oct 24, 2010 8:39 am

Post by fabioDexus » Wed May 18, 2011 9:01 am

I would strongly advise against modifying code in the source but if you want do that in "the wrong way" just change the create method in ModelCheckoutOrder in line 70 (the insert SQL part) to add the order_id as the max order you got+5.
If you do so i would say to use a table lock to avoid colisions, but in my opnion it will have the following consequences:
-Break of compatibility with newer versions
-If you use the lock it can make the store a little slower since when other querys try to write the data it would be locked.

The increment part that you are looking for is made at the data base side by an auto increment field.

I would advise to see how to create a module,payment method etcetera and try to make the checkout method that you want

New member

Posts

Joined
Fri May 13, 2011 5:53 am

Post by Havlock » Wed May 18, 2011 9:11 am

Thanks for the info again fabioDexus.

Maybe I am just not understanding, but why would I have to do any of the extra steps if I just want to change the increment from +1 to +5 on the order number? I want everything to work exactly the same as it does now, just when it assigns a new order number I want it to increment by +5 instead of +1.

I did not see in the code you are talking about where it is currently adding +1 to the order number, so I can change it to +5.

Ideally I would like to approach it in the simpliest way so that for future upgrades I can make the simple change as well.

I certainly dont want to have to create an entirely new module and payment method to accomplish the task.

Currently we just sign into the shop and place 5 new orders and then delete them to increase the order number and are looking for a way to avoid having to create these unnecessary orders just to increase the order number for the next real order.

Our shop is not a high traffic shop, we might get 10-15 people a day browsing and might do 10 orders a week. We have several folks that shop a couple of times a week and we dont want them to get consecutive order numbers if no one else has shopped since their last time.

Thanks
Joey

New member

Posts

Joined
Sun Oct 24, 2010 8:39 am

Post by Qphoria » Wed May 18, 2011 9:16 am

The database handles the autoincrementing to ensure that there are no duplicates. Plus the way the opencart order system works, everytime the confirm page loads, a new order id is generated.. just by natural use, it is highly unlikely any 2 order ids will be sequential. Still, to think it is more professional or that your store is that important that anyone cares is foolish. I can see maybe not started at 1. But when your order is 1415155... I dont care if my customer breaks the code that the next number is 1415156. Was there some secret of life unlocked there? Will the earth crumble to dust? Worry about making money instead :) You are entrepreneurs, not bean counters.

Or use some prefix smoke and mirrors. Most of the time customers only see the order id in the email or on their account history. So just add some random crap like ZXBWT-14- to the front of the real order id. oooh! how professional they will all say ::)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Havlock » Wed May 18, 2011 9:43 am

Qphoria,

I dont think you are understanding our need, but I could be wrong.

If a customer of mine places an order today that is order number 101 and then comes back and places another order in 5 days and gets order number 102 (because there have been no other orders), then it may look to my customer that I am not doing a lot of business, which might be true, but I do not want my customer to know that.

If however my customer places an order today that is order 101 and then comes back in 5 days and gets order number 106, then that customer will think that at least 5 other orders have been placed since his last order, even if his previous order was/is the last actual order placed.

This is what I am trying to avoid. I would like to eliminate any possible questions of my customer as to how many orders I am actually doing, so if there is always a jump in the order number of at least 5 from one to the next, it will always appear to my customer that there have been at least 5 orders since his last, even if he was the last customer.

This is what I am trying to accomplish. I am operating numerous stores for various artists who do not move a lot of product from their shops and do not want to have to go to each shop after an order has been placed and create 'fake orders' to effectively bump up the order number just in case the same customer comes back to place an order before someone else does.

It is definitely something that a shop owner would notice, as well as his customers, if the shop does not process a lot of orders over the course of time, but instead have a few customers that come back often to purchase from the shop. The need is to not have any customer ever get 2 consecutive order numbers from the shop, ever, even if that customer actually placed the last two orders.

All I am trying to find is where in the code is it that it adds +1 to the next order number before assigning it or writing it to the database. I would just like to have it add +5 instead of +1

Thanks
Joey

New member

Posts

Joined
Sun Oct 24, 2010 8:39 am

Post by fabioDexus » Wed May 18, 2011 9:52 am

Havlock
The code doesn't add a +1 the database add this.
Since this number is used in a lot of places i don't think you should change it, but if you want to change it it is addeed in the line 70 of that file.
But a more interesting aproach that Qphoria said was just mask the number to the client.
I am new to opencart and in a phase of development of other part so i don't know where are these interactions but simply changing them should solve your issue.
It will require a little coding but i think would be the "right way".

New member

Posts

Joined
Fri May 13, 2011 5:53 am

Post by Havlock » Wed May 18, 2011 9:57 am

fabioDexus,
I am not sure what you mean to mask this to the customer.

When an order is placed, an email is sent to the customer with the order number on it. Where we would have the opportunity to mask is I am unaware. Also, a mask as described would basically just be a bunch of characters surrounding the actual order number, but would yet still be a sequential number. We want that number to be sequential, just not by +1, but instead by +5 (or some other value).

We do not need the order number masked really, we really just need the increment of the order number to increase by a value that is more than +1, which is somehow what the system is doing now.

I assume that somewhere in the system, whether it be code or a database entry somewhere, that it is looking at the last order number used, and then adding +1 to that number and then storing the new number as the new order number.

Otherwise, how else would the new order number be calculated?
Somewhere the system must be finding a order number (last one), adding +1 to it and making that the new order number, correct?

New member

Posts

Joined
Sun Oct 24, 2010 8:39 am

Post by traceofwind » Wed May 18, 2011 10:08 am

MySql can not auto increment more than 1. There are other databases that allow 'sequences', but in this case MySql can not provide you with a simple solution.

If you are really, really conscientious... each week go and create x orders with your own account (use cash on delivery, so you don't pay with credit card) and then cancel them. That will bump up your order ID -without any code changes! ;)

EDIT: I am sure a MySql/CRON expert could make you an automated script to do that for you... which would be: add xx blank records to [order] table and then delete them (or not, whatever). Manual or automated, either way you are still pumping out genuine order codes without masks and prefixes without algorithms and code implementations. And when sales volume increases, you can stop propping up the order_ID.
Last edited by traceofwind on Wed May 18, 2011 10:15 am, edited 1 time in total.

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am

Post by fabioDexus » Wed May 18, 2011 10:12 am

The Databse have an autoincrement value so it does the +1 there,almost every Data Base System have it, you are probably using MySql. You can mask in a number of ways you can send ANOTHER number and relate this to the order etcetera. But a little coding will be required nevertheless.
The reference to the part where you can find the +1 is found here http://dev.mysql.com/doc/refman/5.1/en/ ... ement.html , i don't know if mysql can be set to change the auto increment to anything but one but if does the documentation should cover it

New member

Posts

Joined
Fri May 13, 2011 5:53 am
Who is online

Users browsing this forum: No registered users and 128 guests