示例#1
0
 protected function initializeConfig()
 {
     $defaults = [TNTFranceConfigValue::ENABLED => 0, TNTFranceConfigValue::MODE_PRODUCTION => 0, TNTFranceConfigValue::ACCOUNT_NUMBER => '', TNTFranceConfigValue::USERNAME => '', TNTFranceConfigValue::PASSWORD => '', TNTFranceConfigValue::USE_INDIVIDUAL => 1, TNTFranceConfigValue::USE_ENTERPRISE => 1, TNTFranceConfigValue::USE_DEPOT => 1, TNTFranceConfigValue::USE_DROPOFFPOINT => 1, TNTFranceConfigValue::PRODUCTS_ENABLED => self::DEFAULT_PRODUCTS_ENABLED, TNTFranceConfigValue::OPTIONS_ENABLED => self::DEFAULT_OPTIONS_ENABLED, TNTFranceConfigValue::REGULAR_PICKUP => 0, TNTFranceConfigValue::SENDER_NAME => ConfigQuery::read('store_name', ''), TNTFranceConfigValue::SENDER_ADDRESS1 => ConfigQuery::read('store_address1', ''), TNTFranceConfigValue::SENDER_ADDRESS2 => ConfigQuery::read('store_address2', ''), TNTFranceConfigValue::SENDER_ZIP_CODE => ConfigQuery::read('store_zipcode', ''), TNTFranceConfigValue::SENDER_CITY => ConfigQuery::read('store_city', ''), TNTFranceConfigValue::CONTACT_LASTNAME => '', TNTFranceConfigValue::CONTACT_FIRSTNAME => '', TNTFranceConfigValue::CONTACT_EMAIL => ConfigQuery::read('store_email', ''), TNTFranceConfigValue::CONTACT_PHONE => ConfigQuery::read('store_phone', ''), TNTFranceConfigValue::NOTIFICATION_EMAILS => ConfigQuery::read('store_notification_emails', ''), TNTFranceConfigValue::NOTIFICATION_SUCCESS => 0, TNTFranceConfigValue::LABEL_FORMAT => "STDA4", TNTFranceConfigValue::FREE_SHIPPING => 0, TNTFranceConfigValue::TRACKING_URL => 'http://www.tnt.fr/public/suivi_colis/recherche/visubontransport.do?radiochoixrecherche=BT&bonTransport=%tracking-number%', TNTFranceConfigValue::SURCHARGE_FUEL => 0, TNTFranceConfigValue::SURCHARGE_SECURITY_FEE => 0.36, TNTFranceConfigValue::SURCHARGE_MULTI_PACKAGE => 0.5, TNTFranceConfigValue::SEPARATE_PRODUCT_IN_PACKAGE => 0, TNTFranceConfigValue::OPTION_P_PAYMENT_BACK => 0, TNTFranceConfigValue::OPTION_W_EXPEDITION_UNDER_PROTECTION => 0, TNTFranceConfigValue::OPTION_D_RELAY_PACKAGE => 0, TNTFranceConfigValue::OPTION_Z_HOME_DELIVERY => 0, TNTFranceConfigValue::OPTION_E_WITHOUT_ANNOTATING => 0];
     foreach ($defaults as $configName => $configValue) {
         if (null === self::getConfigValue($configName)) {
             self::setConfigValue($configName, $configValue);
         }
     }
     //If no postage price exists, save the defaults one
     if (null == ($tntPriceWeight = TntPriceWeightQuery::create()->findOne())) {
         foreach (self::getPrices() as $areaId => $tntProducts) {
             foreach ($tntProducts as $productCode => $tntProduct) {
                 $tntPriceWeight = new TntPriceWeight();
                 $tntPriceWeight->setAreaId($areaId)->setTntProductLabel($tntProduct['label'])->setTntProductCode($productCode)->setPrice($tntProduct['price'])->setWeight($tntProduct['weight'])->setPriceKgSup($tntProduct['price_kg_sup'])->save();
             }
         }
     }
 }
 /**
  * Exclude object from result
  *
  * @param   ChildTntPriceWeight $tntPriceWeight Object to remove from the list of results
  *
  * @return ChildTntPriceWeightQuery The current query, for fluid interface
  */
 public function prune($tntPriceWeight = null)
 {
     if ($tntPriceWeight) {
         $this->addUsingAlias(TntPriceWeightTableMap::ID, $tntPriceWeight->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }