Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Code for modules.php for shipping


suscrofa

Recommended Posts

The code changes listed on the most recent version of UPSXML and USPS installation instructions for modules.php in admin are for an earlier version of osc. Edge requires different modifications to make UPS and USPS work. I looked for an appropriate thread, but found none. Surely someone has dealt with this problem.

I tried to install shipping modules on Edge and they did not appear as a choice without modifying modules.php in admin. Please point me to a thread that contains the proper code changes for modules.php. Thank you.

Lark Burnham, Horton, KS

Link to comment
Share on other sites

There's not such a thread, at least that I am aware of. But the conversion is not difficult. Search the file for any use of FILENAME_ or DIR_ and replace them with the actual names. For example, FILENAME_CHECKOUT_PAYMENT would be replaced with 'checkout_payment.php'. Be sure to include the apostrophes.

If you are installing a very old module, there may be php function calls to functions that no longer exist, like ereg so you need to replace those.

With that said, I think the USPS module is already compatible with the later versions of oscommerce. if not, you could ask in its support thread.  I haven't looked at UPSXML in while but I suspect it will need some changes made.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

This is from the installation directions for USPS newest version available at addons.oscommerce.com. Similar instructions appear in UPSXML.:

 

*****************************************
Find This code somewhere around line 43:
*****************************************

if (tep_not_null($action)) {
    switch ($action) {
      case 'save':
       reset($HTTP_POST_VARS['configuration']);
        while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {

***********************************************
INSERT THE FOLLOWING CODE AFTER THE ABOVE LINE:
***********************************************

    if( is_array( $value ) ){
        $value = implode( ", ", $value);
      $value = preg_replace ("/, --none--/", "", $value);
    }

This is the closest I can find in edge version of modules.php:

if (tep_not_null($action)) {
    switch ($action) {
      case 'save':
        foreach ($_POST['configuration'] as $key => $value) {
          tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");

 

Your suggestion would not work in this instance. Thank you for your help (again), Jack.

 

Lark


 

 

Link to comment
Share on other sites

this line:

 foreach ($_POST['configuration'] as $key => $value) {

is equivalent to that one:

     while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) { 

 

Link to comment
Share on other sites

Thank you for that clarification. Does the code that is to be inserted need to be updated as well?

 if( is_array( $value ) ){
        $value = implode( ", ", $value);
      $value = preg_replace ("/, --none--/", "", $value);
    }

Thanks again.

Thanks again.

 

Lark

Link to comment
Share on other sites

Sorry for the delay, I had to get the Edge file modified. I added the code as directed, but I am still not seeing UPS as a choice in admin shipping. Please send the entire block of code as it should be. Thank you.

 

Lark

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...