Jaguaro Posted September 1, 2014 Share Posted September 1, 2014 Hi, by mistake I activated the invoice for some order that didn't need it. So the invoice number increased when it shouldn't have. Now I've just had an order where the invoice is actually needed. I changed the number via PHPMyadmin, but for the next invoices I don't know what to do. In the BO Invoices page I can only increase the invoice starting number, but it doesn't let me decrease it. What can I do? Thank you in advance! C Link to comment Share on other sites More sharing options...
vekia Posted September 1, 2014 Share Posted September 1, 2014 you have to change AUTO_INCREMENT value of the invoices table check "structure" settings of table, you will see there option to decrease AUTO_INCREMENT counter Link to comment Share on other sites More sharing options...
Jaguaro Posted September 1, 2014 Author Share Posted September 1, 2014 Hi Vekia, thank you for your quick reply. I noticed that the number in the ps_order_invoice and the invoice_number in the ps_orders table don't have the AUTO_INCREMENT option set, so I suppose it's Prestashop and not the db which should be edited. Thanks, C Link to comment Share on other sites More sharing options...
Jaguaro Posted September 1, 2014 Author Share Posted September 1, 2014 I noticed that the Order Class (/classes/order/Order.php) has a function called getLastInvoiceNumber() that selects the MAX number in the numbers row in ps_order_invoice table. So I have to manually edit the numbers in the orders which didn't need the invoice. Thank you anyway. public static function getLastInvoiceNumber() { return Db::getInstance()->getValue(' SELECT MAX(`number`) FROM `'._DB_PREFIX_.'order_invoice` '); } Link to comment Share on other sites More sharing options...
Jaguaro Posted September 1, 2014 Author Share Posted September 1, 2014 Do you know if there is a quick way to remove the invoice in an order? Link to comment Share on other sites More sharing options...
hatak Posted September 1, 2014 Share Posted September 1, 2014 just in the table ps_order in row invoice number delete number of invoice for that specific order if you activated next invoices for next ordersjust change their numbers Link to comment Share on other sites More sharing options...
Jaguaro Posted September 2, 2014 Author Share Posted September 2, 2014 Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now