private function postProcess($skip = array('tab', 'btnSubmit'))
 {
     $data = $_POST;
     //Configuration::updateValue(self::CONST_PREFIX.Tools::strtoupper('delivery_time'), self::$defaultValues['DELIVERY_TIME']);
     //This save delivery times to database, if you wanna edit this remove this line and uncomment lines in configure.tpl collector
     foreach ($data as $name => $value) {
         if (in_array($name, $skip)) {
             continue;
             //Skip not infomative fields
         }
         if (is_array($value)) {
             $value = serialize(Tools::getValue($name));
         } else {
             $value = Tools::getValue($name);
             //if array so serilizse it
         }
         Configuration::updateValue(self::CONST_PREFIX . Tools::strtoupper($name), $value);
     }
     $carrier = new Carrier();
     $id_shop = null;
     if ($carrier->isLangMultishop()) {
         $id_shop = Context::getContext()->shop->id;
     }
     $file = Tools::fileAttachment('carrier_post_price');
     if ($file !== null) {
         DpdDeliveryPrice::importFromCsv($file, (int) Configuration::get('COURIERSERVICE_CARRIER_ID'), $id_shop);
     }
     $file = Tools::fileAttachment('pickup_post_price');
     if ($file !== null) {
         DpdDeliveryPrice::importFromCsv($file, (int) Configuration::get('DELIVERYPOINTS_CARRIER_ID'), $id_shop);
     }
 }
 /**
  * Grab Shipping CSV price
  *
  * @param  cart (object)
  * @param  string - Id carrier
  * @return mix                 boolean false if price shipping not allowed
  *                             float price of shipping
  */
 public static function getCsvShippingCost($cartObject, $id_carrier, $post_code, $id_shop)
 {
     $currentPrice = false;
     $weight = array();
     //Do we have settings for this postcode?
     if (!DpdDeliveryPrice::isExistPostCode($post_code, $id_carrier, $id_shop)) {
         return false;
     }
     //Grab restrictions by this post code carrier and shop
     $carrier_package_size = DpdDeliveryPrice::getDeliveryPrice($post_code, $id_carrier, $id_shop);
     foreach ($carrier_package_size as $key => $row) {
         $weight[$key] = $row['weight'];
     }
     array_multisort($weight, SORT_DESC, $carrier_package_size);
     //SORTING FROM BIGER TO SMALLER
     $cartData = BalticodeDpdData::getCartProductsWeight($cartObject);
     $totalCartWeight = array_sum($cartData['weight']);
     $cartProductsDimensions = BalticodeDpdData::getCartProductsDimensions($cartObject);
     $correctRestriction = array();
     foreach ($carrier_package_size as $currentRestriction) {
         if ((double) $currentRestriction['weight'] < (double) $totalCartWeight) {
             //This currentRestriction is smaller that we have, so we test it allowed to overweight.
             if ($currentRestriction['overweight_price'] > 0) {
                 //Overweight is allowed?
                 if ((double) $currentRestriction['height'] < (double) max($cartProductsDimensions['height']) || (double) $currentRestriction['width'] < (double) max($cartProductsDimensions['width']) || (double) $currentRestriction['depth'] < (double) max($cartProductsDimensions['depth'])) {
                     //if this restriction is to smaller that we want)
                     if ((double) $currentRestriction['oversized_price'] > 0) {
                         //Oversize is allowed
                         $correctRestriction = $currentRestriction;
                     } else {
                         return false;
                         //oversize is not available
                     }
                 } else {
                     $correctRestriction = $currentRestriction;
                 }
             }
             continue;
             //Stop foreach we do not need smaller restrictions
         } else {
             if ((double) $currentRestriction['height'] < (double) max($cartProductsDimensions['height']) || (double) $currentRestriction['width'] < (double) max($cartProductsDimensions['width']) || (double) $currentRestriction['depth'] < (double) max($cartProductsDimensions['depth'])) {
                 //if this restriction is to big that we want
                 if ((double) $currentRestriction['oversized_price'] > 0) {
                     //Oversize is allowed?
                     $correctRestriction = $currentRestriction;
                 } else {
                     return false;
                     //oversize is not available
                 }
             } else {
                 $correctRestriction = $currentRestriction;
             }
         }
     }
     //We no not found any restriction by this cart so this method is not available... return false
     if (!count($correctRestriction)) {
         return false;
     }
     //Now we have one restriction, from where need get price
     if ($correctRestriction['free_from_price'] >= 0) {
         //If free shipping is allowed
         if (BalticodeDpdData::getOrderPriceToral($cartObject) >= $correctRestriction['free_from_price']) {
             return (double) 0.0;
             //Return free shipping
         }
     }
     $currentPrice = (double) $correctRestriction['price'];
     //Apply base price
     //Do we have overweight?
     if ((double) $currentRestriction['weight'] < (double) $totalCartWeight) {
         if ($currentRestriction['overweight_price'] > 0) {
             //Test again we accept overweight?
             $currentPrice += (double) $currentRestriction['overweight_price'];
             //Plus overweight price
         }
     }
     //Do we have oversize?
     if ((double) $currentRestriction['height'] < (double) max($cartProductsDimensions['height']) || (double) $currentRestriction['width'] < (double) max($cartProductsDimensions['width']) || (double) $currentRestriction['depth'] < (double) max($cartProductsDimensions['depth'])) {
         //if this restriction is to smaller that we want
         if ($currentRestriction['oversized_price'] > 0) {
             //Test again we accept oversize?
             $currentPrice += (double) $currentRestriction['oversized_price'];
             //Plus oversize price
         }
     }
     return $currentPrice;
     //Return final price
 }