Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

HERE is how to change invoice numbering with MYSQL

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-04-2005, 03:08 PM
 
smitty smitty is offline
 

Member
  
Join Date: Mar 2005
Posts: 27
 

Default HERE is how to change invoice numbering with MYSQL

I was trying to find out how to change the invoice numbering. The data for invoice numbers is stored in your my sql database.

Unforch, all the posts on how to change the invoice numbering said to use phpMyAdmin. It's a great program, but installng it or figuring out how to use it can be as much work as making this change by telnetting in and making the change to mysql that way.

Soooooooo, I saved all my work on how to just telnet in and I'm sharing it with anyone who wants it.

This is how to change invoice numbering very easily. It assumes you know how to telnet into your host. If you don't know, I'm sure there is info in this forum.

BTW, I did this with fake orders during development so as to play it safe. And as always, when monkeying around, backup your mysql database in case something goes wrong.

--------------
Us the telnet program of your choice to connect to your web host. Log in. Once you are successfully logged in, you will access your mysql database via command-line prompts in telnet.

(letters in ALL CAPS below should be substituted with your own user info)

1. get into mysql
at the prompt, enter:

Code:
mysql -h HOSTNAME -u USERNAME -p

the shell will reply with

Code:
Enter password:

enter your password for your mysql database

the prompt will now look like this:

Code:
mysql>

you want to tell it which database to use, so enter the command

Code:
use YOURDATBASENAME;

All you want to do is change the number of the last (highest numbered) order in your system to whatever you want to start the invoice numbers at.
I didn't want them to read 1, 2, 3. I like to have them start at 50000, with the 5 representing 2005. In 2006, I will reset the invoice order to 60000.

So, first, we want to see the orderids already in mysql, so issue the command

Code:
select orderid from xcart_orders;

for me it returned: (your data will probably be different)

Code:
+---------+ | orderid | +---------+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | | 10 | +---------+ 10 rows in set (0.00 sec)

This shows me the orderid info stored in the table "xcart_orders." There are 10 orders in the database, with invoices numbered 1 through 10.

Invoice numer 10 is the last one in there, and that's the only one I want to change. So I told mysql to add 50000 to the orderid number, when the orderid number = 10. (This will change order 10 to 50010 and leave the other ones alone.)

the command to do that was:

Code:
update xcart_orders set orderid=orderid+50000 where orderid=10;

Now, if we ask to see the orderid data again,we issue the command:

Code:
select orderid from xcart_orders;
it says:
Code:
+---------+ | orderid | +---------+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | | 50010 | +---------+ 10 rows in set (0.00 sec)

So, the next order that is placed will be 50011. Ba bing.

I hope this makes sense and saves someone some time.
__________________
X-Cart version 4.0.12
PHP 5.2.4-2ubuntu5.10
MySQL server 5.0.51a-3ubuntu5.5
MySQL client 5.0.51a
Web server Apache
Operation system Linux
Perl 5.008008
Reply With Quote
  #2  
Old 04-04-2005, 03:11 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

This works too

Code:
ALTER TABLE xcart_orders AUTO_INCREMENT = xxxxxx;
Reply With Quote
  #3  
Old 04-05-2005, 02:46 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

and you can do all this without shell or phpmyadmin just by entering the sql command into the sql part of the patch upgrade page in your admin
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #4  
Old 10-18-2005, 08:53 PM
  neonrider's Avatar 
neonrider neonrider is online now
 

X-Adept
  
Join Date: Oct 2005
Posts: 745
 

Default How is it done?

How exactly is it done step by step? (reset order numbering to a desired figure). I prefer to do this from X-Cart admin or from "phpmyadmin".
I have no idea what mysql, php etc. is.

Thanks for your help!
__________________
X-Cart Gold - 4.7.12
Reply With Quote
  #5  
Old 10-19-2005, 03:50 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

As Jon said above, just enter this command into the SQL Queries section of the Patch/Updgrade area of your admin:

ALTER TABLE xcart_orders AUTO_INCREMENT = xxxxxx;

Replace xxxxx with the number of the invoice.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #6  
Old 10-19-2005, 09:06 AM
  neonrider's Avatar 
neonrider neonrider is online now
 

X-Adept
  
Join Date: Oct 2005
Posts: 745
 

Default Thanks

Ryan, thanks. I saw several posts on this matter and I saw this one, but I was not sure where exactly to go on which program. Everyone talks about "mysql" and I don't have mysql. I found "phpmyadmin" on my Plesk and I remember somehow digging into it when I had another cart and being able to reset (edit, update, change, customise) the orderid (order number), but in X-Cart's phpmyadmin it's just not there. I tried everything in phpmyadmin and nothing worked. Also I saw a post with a long 4-5 line code to be entered somewhere on X-Cart Admin area and then he posted also another code how to remove it. Now a question: after I enter this code (if I find where to enter it) will I have to remove it with another code after a next order is placed?

P.S. Do I have to also include the ; sign after the x'es?

Thanks again.
__________________
X-Cart Gold - 4.7.12
Reply With Quote
  #7  
Old 10-19-2005, 09:13 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

You do have MySQL, that is the database type. X-Cart doesn't run without it! PHPMyAdmin is the interface tool used to edit a MySQL database.

Yes, enter that statement exactly as posted, with the ;

You don't have to change anything, this simply sets the next invoice number.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #8  
Old 10-27-2005, 02:53 PM
  neonrider's Avatar 
neonrider neonrider is online now
 

X-Adept
  
Join Date: Oct 2005
Posts: 745
 

Default Error: perl executable is not found or patch.pl has no right

Now I went to "Patch/Upgrade" section and I'm getting the following red text warning right away by just going there, not doing anything:

Patch/Upgrade center

Error: perl executable is not found or patch.pl has no rights to execute. In that case you cannot use patch/upgrade code of X-Cart.
__________________
X-Cart Gold - 4.7.12
Reply With Quote
  #9  
Old 10-27-2005, 03:19 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

You need to specify the pearl path in General Settings and make sure patch.pl has the correct permissions.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #10  
Old 10-27-2005, 03:23 PM
  neonrider's Avatar 
neonrider neonrider is online now
 

X-Adept
  
Join Date: Oct 2005
Posts: 745
 

Default E:\perl\bin\perl.exe - no difference

I found some info on the forum about it and entered:

E:\perl\bin\perl.exe

into the empty field under "General Settings/General Options"

The full path to Perl interpreter executable (e.g. WIN32: 'd:\perl\bin\perl.exe'; UNIX: '/usr/bin/perl' or leave this field empty): (was empty, then I entered E:\perl\bin\perl.exe)

... but nothing, so I cleaned the field again. There seems to be no solution? I wonder what X-Cart providers say about this issue?
__________________
X-Cart Gold - 4.7.12
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:06 AM.

   

 
X-Cart forums © 2001-2020