Jump to content
manfield

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

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);
  }
 }

Share this post


Link to post
Share on other sites

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? 

Share this post


Link to post
Share on other sites

Hi,

UPS carrier module caches results in a table: PS_UPS_CACHE

I suggest you to truncate the table, then retry. Probably you're looking at old results.

Let me know.

Share this post


Link to post
Share on other sites

Thank you so much for the quick response!  

 

Unfortunately, truncating PS_UPS_CACHE didn't make a difference. 

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More