Jump to content

[Solved]Shipping cost by price in default country, by weight to the rest world


Recommended Posts

Hi ppl,

I know that this may sound a bit complicated, but Im sure many here will want it.

I need to set the shipping costs calculated by price in my counrty, which is set as the default, and thats
because I have a free delivery for orders more than €150 and a flat charge of €10 for orders below €150.

Now what about the international shipping?
I need to set the shipping costs calculated by weight.

Is there any way to get this working?

Thanks

Link to comment
Share on other sites

It is not possible to do that in PrestaShop, and I think it would be difficult to modify PrestaShop to do this. You could try looking for the code that calls the checkDeliveryByWeight and getDeliveryByWeight functions and write an if statement to check the country and call checkDeliveryByPrice and getDeliveryByPrice functions instead if it is your country.

Link to comment
Share on other sites

Rocky, according to this topic, I think a may have
a solution.
I will set the billing according to weight and I will use one carrier for all international sales and zones.
Then I will create a new zone for my country only and I will set a new carrier.

I will then set weight range for international carrier and price range for the local carrier.
As for the code I will always have to set the right carrier id for the local one.

So, what do you think?

Link to comment
Share on other sites

I don't understand how that would work, since all carriers would still be "by weight" and you said you wanted one carrier "by weight" and one "by price", but if you can get it to do what you want, then you should do it.

Link to comment
Share on other sites

if (isset($configuration['PS_SHIPPING_FREE_PRICE']) AND $id_carrier==1 AND $orderTotal >= floatval($configuration['PS_SHIPPING_FREE_PRICE']) AND floatval($configuration['PS_SHIPPING_FREE_PRICE']) > 150)
           return $shipping_cost;



What if a zone, which is my country, is incuded here as "if".
Will that work?

Link to comment
Share on other sites

I've had a think about it and I see now that it will work for you. That code lets you apply the "Free shipping after" value to one carrier only. You can use weight-based shipping for both carriers. Just set the weight range to 0kg-1000000kg for your country's carrier and enter the shipping cost for that weight range to €10. That should give you the flat rate you want below €150 and free shipping above €150. You can then configure the weight ranges for the international carrier as usual.

Link to comment
Share on other sites

  • 2 weeks later...

Rocky,

I have just found a solution for this.

The default free shipping code looks like this:

// Free fees
       if (isset($configuration['PS_SHIPPING_FREE_PRICE']) AND $orderTotal >= floatval($configuration['PS_SHIPPING_FREE_PRICE']) AND floatval($configuration['PS_SHIPPING_FREE_PRICE']) > 0)
           return $shipping_cost;
       if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= floatval($configuration['PS_SHIPPING_FREE_WEIGHT']) AND floatval($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0)
           return $shipping_cost;



So, I have added an extra if statement just under the original one, which is:

if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $id_zone==9 AND $id_carrier==22 AND $orderTotal >= 150)
   return $shipping_cost;



zone 9 is my country
carrier 22 is the local shipping carrier.

The shipping settings are:
Free shipping starts at: 0 euro
Free shipping starts at: 900000 kg
Billing according to total weight

And as you said above, I have set a weight range from 0kg to 1000000kg with €10 shipping cost.

Link to comment
Share on other sites

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