Jump to content

Shipping and delivery


Recommended Posts

Hi,

I want to make my delivery to customer this way

Two mode for delivery method to customer

1) customer can select courier service to ship the item to them

2) If customer order above $100, free deliver.

As customer check out, they are able to select between the 2 option.
However as I do a testing, if found out that even when when customer
order is less than $100, the option No. 2 if there

Is there any settling that I must do in order that if the customer order is below
$100, the option no.2 don't appear?

Please advise me thank you

Link to comment
Share on other sites

I think you should be able to create a price range on carrier no 2 of $100-$1000000, then edit the carrier and change "Out-of-range behavior" to "Disable carrier". That should hide the carrier unless the total order is between $100 and $1000000.

Link to comment
Share on other sites

Turns out there is a bug in the out-of-range behavior that was fixed in v1.3. You need to modify classes/Carrier.php and change the checkDeliveryPriceByPrice function on line 193 from:

static public function checkDeliveryPriceByPrice($id_carrier, $orderTotal, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_price` r ON d.`id_range_price` = r.`id_range_price`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($orderTotal).' <= r.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY r.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}



to:

static public function checkDeliveryPriceByPrice($id_carrier, $orderTotal, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_price` r ON d.`id_range_price` = r.`id_range_price`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($orderTotal).' >= r.`delimiter1`
   AND '.floatval($orderTotal).' < r.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY r.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}



Although it doesn't affect you since you are using price-based shipping, you should also change the checkDeliveryPriceByWeight function on line 136 of classes/Carrier.php from:

static public function checkDeliveryPriceByWeight($id_carrier, $totalWeight, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_weight` w ON d.`id_range_weight` = w.`id_range_weight`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($totalWeight).' <= w.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY w.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}



to:

static public function checkDeliveryPriceByWeight($id_carrier, $totalWeight, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_weight` w ON d.`id_range_weight` = w.`id_range_weight`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($totalWeight).' >= w.`delimiter1`
   AND '.floatval($totalWeight).' < w.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY w.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}

Link to comment
Share on other sites

Hi

I've had a similiar problem and running v 1.2.5 :
I have 2 carriers, Royal mail and Parcelforce with differing weight capacities

1. royal mail (0 – 2kg) at £2.00
2. royal mail (2 – 4kg) at £2.50
3. Parcelforce (0-10000kg) at £10

When the overall weight exceeds 4kg, I would expect the Cart to drop into option 3 (Parcelforce) but it remains with Royal mail ( £2.50) ? I then set the ‘Out of range behaviour’ to disable but now when I exceed 4kg, delivery goes to £0. So the cart on the home page does not show correct total.
But when I then goto the checkout, the cart then re-adjusts for Parcelforce and now shows the correct amount.
All carriers are are shipping to the UK from the UK i.e. in the europe zone.

I've just tried the fix to the classes (checkDeliveryPriceByPrice function, checkDeliveryPriceByWeight function) BUT im still getting the above problem !

Has anyone got it to work ??

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
Turns out there is a bug in the out-of-range behavior that was fixed in v1.3. You need to modify classes/Carrier.php and change the checkDeliveryPriceByPrice function on line 193 from:

static public function checkDeliveryPriceByPrice($id_carrier, $orderTotal, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_price` r ON d.`id_range_price` = r.`id_range_price`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($orderTotal).' <= r.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY r.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}



to:

static public function checkDeliveryPriceByPrice($id_carrier, $orderTotal, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_price` r ON d.`id_range_price` = r.`id_range_price`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($orderTotal).' >= r.`delimiter1`
   AND '.floatval($orderTotal).' < r.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY r.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}



Although it doesn't affect you since you are using price-based shipping, you should also change the checkDeliveryPriceByWeight function on line 136 of classes/Carrier.php from:

static public function checkDeliveryPriceByWeight($id_carrier, $totalWeight, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_weight` w ON d.`id_range_weight` = w.`id_range_weight`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($totalWeight).' <= w.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY w.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}



to:

static public function checkDeliveryPriceByWeight($id_carrier, $totalWeight, $id_zone)
{
   $result = Db::getInstance()->getRow('
   SELECT d.`price`
   FROM `'._DB_PREFIX_.'delivery` d
   LEFT JOIN `'._DB_PREFIX_.'range_weight` w ON d.`id_range_weight` = w.`id_range_weight`
   WHERE d.`id_zone` = '.intval($id_zone).'
   AND '.floatval($totalWeight).' >= w.`delimiter1`
   AND '.floatval($totalWeight).' < w.`delimiter2`
   AND d.`id_carrier` = '.intval($id_carrier).'
   ORDER BY w.`delimiter1` ASC');
   if (!isset($result['price']))
       return false;
   return true;
}



thank you for your fix.

do we need to change other related functions ?;

- getDeliveryPriceByPrice
- getDeliveryPriceByWeight

regards,
Link to comment
Share on other sites

  • 8 months later...

@roastchicken

same problem here using (still) 1.2.5.0. The cart is not responding according to the changes. i don´t even get a "0" for delivery, the whole line is gone then. Did you find a solution? (did already the changes suggested by Rocky)

best

H

Link to comment
Share on other sites

×
×
  • Create New...