Jump to content
TomB01

UPS XML 1.7 for Phoenix

Recommended Posts

I think many of you know that the OsCommerce Apps Marketplace is a mess.  I'm not trying to be overly-critical, just to confirm that you shouldn't depend on it to find the latest updates, documentation, etc.  Going right through the Apps Marketplace and searching for "UPS," you will never find the download that I started from.

This is the link that I believe represents the latest UPSXML add-in:

https://apps.oscommerce.com/z6l1O&upsxml-version-1-5-for-oscommerce-2-3-x

Notice that the link string says, "version-1-5."  You'll find that when you open the zip file, the top-level folder says, "UPSXML_v1_7."  Further, opening the "UPSXML install.txt" file uses the heading, "UPS XML Rates v1.6.1 for osCommerce 2.3.4 2017-04-11"

So, in three steps with the same download, we go from Version 1.5 to Version 1.7 to Version 1.6.1.  This add-on was not found from the Apps Marketplace menu or search itself, instead, it came from a Google search. 😖

Anyway, the UPSXML that I have working in Phoenix 1.0.4.0 is based on the download referenced from the link described above.

I am preparing to update to 1.0.4.1 and 1.0.4.2 and wanted to make certain I had everything documented in my files.  I discovered that my folder for the UPSXML add-on was "UPSXML_v1_7" and could not find where the heck I got it!

I will try to upload this as a new revision to the Marketplace, if I can.  However, I'm going to try to go through the greasemonkey and ecartz hook mod just above, first.

Share this post


Link to post
Share on other sites
On 11/27/2019 at 5:59 PM, ecartz said:

I think that we are talking about version 1.73 of this App.

No, it gets it from the explode immediately prior.  The $key will just be numbers from 0 to whatever.  Only the values come from the selection (indirectly through the form submission). 

Try changing


  function get_multioption_upsxml($values) {
    if (tep_not_null($values)) {
      $values_array = explode(',', $values);
      foreach ($values_array as $key => $_method) {
        if ($_method == '--none--') {
          $method = $_method;
        } else {
          $method = constant('UPS_SERVICE_CODE_' . trim($_method));
        }
        $readable_values_array[] = $method;
      }
      $readable_values = implode(', ', $readable_values_array);
      return $readable_values;
    } else {
      return '';
    }
  }

to


  function get_multioption_upsxml($values) {
    if (!tep_not_null($values)) {
      return '';
    }

    foreach (explode(',', $values) as $_method) {
      $_method = trim($_method);
      $constant_name = 'UPS_SERVICE_CODE_' . $_method;
      if ($_method != '--none--' && defined($constant_name)) {
        $_method = constant($constant_name);
      }
      $readable_values_array[] = $_method;
    }

    return implode(', ', $readable_values_array);
  }

That should get you past the error message at least. 

NOTE: I had to use the above to get rid of an error in the Admin after updating to Phoenix 1.0.4.2:

: constant(): Couldn't find constant UPS_SERVICE_CODE_Array in/home1/xxxx/public_html/xxxx/catalog/includes/modules/shipping/upsxml.phpon line1146

Using ecartz' code replacement suggestion above in the includes/modules/shipping/upsxml.php file fixed this error in the Phoenix 1.0.4.2 Admin.  My other legacy modules FedEx Web Services and USPS Rate V4 were unaffected (still required the modded modules.php in Admin, however).

 

Edited by TomB01

Share this post


Link to post
Share on other sites

Any update to this UPSXML? Looking in the Apps Market Place and the previously posted link, I don't see an update or reference to Phoenix (1.0.7.5 preferable). Still running osC 2.3.4.1 and running a test server before the leap to Phoenix. This is our primary (only) shipping method so I need to get this and a few other apps/mods/plugins working before moving forward. I can't remember if you also got dimensional support working also.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×