I ran into an issue where my client needed to add extra weight to the package weight to handle things like ice packs, peanuts and the weight of the box. This adds two configuration options to the UPS module that allows for a Numeric Value and a Addition Type (Percentage, Multiplier, Mass).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR’s picture

Status: Needs review » Needs work

1) Remove tabs from your patch - check coding standards by running the Coder module on your site.
2) When you add system variables you need to modify hook_uninstall() to remove those variables when the module is uninstalled.
3) Reduce trim() calls - see how uc_fedex or uc_canadapost implement this markup. Should probably make that change in uc_ups_markup().
4) Should probably rename uc_ups_markup() to uc_ups_rate_markup() to distinguish it from uc_ups_weight_markup(), and change the two variables used by uc_ups_markup() correspondingly. Changing variable names necessitates writing a hook_update_N() to rename the stored variables in the database.

McBastard’s picture

I didn't write the uc_ups_markup function, it was already part of the core. If there is no issues with me doing what you asked, I'll fix it.

TR’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev

I've already put most of this into 7.x-3.x for both uc_ups and uc_usps. Code was taken from my uc_fedex module. I addressed all the items in my comment #1. The only thing left to do is to add the line in the packaging code to do the actual markup - that's complicated by the fact that there's a max weight limit for the packages so you can't just scale the package weight. I'll complete this when I have some time to do proper tests.

I've moved this to the 7.x-3.x queue - it can be backported after it's finished.

TR’s picture

Version: 7.x-3.x-dev » 8.x-4.x-dev
Component: Shipping » Code
Issue summary: View changes
TR’s picture

Component: Code » Shipping quotes