Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Security Level: All-users
    • Labels:
      None

      Description

      I spent hours with searching why carriercompare module doesn't work at all on PrestaShop. I mean, when you change the country, delivery costs are wrong calculated.
      In fact, this is because it uses an inadequate function that always fix the delivery zone to the default Country zone id !

      1. ajax.php - line 42 : Calls getCarriersListByIdZone()
      2. carriercompare.php - Line 118 : getCarriersListByIdZone() CALLS Carrier::getCarriersForOrder()
      3. classes/carrier.php - Line 502 : getCarriersForOrder() CALLS getOrderShippingCost() (the price here is wrong)

      classes/Cart.php
      function getOrderShippingCost() (line 977)

      Line xxx :
      if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT)
      {
      $shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight(), $id_zone);
      }
      --> Here in my case, $shipping_cost should be calculated with the price that corresponds to the weight range for the selected area, but it isn't the case. In fact, $id_zone corresponds to the default zone ID, and not the selected zone id.

      Line xxx :
      if (isset($this->id_address_delivery)
      AND $this->id_address_delivery
      AND Customer::customerHasAddress($this->id_customer, $this->id_address_delivery))
      $id_zone = Address::getZoneById((int)($this->id_address_delivery));
      else

      { // This method can be called from the backend, and $defaultCountry won't be defined if (!Validate::isLoadedObject($defaultCountry)) $defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT')); $id_zone = (int)$defaultCountry->id_zone; }

      -> THE PROBLEM STANDS HERE ! First condition (if) is not met (there is no id_address_delivery because the user is not logged (and module is not displayed when logged) & for the same reason, Customer::customerHasAddress($this>id_customer, $this->id_address_delivery)) is empty !!!!!
      The "else" is also used and $id_zone is defined to default country zone id....

      So I think this function can't be used to calculate delivery costs for visitors.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vschoener Vincent SCHOENER
                Reporter:
                geckowebdesign Jérémy kleinclaus
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support