Jump to content

Shipping costs per weight of each product, not cart total


dawb

Recommended Posts

Hi,

 

Does anybody know if it is possible to set the shipping to be calculated by the weight of each product rather than the weight of the cart total? For example if you had one product that was 1kg and $4 shipping and another that was 3kg and $8 shipping the shipping total would be $12. Is this possible and how would you go about modifying the cart to do this?

 

Any help would be greatly appreciated.

 

Thanks

Link to comment
Share on other sites

Hi,

it's not possible to make what you need using the field "Additional shipping cost:" for each product? you can specify additional cost on each product. Then you could work on the shipping cost, if you want you can make them set to zero.

For sure it could be necessary to insert the shipping cost on each product... but if you don't have a rule to apply shipping cost by total weigh...

 

Regards,

Jacky

  • Like 1
Link to comment
Share on other sites

Hi,

 

Thanks for your reply. Unfortunately we can not use the Additional shipping cost field for each product, as we are currently using the weights to have teirs for shipping rates and need this to be applied to each product rather than to the weight of the overall order. If you can suggest any modules that already do this it would be greatly appreciated as I have looked but could not find any.

 

Thanks for you help

  • Like 1
Link to comment
Share on other sites

may be this can help you.

 

i have added at the end of Proccess() in ProductController.php

$id_carrier = Configuration::get('PS_CARRIER_DEFAULT');
 $carrier = new Carrier((int)($id_carrier), Configuration::get('PS_LANG_DEFAULT'));
 $carrierTax = Tax::getCarrierTaxRate((int)$carrier->id, (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
 $defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
 $id_zone = (int)$defaultCountry->id_zone;
 $portes = $carrier->getDeliveryPriceByWeight($this->product->weight, $id_zone)*1;
 $portes = $portes *(1+ $carrierTax/100);
  self::$smarty->assign(array(
   'portes' => $portes
  ));

 

add in tpl {$portes} where you want to show shipping_cost

 

If you want to calculate shipping by unit change function getDeliveryPriceByWeight() in Cart Class sure you can find what you need.

  • Like 2
Link to comment
Share on other sites

  • 1 year later...

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