Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order Number


Guest

Recommended Posts

Is it posibly to change or edit the Order number?

 

If it is posibly...how?

 

Sure - why would you want to ?

 

Use phpMyAdmin --> Orders table --> Browse --> Edit the record you want to change.

 

Or - use SQL in phpMyAdmin and run :

update orders set orders_id = <new number> where orders_id = <old number>

i.e. :

update orders set orders_id = 8888 where orders_id = 9999

 

david

Link to comment
Share on other sites

Don't do that.

 

Orders are in fact a number of tables and if you update the order number in one and not in the others you are breaking the link between them.

 

Better to tell us WHY you want to do it and then someone can advise you better

Link to comment
Share on other sites

Don't do that.

 

Orders are in fact a number of tables and if you update the order number in one and not in the others you are breaking the link between them.

 

Better to tell us WHY you want to do it and then someone can advise you better

 

Of course - but he simply asked if it is possbile. Of course it's possible - stupid but possible!!!

 

The tables should have a cascade effect anyway.

They do on the delete function - I've never tested the update function.

Link to comment
Share on other sites

I have yet to see a version of phpmyadmin that will delete all tables related to a table if you delete it.

 

It certainly does not update them.

 

This has nothing to do with phpMyAdmin - it has to do with how the SQL is formed when the tables are initially created.

And it doesn't delete tables - it deletes and updates related foreign_key records based on the primary key in the parent table.

 

If you create two tables using the CASCADE DELETE UPDATE parameters then all updates and deletes on a single primary key will also affect any related records in the child table(s)

 

For example :

 

CREATE TABLE parent {

id serial PRIMARY KEY UNIQUE,

first_name varchar(100)

}

 

CREATE TABLE child {

childone int,

childtwo int,

fk_childID int REFERENCES parent(id) ON UPDATE CASCADE ON DELETE CASCADE

}

 

 

Now to delete a record from the parent table, you run :

delete from parent where id = 9999

This command while also delete the related record in the child table.

 

Same goes if you run an update.

 

david

Link to comment
Share on other sites

Sure - why would you want to ?

 

david

 

Better to start with order no 1000 insted of 1...

 

What would you think if you bought anything from an internet site, and when you get your order confirmation is says order number 1003, nobody would even think of it...

But if it says... order numer 3, hmm...is this really a serious site? I am customer numer 3...!

 

Thats why... :-"

 

Also, it could be of use to be able to reset the order number to zero ( or 1000 ) at the 1st of january to start over?

 

But as what I understan there are no easy function for this?

Link to comment
Share on other sites

Better to start with order no 1000 insted of 1...

 

What would you think if you bought anything from an internet site, and when you get your order confirmation is says order number 1003, nobody would even think of it...

But if it says... order numer 3, hmm...is this really a serious site? I am customer numer 3...!

 

Thats why... :-"

 

Also, it could be of use to be able to reset the order number to zero ( or 1000 ) at the 1st of january to start over?

 

But as what I understan there are no easy function for this?

 

Well - I'm sorry to be blunt - but this is a really stupid idea.

If you expect your site to run automatically for years and years - then do not touch this primay key in this way.

 

If a user places an order, their automated email will have the link to their order.

If you change it on him and he goes to check the status of the order, it will be a dead link - and he'll not be happy.

If you choose to go through with this, then you wuold need to create a linked lookup table that would contain three columns - a primary key, the old id number and the new id number - and this table would need to be referenced every time anyone at any time pulls up an order - admin side or otherwise.

 

If you want to alter your table to have order id's start at 1000, then all you have to do is run this :

alter table orders auto_increment = 1000

 

As FlyingKites said to you earlier :

"Better to tell us WHY you want to do it and then someone can advise you better"

 

Your initial post should have read : How can I start my orders numbers at 1000 instead of 0 ?

 

Post what you want to *accomplish* - and you'll get better and more accurate responses.

 

david

Link to comment
Share on other sites

  • 1 month later...
Better to tell us WHY you want to do it and then someone can advise you better[/i]"

 

Your initial post should have read : How can I start my orders numbers at 1000 instead of 0 ?

Post what you want to *accomplish* - and you'll get better and more accurate responses.

 

