Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Modifying UPS mod


bmac

Recommended Posts

Hey all,

 

I need to add 15% to the total UPS shipping rate. Someone suggested that I add a 1.15 multiplier to the 'shipping_rate' (seems like a good solution) but I haven't been able to find it (or anything like it) in the ups.php. Anyone have any suggestions? Thanks,

 

Brian

Link to comment
Share on other sites

I need to add 15% to the total UPS shipping rate.

Anyone have any suggestions?

You could perhaps try to amend ups.php. I haven't tried this, but I guess that if you change $cost in $cost*1.15 (see further) that might work?

// Somewhere around line 96
      $methods = array();
       $qsize = sizeof($upsQuote);
       for ($i=0; $i<$qsize; $i++) {
         list($type, $cost) = each($upsQuote[$i]);
         $methods[] = array('id' => $type,
                            'title' => $this->types[$type],
                            'cost' => ($cost*1.15 + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
       }

Link to comment
Share on other sites

hey,

 

thanks for the input. I tried it, however, and it didn't work-- I changed everything back to original, but now I'm getting this:

 

Fatal error: Call to undefined function: _ups() in /home/stuart/public_html/mactac/includes/modules/shipping/ups.php on line 86

 

 

Any ideas....?

 

thanks,

 

Brian

 

 

 

You could perhaps try to amend ups.php. I haven't tried this, but I guess that if you change $cost in $cost*1.15 (see further) that might work?

// Somewhere around line 96
      $methods = array();
       $qsize = sizeof($upsQuote);
       for ($i=0; $i<$qsize; $i++) {
         list($type, $cost) = each($upsQuote[$i]);
         $methods[] = array('id' => $type,
                            'title' => $this->types[$type],
                            'cost' => ($cost*1.15 + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
       }

Link to comment
Share on other sites

Did you by accident put a space in between this->_upsNAMEOFFUNCTION in the preceding lines:

 

     $this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
     $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);
     $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);
     $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);
     $this->_upsWeight($shipping_weight);
     $this->_upsRescom(MODULE_SHIPPING_UPS_RES);
     $upsQuote = $this->_upsGetQuote();

How do you mean it didn't work: no change in the numbers or did you get error message?

Link to comment
Share on other sites

Hey there,

 

When I added the multiplier I got the error regarding line 86 (even though the change wasn't made to line 86). Not sure how the two relate so I just restored the old UPS file. I could try it again & see if I get the same error...

 

Appreciate your time & help. If you have any other ideas I'd like to hear them. I'll also let you know if the change works this time around. thanks & best,

 

 

brian

 

 

 

 

Did you by accident put a space in between this->_upsNAMEOFFUNCTION in the preceding lines:

 

     $this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
     $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);
     $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);
     $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);
     $this->_upsWeight($shipping_weight);
     $this->_upsRescom(MODULE_SHIPPING_UPS_RES);
     $upsQuote = $this->_upsGetQuote();

How do you mean it didn't work: no change in the numbers or did you get error message?

Link to comment
Share on other sites

When I added the multiplier I got the error regarding line 86 (even though the change wasn't made to line 86). Not sure how the two relate

Me neither, but I sometimes get the weirdest errors when I cut and paste code from a webpage into a php file directly. Perhaps that might explain it?

 

I tried the multiplication in the UPSXML module (that I use) where rather similar code is used and that worked. I have no explanation why this wouldn't, perhaps put brackets around it?

 

'cost' => (($cost*1.15) + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
? ? ? ?}

Otherwise I have no further ideas how to solve this other than to work with the array $upsQuote just before that piece of code to multiply $cost by the 1.15 you want. That would be the best moment IMHO.

Link to comment
Share on other sites

I think I'll install the UPSXML module & see what I can do. Before that though I'll try the brackets. I'll keep you posted, thanks again.

 

brian

 

 

Me neither, but I sometimes get the weirdest errors when I cut and paste code from a webpage into a php file directly. Perhaps that might explain it?

 

I tried the multiplication in the UPSXML module (that I use) where rather similar code is used and that worked. I have no explanation why this wouldn't, perhaps put brackets around it?

 

'cost' => (($cost*1.15) + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
      }

Otherwise I have no further ideas how to solve this other than to work with the array $upsQuote just before that piece of code to multiply $cost by the 1.15 you want. That would be the best moment IMHO.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...