Community Add-Ons
| Maintainers: | jfarhat |
External Order Id Generator
for osCommerce Online Merchant v2.2
There are situations where the order_id is needed to be sent with the transaction
request to the payment processor. However, osCommerce only generates the order_id
after the payment module executes.
This contribution addresses this issue by adding a new orders_id table to the osCommerce
database and adding functions to generate the necessary orders_id and associate it with
the session when the payment module executes rather than waiting until the orders record
is created. Since this problem really only affects payment modules that require an orders_id
to pass to a gateway (such as most credit card modules do) simply the checkout_process.php file
is modified to call this new orders_id generation function for all other (non-credit card) modules,
providing backward compatibility so that changes to other payment modules are not necessary.
Any credit card module could also use this code by just adding two lines of code to the file.
The first line is the call to create a new unique orders_id ($new_order_id = tep_get_Order_ID(tep_session_id());)
and the second call clears the session field (tep_clear_Order_ID(tep_session_id());) [See the Cynergy Payment module for an
example] in the newly created orders_id record and session global in the event the card transaction is
declined so the the orders_id will be reused for a future order. This eliminates "holes" or missing
invoice numbers in the osCommerce orders database whenever a card transaction is declined. If the transaction is
approved by the gateway, nothing more needs to be done as the modifications to the order.php class handles all of the
cleanup for successful transactions.
* Please read the readme.txt file included in the package for installation instructions.
By Kirkham Systems - Joseph Farhat
There are situations where the order_id is needed to be sent with the transaction
request to the payment processor. However, osCommerce only generates the order_id
after the payment module executes.
This contribution addresses this issue by adding a new orders_id table to the osCommerce
database and adding functions to generate the necessary orders_id and associate it with
the session when the payment module executes rather than waiting until the orders record
is created. Since this problem really only affects payment modules that require an orders_id
to pass to a gateway (such as most credit card modules do) simply the checkout_process.php file
is modified to call this new orders_id generation function for all other (non-credit card) modules,
providing backward compatibility so that changes to other payment modules are not necessary.
Any credit card module could also use this code by just adding two lines of code to the file.
The first line is the call to create a new unique orders_id ($new_order_id = tep_get_Order_ID(tep_session_id());)
and the second call clears the session field (tep_clear_Order_ID(tep_session_id());) [See the Cynergy Payment module for an
example] in the newly created orders_id record and session global in the event the card transaction is
declined so the the orders_id will be reused for a future order. This eliminates "holes" or missing
invoice numbers in the osCommerce orders database whenever a card transaction is declined. If the transaction is
approved by the gateway, nothing more needs to be done as the modifications to the order.php class handles all of the
cleanup for successful transactions.
* Please read the readme.txt file included in the package for installation instructions.
By Kirkham Systems - Joseph Farhat
3000 Old Greenwood Rd
Fort Smith, AR 72903
www.kirkhamsystems.com