david

 

Okay, Thank you...

 

I just want my webshop to start order number from 1000

alter table orders auto_increment = 1000 How and were can I do this?

 

The order number are now up at 34, will there be any problems if I change this now when the order number is already counting??

Do I need to set it to zero first or something???

Link to comment
Share on other sites

Better to tell us WHY you want to do it and then someone can advise you better[/i]"

 

Your initial post should have read : How can I start my orders numbers at 1000 instead of 0 ?

Post what you want to *accomplish* - and you'll get better and more accurate responses.

 

david

 

Okay, Thank you...

 

I just want my webshop to start order number from 1000

alter table orders auto_increment = 1000 How and were can I do this?

 

The order number are now up at 34, will there be any problems if I change this now when the order number is already counting??

Do I need to set it to zero first or something???

Link to comment
Share on other sites

Okay, Thank you...

 

I just want my webshop to start order number from 1000

alter table orders auto_increment = 1000 How and were can I do this?

 

The order number are now up at 34, will there be any problems if I change this now when the order number is already counting??

Do I need to set it to zero first or something???

 

 

You shouldn ot have to do anything excpet run this sql statement.

Login to your control panel with your host, find MySQL Databases, go into phpMyAdmin, select the SQL tab, dump this in there :

alter table orders auto_increment = 1000

and hit Go.

Link to comment
Share on other sites

You shouldn ot have to do anything excpet run this sql statement.

Login to your control panel with your host, find MySQL Databases, go into phpMyAdmin, select the SQL tab, dump this in there :

alter table orders auto_increment = 1000

and hit Go.

 

Thank you for a fast answer!

 

Okay... I understand how to do it...but.... is this safe? Would be a nightmare if something bad happened :'(

Link to comment
Share on other sites

  • 2 weeks later...

It is not working for me.... :'(

 

#1146 - Table 'space_webshop.osc_orders' doesn't exist

 

Why??

Link to comment
Share on other sites

Do anyone know why I get this error??

 

I wright exacley like this: alter table osc_orders auto_increment = 1000;

 

It says: #1146 - Table 'space_webshop.osc_orders' doesn't exist

 

Please...

Link to comment
Share on other sites

ALTER TABLE `orders` AUTO_INCREMENT =1000

 

Thank you!!

 

Do I wright excakley like this?

Is it important to use big/small letters?

 

ALTER TABLE `orders` AUTO_INCREMENT =1000

 

 

 

Just curious.... why does it say another way in the "tips and Tricks" ?

osc_orders

 

I am not very good at this, but like to learn!

 

Thanks in advance.

Link to comment
Share on other sites

  • 1 year later...

You place order by yourself.

Start phpMyAdmin

Click orders on left table name.

Chek last order number and then click Pen button.

Edit orders_id like 1000

 

Next order automatically count from 1001.

 

I did it, maybe it works for you too.

Is it posibly to change or edit the Order number?

 

If it is posibly...how?

Link to comment
Share on other sites

  • 1 year later...

Ok this is an old post, but also a bit confusing so just to clear it up:

In the oscommerce knowledge base (http://www.oscommerce.info/kb/31) they suggest to use this sql:

alter table osc_orders auto_increment = 1000;

And I assume that this is because at some point the database tabel name for orders was called "osc_orders". But if you as I use a newer version of oscommerce, then do the following.

 

To change the ordernumbers to start at any number you want (here 1500), run the following sql:

alter table orders auto_increment = 1500;

 

p.s. There is no danger in running the old sql even if you have the newer version of oscommerce. It will only give you an error.

 

Now I use this sql to change my order numbers every year, and if you do that, there is only one thing that you have to be careful about, and that is not to change it to a lower number. So if the last order number in your database is 2455, then do not change the order numbers to 2000, but to 3000 or something like this. I put the number of the year in front of my numbers, so every year I change the order number to 091000, 101000, 111000. If you have more than 8999 orders a year, then of course you have to set this number higher.

Link to comment
Share on other sites

Actually the article refers to the table as it exists in osC v3

 

Although I don't know that it says that anywhere.

 

But it is nice of you to post your findings.

 

I'm certain someone will read this and benefit from it.

:)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...