Jump to content

Shipping costs calculation in the cart


Recommended Posts

Hi

 

I was just wondering if the shopping cart costs are correctly calculated when multiple carriers are defined in prestashop.

 

In this situation, when user is not logged, prestashop is using predefined carrier and lowest rate as expected. However, when a user is logged and his shipping address is out of the scope of the default carrier, 1.4.6.2 shows 0 as the cost. Is this the expected behaviour? Shouldn't be lowest carrier shipping to the client country? Bad configuration?

 

Thank you and regards!

Link to comment
Share on other sites

I believe that is the expected behavior, Prestashop will not try to change the default carrier, even if it does not apply to the address of the current user.

 

You should check out this module http://www.prestashop.com/forums/index.php?/topic/148747-module-localized-shipping-set-shipping-rates-by-country-state-or-zipcode-range/ , which offers a shipping preview in the cart, with the ability to change the default carrier (not requiring the customer to login)

  • Like 1
Link to comment
Share on other sites

I believe that is the expected behavior, Prestashop will not try to change the default carrier, even if it does not apply to the address of the current user.

 

You should check out this module http://www.prestasho...-zipcode-range/ , which offers a shipping preview in the cart, with the ability to change the default carrier (not requiring the customer to login)

 

If this is the case, I will try to see if I can adapt the module so that does this thing automatically, without user intervention in the cart (via Javascript).

 

However, I still strongly believe it would be highly appreciated by visitors of the prestashop sites, in the context of multi-carrier enviornments and when they are logged in, that correct estimations of costs of (regardless if this implies carrier A or B, as indeed this will be shown in more details during the checkout process) are shown. This will decrease number of abandoned carts during the shipping step.

Link to comment
Share on other sites

  • 2 months later...

Hi guys,

 

It seems to me that it is a bug. After some debugging it appears to me that the problem is located in:

 

dev:/var/www/rand/classes# diff Cart.php Cart.php.bak
1698,1699c1698,1699
<			   //if (!$carrier->range_behavior)
<			   //	  return true;
---
>			   if (!$carrier->range_behavior)
>					   return true;
dev:/var/www/rand/classes#

 

After commenting this two lines that were always returning true, now the cart (blockcart) correctly shows lowest price for the shippment address of the user when is logged, and as expected, lowest estimation for the default country for users not logged in.

 

It seems to me that maybe $carrier->range_behaviour is not correctly being initialized on the call:

			$carrier = new Carrier((int)$id_carrier, Configuration::get('PS_LANG_DEFAULT'));

, or has incorrect value on the DB. However, I don't fully understand this flag and so why is it used here.

 

I still want to test it in depth, but I wanted to rise it so that someonelse from the team can have it a look.

 

More info for reproducibility:

 

Affected versions: 1.4.6.2 1.4.7.0 (at least)

Shipping configuration:

Shipping by weight ranges (default policy)

 

3 Carriers, A,B,C

A ranges {0-2, 2-5, 5-10, 10-1000}

B ranges {0-5, 5-10, 10-1000}

C ranges {0-5, 5-10, 10-1000}

 

The three carriers cobering all the zones defined (all the zones with Countries attached). Before debugging I also tried chaning the carrier billing policy, forcing it to be weight ranges, but the bug was still there.

 

Could some developer have it a look? If needed I can provide more info.

 

Thanks

best

Link to comment
Share on other sites

Tested in depth... For the particular configuration that I have commented lines do not affect and works perfect. Nevertheless I understand those lines were there for something, so I suspect error is probably on initialization of the Carrier instance.

 

Any thoughts dev team? Could someone have it a quick look?

 

thanks

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 months later...
  • 3 weeks later...
  • 1 month later...

Hello Unamed,

 

I have the same problem, the shipping cost are not displayed in the cart when a foreign user is logged.

 

The shipping are only displayed further in the checkout process.

 

I see that you've found the solution to display the shipping costs in the cart also for logged foreign user.

 

I've read your explanation but i didn't understand what to do, which lines must be changed and in which file.

 

I've looked in the Blockcard.php files but i didn't find these lines to change.

 

Please could you help me for this.

 

Thanks in advance for your help.

 

Regards,

 

Max

--------------------------------------------------

 

Bonjour Bruno,

 

J'utilise la version Prestashop 1.4.6.2 en ligne et 1.4.7.0 sur mon PC pour faire des essais.

 

J'ai configuré par défaut Colissimo pour la France et créé un transporteur (UPS) pour tous les pays étrangers avec les zones et les tranches par poids nécessaires.

 

En effet, je rencontre le même problème, les frais de port de s'affichent pas dans le panier lorsqu'un client étranger se connecte avec son compte.

 

Ils ne s'affichent que lorsque l'on continu la procédure d'achat et que l'on arrive à la partie "Frais de port".

 

Pour la France avec le transporteur par défaut (colissimo) les frais de port s'affichent sans problème en étant connecté ou pas avec son compte.

 

Pourriez-vous m'indiquer comment corriger ce bug sous Prestashop 1.4.6.2 en ligne et 1.4.7.0 qui apparemment rencontrent le même problème.

 

J'ai lu l'explication donnée en Anglais sur le forum mais je n'ai pas bien compris ce qu'il fallait changer, quelles lignes ajoutées et dans quel fichier de Prestashop pour résoudre ce problème d'affichage dans le panier pour les clients et envois à l'étranger.

 

Merci d'avance pour votre aide.

Cordialement,

Max

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

Dear Max,

 

Sorry for my late reply. Lines shown in the diff output should be commented. If you don't know how to interpret diff outputs, I would highly encourage you to learn it, as it is extremely helpful.

 

You should be commenting lines 1698 and 1699 in Cart.php, in a standard 1.4.7.0 installation. Or at least it works for me

 

As Bruno was saying, you might want to simply jump to a newer version, as seems to be fixed (it is always not very beatiful to change things in core files..).

 

best

marc

Link to comment
Share on other sites

  • 7 months later...
  • 2 years later...

Hi Guys,

 

I have added different shipping method in system with different shipping price. Now, I have associates atleast 2 shipping methods with different products. Some products have few common shipping.

 

 

After doing the same, I am placing an order and prestashop showing me different shipping charge.

 

So, I want to know that, how Prestashop calculate shipping charge if products being order has different shipping method.?

Link to comment
Share on other sites

×
×
  • Create New...