コード例 #1
0
 /**
  * Fix for Prestashop version < 1.4.0.2
  *
  * @param float $shippingCosts
  */
 protected function setShippingCosts($shippingCosts)
 {
     $deliveryZones = Db::getInstance()->ExecuteS('SELECT * FROM `' . _DB_PREFIX_ . 'delivery` WHERE `id_carrier` = ' . (int) Configuration::get('SHOPGATE_CARRIER_ID'));
     // create for each zone delivery options
     foreach ($deliveryZones as $deliveryZone) {
         $deliveryRange = new Delivery($deliveryZone['id_delivery']);
         // PS_SHIPPING_HANDLING is a fix to decrease the shipping for the amount that is setted up in the shipping configuration
         $deliveryRange->price = $shippingCosts;
         if (!$deliveryRange->update()) {
             return false;
         }
     }
     return true;
 }