Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to start order number as B1000 ?? Important


masterT

Recommended Posts

Posted

Hi,

 

havent found anything for that. I know how to for example start from 1000 but how do i start from B1000 and auto increment ?? I tried to change in the sql databse but couldt figure it out

 

thanx for any help

Posted

Well, first of all you are not going to be able to auto increment a character sting in nySQL.

 

You can start it off at 1000, though.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

yes, it is possible to hardcode the B in front of the id key, but not in the database.

 

In the database, you can only autoincrement an integer.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

You can have an additional field that is a concatenation of "B" + the id_key, and then display the contents of this field insted of the key field.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

That depends on where you want to display it at.

 

If you mean you would like to display the "B" in front of the key value in every place that the key value is normally displayed, then I think you are talking about quite a bit of work.

 

If you just need it in the invoice, or in one place, then it can be easily achieved.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

well i would like to have it in the invoice as well as in the database ... but since ur saying that is not possible to save it to the database right ?

 

well what i also want to know is how to change the appearance of the invoice i openend a thread for that too,

 

if you can help me with these 2 problems i would really appreciate it very much.

 

i have several more to go but i wanna fix one problem after another

 

THANK YOU SO MUCH ALREADY

Posted
since ur saying that is not possible to save it to the database right ?

 

No exactly. It is not possible to have a character in the key field that is auto incremented. There are 2 ways to get around this.

 

- Hard code the "B" into the display in the invoice.php.

- Create a new colum that is a concatenation fo the "B" and the key field. display this field instead of the key field.

 

Neither one of these solutions is going to be a good idea for a beginner at SQL or php.

 

I'm sorry that I don't have the time to fix this for you.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

well thanx for your fast reply. no problem maybe i will fix this sometime later when im more familiar with ph and sql ...

 

 

maybe u can give me a hand on altering the invoice the way i want it to look. thanx

Posted

Once again, I am sorry, however, the invoice.php is rather independant of the rest of the cart.

 

You can, in fact make little test changes here and there without worrying too much about screwing everything up.

 

This is exactly how I learned php and HTML. I'm sure that if you invested some time into it, you could figure it out.

 

If you have a specific question about a specific line or 2 of code, I'm sure we'd all be happy to help you about.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

  • 2 weeks later...
Posted
Well, first of all you are not going to be able to auto increment a character sting in nySQL.

 

You can start it off at 1000, though.

 

How?? I have been trying to do this for a while!

Drive it like you stole it.

Posted

First, you need to download and install phpmyadmin.

 

Respond here when you have done that.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

I have phpmyadmin. I am pretty familiar with how to get in and out of tables, just not familiar with the commands.

Drive it like you stole it.

Posted

Ok, here goes.

 

click on table "orders"

click browse

Click on orders_id to sort ascending

Click again on orders_id to sort decending

Note the number in the top position

 

Click on SQL

 

Enter the following, on at a time

 

UPDATE

orders

SET

order_id = 1000

WHERE

order_id = <the order number you noted>

 

UPDATE

orders_products

SET

order_id = 1000

WHERE

order_id = <the order number you noted>

 

UPDATE

orders_products_attributes

SET

order_id = 1000

WHERE

order_id = <the order number you noted>

 

UPDATE

orders_products_attributes

SET

order_id = 1000

WHERE

order_id = <the order number you noted>

 

UPDATE

orders_products_download

SET

order_id = 1000

WHERE

order_id = <the order number you noted>

 

UPDATE

orders_total

SET

order_id = 1000

WHERE

order_id = <the order number you noted>

 

UPDATE

orders_status_history

SET

order_id = 1000

WHERE

order_id = <the order number you noted>

 

I don't remember off the top of my head if MySQL likes go's , so its best to enter these 1 at a time.

 

 

[/code]

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

Thank you! I will try that and tell you how it goes. Do I need a ";" at the end of each of these statements?

Drive it like you stole it.

Posted
Hi,

 

havent found anything for that. I know how to for example start from 1000 but how do i start from B1000 and auto increment ?? I tried to change in the sql databse but couldt figure it out

 

thanx for any help

If you want to show the order number on the invoice look at this thread the answer was posted by Ajeh, Linda McGrath

 

http://www.www.oscommerce.com/forums/viewtopic...3683&highlight=

 

If you want to start the order numbers with a B find this line (from the code in the above thread)

<td class="main"><?php echo tep_db_input($oID); ?></td>

and change it like this

<td class="main">B<?php echo tep_db_input($oID); ?></td>

Best wishes

Steve

Posted

Worked great! Thanks, wizardsandwars.

 

For anyone else who attempts this, there is a missing "s" in all the "order_id"...should be "orders_id".

Drive it like you stole it.

Archived

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

×
×
  • Create New...