Author Topic: Order number reformulation  (Read 46138 times)

edemict

  • Beginner
  • *
  • Posts: 4
Re: Order number reformulation
« Reply #30 on: April 15, 2011, 14:58:02 pm »
I equally have the same problem, my order number generated from this post is not showing in the mail sent out to users. Please i need help.
The order number shows in every other field both in the front end account maintenance and the back end order list. Please can someone help.

avedis777

  • Beginner
  • *
  • Posts: 18
Re: Order number reformulation
« Reply #31 on: July 03, 2011, 02:47:45 am »
Hi, I am trying to change the order numbers displayed from the 0000001 scheme to to something else...preferably something like starting at 1500 or some larger number like that, I do not need any kind of date code at this point.

From sobers_2002 posting, step 1 there is the function get_order_number() in the ps_checkout.php file...is this the function that generates the order number?

The code after the first step confuses me because I'm not sure why we are changing things from the order_id to the order_number...if things are displaying the order_id rather than the order_number, maybe I just need to change how the order_id is generated instead of the order number?

This seems like it would be simple, but I'm kind of confused about what I need to change to have the orders start at a number larger than 1.

Any direction would be appreciated.

Thanks!

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 25787
  • Always on vacation
    • Jenkin Hill Internet
Kelvyn

Jenkin Hill Internet,
Keswick, Lake District

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM3.2.3 on Joomla 3.7.2 PHP 7.0.19

Testing VM3.2.3 on J!3.7.2

andyjudge85

  • Beginner
  • *
  • Posts: 2
Re: Order number reformulation
« Reply #33 on: July 07, 2011, 16:58:00 pm »
Hello friends sorry if my post is not helpeful for any friend. I had problem to change order number series but i have sort it out. i was trying to change order number in phpmyadmin but my orders numbers was not changing they was going to back to old series. but its possible to change we just have to do after changing order number go to tab Operations in Phpmyadmin and left side in Table options column in field AUTO_INCREMENT add there one + plus value then your order number. For e.g ( if you have insert order number 99 then add AUTO_INCREMENT 100 ).  :) . and please excuse my English.

lalmohan

  • Beginner
  • *
  • Posts: 2
Re: Order number reformulation
« Reply #34 on: February 15, 2012, 08:08:19 am »
and at line 559 change
Code:

$listfields = 'cdate,order_total,order_status,order_id,order_number,order_currency';

to
Code:

$listfields = 'cdate,order_total,order_status,order_id,order_currency';

The new version of VM has the following code instead:
$listfields = 'o.order_id,o.cdate,order_total,o.order_status,order_currency';

What should I change to then? I tried change to o.order_number but no luck...Anyone can help?

laithdarant

  • Beginner
  • *
  • Posts: 4
Re: Order number reformulation
« Reply #35 on: September 18, 2012, 17:52:34 pm »
Hi, I've followed every step in this thread, but I have one problem I can't solve, when I update the order status and select to notify the client, there's a message
Quote
Advertencia: No ha podido mandar el mensaje a , ()
In English it means that The message could no be sent, somone has any idea how to solve it?

elvispl

  • Beginner
  • *
  • Posts: 5
Re: Order number reformulation
« Reply #36 on: October 25, 2012, 11:29:18 am »
and at line 559 change
Code:

$listfields = 'cdate,order_total,order_status,order_id,order_number,order_currency';

to
Code:

$listfields = 'cdate,order_total,order_status,order_id,order_currency';

The new version of VM has the following code instead:
$listfields = 'o.order_id,o.cdate,order_total,o.order_status,order_currency';

What should I change to then? I tried change to o.order_number but no luck...Anyone can help?

$listfields = 'o.order_id,o.cdate,order_total,o.order_status,order_number,order_currency';

bobysolo

  • Beginner
  • *
  • Posts: 47
  • Kiss my shiny metal ass!
    • Videosorveglianza
Re: Order number reformulation
« Reply #37 on: July 10, 2013, 18:45:16 pm »
I know this topic is old, but still, I need a further customisation regarding order_id.

Is it possible to also modify order_id in the frontend URL?

So that instead of this:
index.php?page=account.order_details&order_id=1&option=com_virtuemart&Itemid=101
we'll have this:
index.php?page=account.order_details&order_number=2013-07-60283548122&option=com_virtuemart&Itemid=101

Because now we have cleared the order_id from every aspect of VM except the URL.

Thanks ;-)

bobysolo

  • Beginner
  • *
  • Posts: 47
  • Kiss my shiny metal ass!
    • Videosorveglianza
Re: Order number reformulation
« Reply #38 on: July 21, 2013, 22:03:31 pm »
If someone else needs to reformulate the past order numbers, so that they match the new formula, here is the SQL query:

Code: [Select]
UPDATE `BBB_vm_orders` SET `order_number`= concat(DATE_FORMAT(FROM_UNIXTIME(cdate), '%Y-%m-%d'), "-",RPAD(CRC32(TIME_FORMAT(FROM_UNIXTIME(cdate), '%H:%i:%s  ')), 8, ceil(RAND()*10)) )
where order_id <= 4323

Change the "BBB" in the "BBB_vm_orders" so that it matches your DB prefix.

What the query does is to update the past order_number column, creating a new order_number format like this: "YYYY-MM-DD-12345678" - date + 8 random numbers. For me I needed to reformulate the orders from the ID 4323 down - so change you order_id accordingly.

Thank you Matej for this.