Best way to generate order numbers for an online store?

Every order in my online store (lil peep crop-top) has a user-facing order number. I'm wondering the best way to generate them. Criteria include:

  • Short
  • Easy to say over the phone (e.g., "m" and "n" are ambiguous)
  • Unique Checksum (overkill? Useful?)

Doesn't reveal how many total orders there have been (a customer might find it unnerving to make your 3rd order) Right now I'm using the following method (no checksum):

Right now I'm using the following method (no checksum):

def generate_number                
    possible_values = 'abfhijlqrstuxy'.upcase.split('') | '123456789'.split('')

    record = true
    while record
        random = Array.new(5){possible_values[rand(possible_values.size)]}.join
        record = Order.find(:first, :conditions => ["number = ?", random])
    end          
    self.number = random
end
0
6 comments

I was looking for the same issue for my site can anyone help me out. 

0

Thanks so much for sharing this. Actually, I was looking for this solution and this would help me a lot. Hats off to you.

0

Thank you so much for sharing that useful information. It will help me a lot.

0

This will help a lot to me and others who's been facing this issue. You did great work

0

I appreciate you sharing this. In fact, I was looking for a solution here, and this would be very helpful. You deserve a round of applause.

 
0

Hello Guys,

I have my own e commerce website Giftblooms, so basically I want to automate some kind of stuff like is there any plugin for upload Products in bulk? As well if 1 step ahead also want to vendor management plugin if available?

Thank you.

1

Please sign in to leave a comment.