Jump to content

[Tutorial]How to customize UPS Carrier Module for Negotiated Rates


manfield

Recommended Posts

If you negotiated rates with UPS, you may would like to receive correct data from the carrier, during price calculation.

Since the standard module does not consider this case, here is the hack to make it work.

 

Modify file /modules/upscarrier/xml.tpl

 

Just after

<Shipment>

tag, add:

<RateInformation>
<NegotiatedRatesIndicator />
</RateInformation>

 

Then modify /modules/upscarrier/upscarrier.php, row 1732.

 

Substitute block

 

 // Return results
 if (isset ($resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['RESPONSESTATUSDESCRIPTION']) && $resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['RESPONSESTATUSDESCRIPTION'] == 'Success')
  return array('connect' => true, 'cost' => $resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['TOTALCHARGES']['MONETARYVALUE'] * $conversionRate);

 

with

 

 // Return results
 if (isset ($resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['RESPONSESTATUSDESCRIPTION']) && $resultTab['RATINGSERVICESELECTIONRESPONSE']['RESPONSE']['RESPONSESTATUSDESCRIPTION'] == 'Success') {
  if (isset($resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['NEGOTIATEDRATES'])) {
return array('connect' => true, 'cost' => $resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['NEGOTIATEDRATES']['NETSUMMARYCHARGES']['GRANDTOTAL']['MONETARYVALUE'] * $conversionRate);
  } else {
return array('connect' => true, 'cost' => $resultTab['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['TOTALCHARGES']['MONETARYVALUE'] * $conversionRate);
  }
 }

Link to comment
Share on other sites

  • 3 months later...

Hi Manfield,

 

Thank you so very much for posting this.  However the suggested updates didn't have an impact for us.   For us, after making the code updates you suggested, the module still returns the non negotiated rates.  Would you have any other suggestions/recommendations? 

Link to comment
Share on other sites

Hi, in order to help you I need more information.

Try to send this message (https://www.dropbox.com/s/copub9o64hr5348/UPScarrierXMLTemplate, replacing your account data to XXX I typed in the file)  as POST request to:

 

https://onlinetools.ups.com/ups.app/xml/Rate

 

You may use a Firefox add on called Poster: http://screencast.com/t/HibT53U7j to easily submit the request and check response.

 

You may send the response to manfredi[at]fabvla.com, I will check and tell you.

Link to comment
Share on other sites

WOW, you are amazing! Thank you so much for sending all this along and offering to assist!  In the process of me updating the file that you have sent, I realized that we must be using the wrong ShipperNumber.  Once I have updated the Your MyUps ID (ShipperNumber in the xml), all worked perfectly.  Thank you so much!!!!

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

This is a great tip! It is amazing that this is not included in the module itself.

 

In the UPS Module v1.3.5 there is a drop-down for Pickup Type that greatly affects the rates returned by the UPS API. When using your hack, which Pickup Type will result in the correct negotiated rate being returned by the API?

 

Daily Pickup

Customer Counter

One Time Pickup

On Call Air

Suggested Retail Rates

Letter Center

Air Service Center

 

Thanks!

Link to comment
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
×
×
  • Create New...