Jump to content

Split Shipping Packages into multiple packages in UPS Shipping Module


Recommended Posts

One of our clients has v1.4.8.2 with ups shipping module. The limitation of this shipping module is that it does not give any shipping rates when the total cart weight exceeds 150lb as UPS does not ship packages more than 150lb as ONE single package.

 

What I am looking here is that if some can modify this module to automatically split the cart into various packages whenever the total weight exceed 150lb and adds the total shipping cost for each package as the total shipping cost showing in the cart. So, for example, if the total cart weight is 190lb, the module would split it into two packages; first package will weigh 150lb and the second package will weigh 40lb. The total cost will be calculated for 150lb package separately and 40lb package separately and themn added together to display the total cost of the total order. That 150lb MAX weight shuld include any weight of the package itself.

 

This will allow a shop to use this ups module for selling heavy products, which my client is doing, and still provides a reasonable shipping cost w/o losing any order. Currently when a customer orders multiple heavy products the cart weight exceeds 150lb and the shipping is shown as "pickup" only (a fallback alternate if no shipping cost is available). Most custmers can not pickup so they cancel the order.

 

Thanks for any help.

 

NOTE: This ups module has two configuration in the backend 1) All products in One Package and 2) Ship each product separately. If the 2nd option could be modified in the module to accomodate the "bundleup" products into a MAX of 150lb and then start a new package if the cart weight is more than 150lb then I think it will do the job.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
  • 8 months later...
  • 2 weeks later...

Hey There,

 

i was able to solve this problem for our company by modifying the upscarrier.php module

 

I use "Prestashop 1.6.0.6" and "Connect to UPS v1.3.4"

 

On line 1506, i replaced the following code:

          $wsParams['package_list'][] = array(
            'width' => ($width > 0 ? $width : 7),
            'height' => ($height > 0 ? $height : 3),
            'depth' => ($depth > 0 ? $depth : 5),
            'weight' => ($weight > 0.1 ? $weight : 0.1),
            'packaging_type' => Configuration::get('UPS_CARRIER_PACKAGING_TYPE'),
          );

With: 

if($weight >= 150)
        {
          $pkgCount = ceil($weight/150);
          for($i=1;$i<=$pkgCount;$i++)
          {

            $wsParams['package_list'][] = array(
              'width' => ($width > 0 ? $width : 7),
              'height' => ($height > 0 ? $height : 3),
              'depth' => ($depth > 0 ? $depth : 5),
              'weight' => ($weight/$pkgCount > 0.1 ? $weight/$pkgCount : 0.1),
              'packaging_type' => Configuration::get('UPS_CARRIER_PACKAGING_TYPE'),
            );
          }

        }
        else
        {
          $wsParams['package_list'][] = array(
            'width' => ($width > 0 ? $width : 7),
            'height' => ($height > 0 ? $height : 3),
            'depth' => ($depth > 0 ? $depth : 5),
            'weight' => ($weight > 0.1 ? $weight : 0.1),
            'packaging_type' => Configuration::get('UPS_CARRIER_PACKAGING_TYPE'),
          );
        }

I know we shouldnt "modify" prestashop modules, but it was driving me nuts, and i wasnt going to wait  around for ups connect to add this feature.

 

let me know this works for you guys, or write me back, and i can help.

Link to comment
Share on other sites

it seems to be working for me. thank you so much rokapinc. 

 

No problem!

 

The only problem i foresee by doing it this way, is that if prestashop updates this module, this will undo these "modifications"

 

Lets hope that the moderators see this and add it to the core package, and add a 3rd selection to the admin configuration dropdown for "auto split" into packages with a max weight per package feature.

 

I'll complete this revised UPS module, and offer a patch to prestashop. who knows maybe they will accept it.

 

-cheers

Link to comment
Share on other sites

  • 1 year later...

I am attempting to implement this, however, the shipping only takes and displays the last entry. So if someone orders 305 pounds worth of products, which the code above would split into three packages, it only shows the shipping for 5 pounds. Rather than the shipping for a 150 package + 150 package + 5 package. Suggestions on changing this? I sell some pretty heavy books, so it does not take much to meet the 150 limit.

Edited by JonQCoder (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...