Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order number improvement


Guest

Recommended Posts

Greeting friends!

 

Can someone give me a push in my issue.

 

So my government asks for order numbers to like this: Order# ABC-000001, but as you know they start just Order# 1 and so on!

 

How can i improve this number for my country?

Can some one help or point me to some thread?

 

This would be the end result:

 

ABC-000001

ABC-000002

ABC-000003

ABC-000004

...

ABC-000190

 

 

Thanks!

Link to comment
Share on other sites

It will depend on whether the alpha characters are a constant or will they change, and why?

 

Alpha chars are constant, ABC is an example (actually my chars are CVR example of order number: CVR-000123): only what will change, will be this six numbers: 000001

 

 

Is it possible?

Link to comment
Share on other sites

Alpha chars are constant, ABC is an example (actually my chars are CVR example of order number: CVR-000123): only what will change, will be this six numbers: 000001

 

 

Is it possible?

Then simply add the "CVR-" as a constant on the form, and change the printout of the invoice number to right justify in a field of 6 zeros. It's all in formatting the output on the form and nothing to do with storing the order number in the db.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Then simply add the "CVR-" as a constant on the form, and change the printout of the invoice number to right justify in a field of 6 zeros. It's all in formatting the output on the form and nothing to do with storing the order number in the db.

 

 

I just came up with the "CVR-", but i don`t really know how to add this 6 zeros (actually 5 zeros) to my invoice, so that after the number is reached CVR-000009 and the next order number will be CVR-000010, so that one zero disappears and 4 zeros are left, and so on that after the number reaches 100 order so that my number need to look like this - CVR-000100

 

is this possible?

 

And yes i have searched the internet and came up with this:

 

 

 

can this be possible to add something like this:

 

in checkout_process.php

 

$order_id=sprintf("%05d",$order_id);

 

before or after

 

$insert_id = tep_db_insert_id();

 

or modify code to make it work, so that the DB entry look like this 000001 and 000010 etc.

 

 

Is it possible to add maximum value in -> table order -> row order_id of 999999 by changing Type int(11) to Type int(6)?

 

p.s. i found THIS contribution what can help me, only i need to modify it a little bit ;)

p.s.s. but please at least answer me about maximum value

 

 

Thanks

Link to comment
Share on other sites

I just came up with the "CVR-", but i don`t really know how to add this 6 zeros (actually 5 zeros) to my invoice, so that after the number is reached CVR-000009 and the next order number will be CVR-000010, so that one zero disappears and 4 zeros are left, and so on that after the number reaches 100 order so that my number need to look like this - CVR-000100

 

is this possible?

 

And yes i have searched the internet and came up with this:

 

 

 

can this be possible to add something like this:

 

in checkout_process.php

 

$order_id=sprintf("%05d",$order_id);

 

before or after

 

$insert_id = tep_db_insert_id();

 

or modify code to make it work, so that the DB entry look like this 000001 and 000010 etc.

 

 

Is it possible to add maximum value in -> table order -> row order_id of 999999 by changing Type int(11) to Type int(6)?

 

p.s. i found THIS contribution what can help me, only i need to modify it a little bit ;)

p.s.s. but please at least answer me about maximum value

 

 

Thanks

You're trying to manipulate the DB and you really don't know what the ramifications of that is going to be. neither do I... what I am suggesting is that you only need to format how the number is printed on the page. And since a default osC does not even print the order numbers on anything I question where you want to put it. But here goes...

 

Open up /catalog/admin/orders.php (or invoice.php or packing_slip.php) and find where you want the order number to appear. Probably as a new row in a table.

 

<tr>
 <td class="main" align="center"><b>Order Number: <?php echo "CVR-" . str_pad($oID = tep_db_prepare_input($HTTP_GET_VARS['oID']), 6, "0", STR_PAD_LEFT); ?></b></td>
</tr>

 

I wouldn't mess with the db except maybe to set a new starting order number.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

You're trying to manipulate the DB and you really don't know what the ramifications of that is going to be. neither do I... what I am suggesting is that you only need to format how the number is printed on the page. And since a default osC does not even print the order numbers on anything I question where you want to put it. But here goes...

 

Open up /catalog/admin/orders.php (or invoice.php or packing_slip.php) and find where you want the order number to appear. Probably as a new row in a table.

 

<tr>
 <td class="main" align="center"><b>Order Number: <?php echo "CVR-" . str_pad($oID = tep_db_prepare_input($HTTP_GET_VARS['oID']), 6, "0", STR_PAD_LEFT); ?></b></td>
</tr>

 

I wouldn't mess with the db except maybe to set a new starting order number.

 

 

Thanks a lot, this is what i was looking for!

 

This is great!

 

<tr>
 <td class="main" align="center"><b>Order Number: <?php echo "CVR-" . str_pad($oID = tep_db_prepare_input($HTTP_GET_VARS['oID']), 6, "0", STR_PAD_LEFT); ?></b></td>
</tr>

 

 

But how about maximum value in order_id for order numbers?

 

Now it`s up to 11 chars "numbers" in order_id table, so that means - my order number will reach up to 99999999999

the question is: If i change int(11) to int(6) this will work for 999999?

Link to comment
Share on other sites

Actually!

 

i have a small problem!

 

i`m using THIS contribution to spice up my invoices, and the problem is

 

it dose not shows the invoice number in invoice that is sent to clinet...

 

Working version:

 

CVR-<?php echo $oID; ?>

 

Not working version for sending e-mail:

<?php echo "CVR-" . str_pad($oID = tep_db_prepare_input($HTTP_GET_VARS[$oID]), 6, "0", STR_PAD_LEFT); ?>

 

 

all otherwise is working, client can print his order in his account and the invoice is generated with correct invoice number CVR-000012

 

but in e-mail`s i get CVR-000000

 

Help?

Link to comment
Share on other sites

Actually!

 

i have a small problem!

 

i`m using THIS contribution to spice up my invoices, and the problem is

 

it dose not shows the invoice number in invoice that is sent to clinet...

 

Working version:

 

CVR-<?php echo $oID; ?>

 

Not working version for sending e-mail:

<?php echo "CVR-" . str_pad($oID = tep_db_prepare_input($HTTP_GET_VARS[$oID]), 6, "0", STR_PAD_LEFT); ?>

 

 

all otherwise is working, client can print his order in his account and the invoice is generated with correct invoice number CVR-000012

 

but in e-mail`s i get CVR-000000

 

Help?

If this works...

CVR-<?php echo $oID; ?>

change this to

CVR-<?php echo str_pad($oID,6,"0",STR_PAD_LEFT); ?>

 

If you ever need a 7th or more characters, change it to

CVR-<?php echo str_pad($oID,7,"0",STR_PAD_LEFT); ?>

 

I don't know where the email get's it's information.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

If this works...

CVR-<?php echo $oID; ?>

change this to

CVR-<?php echo str_pad($oID,6,"0",STR_PAD_LEFT); ?>

 

If you ever need a 7th or more characters, change it to

CVR-<?php echo str_pad($oID,7,"0",STR_PAD_LEFT); ?>

 

I don't know where the email get's it's information.

 

 

HUGE thank you - mdtaylorlrim!

 

I think this is solved for me, and hope some else can use this!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...