Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

How to get an Order Number


Recommended Posts



I am developing a payment module to pay with credit card in a small local bank. The bank requires that I post two fields:


totalAmmount which contains the total the customer will have to pay.

orderNumber which should contain any string no longer than 12 chars


I want to use the value in orders.orders_id, but don't know how to get it from within the module script.


I checked global $orders, but this value is not available there.


Any ideas ? Thanks.

Link to comment
Share on other sites

How to get an Order Number

using the PHP and mysql query.

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

using the PHP and mysql query.


Thanks Alex,


I output the hidden fields of the form using:


function process_button() {

global $order;


$process_button_string = '';

$params['invoiceNumber'] = rand(1000,10000); //just for testing

$params['totalAmount'] = $order->info['total'];

foreach ($params as $key => $value) {

$process_button_string .= tep_draw_hidden_field($key, $value);



return $process_button_string;



As I undersntand, at this point the order has not been processed and therefore there is no order_id. The order_id is available after clicking the buttom and is available in


function after_process() {



So I wonder if this would work


function after_process() {

global $insert_id;

tep_draw_hidden_field('invoiceNumber', $insert_id);



Or by this time the form fields have already been sent.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...