当前位置: 首页>>代码示例>>PHP>>正文


PHP Carrier::update方法代码示例

本文整理汇总了PHP中Carrier::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Carrier::update方法的具体用法?PHP Carrier::update怎么用?PHP Carrier::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carrier的用法示例。


在下文中一共展示了Carrier::update方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uninstall

 public function uninstall()
 {
     if (!parent::uninstall() or !$this->unregisterHook('actionCarrierUpdate') or !Db::getInstance()->Execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'fraktguide_product_names`')) {
         return false;
     } else {
         $carrier_ids_str = Configuration::get('FRAKTGUIDE_CREATED_CARRIER_IDS');
         $carrier_ids = $carrier_ids_str ? explode(';', Configuration::get('FRAKTGUIDE_CREATED_CARRIER_IDS')) : array();
         foreach ($carrier_ids as $carrier_id) {
             $carrier = new Carrier((int) $carrier_id);
             $carrier->deleted = 1;
             if (!$carrier->update()) {
                 return false;
             }
         }
         Configuration::deleteByName('FRAKTGUIDE_CREATED_CARRIER_IDS');
         Configuration::deleteByName('FRAKTGUIDE_CARRIER_IDS');
         Configuration::deleteByName('FRAKTGUIDE_PRODUCTS');
         Configuration::deleteByName('FRAKTGUIDE_EDI');
         Configuration::deleteByName('FRAKTGUIDE_DEBUG_MODE');
         Configuration::deleteByName('FRAKTGUIDE_A_POST_MAX_PRIS');
         Configuration::deleteByName('FRAKTGUIDE_FRA_POSTNUMMER');
         Configuration::deleteByName('FRAKTGUIDE_FORSIKRING');
         Configuration::deleteByName('FRAKTGUIDE_ID_TAX_RULES_GROUP');
         return true;
     }
 }
开发者ID:nilsga,项目名称:prestashop-fraktguide,代码行数:26,代码来源:fraktguide.php

示例2: uninstallCarrier

 private function uninstallCarrier($carrierId)
 {
     //$carrierId = $this->carrierId();
     if (!is_null($carrierId)) {
         $carrier = new Carrier($carrierId);
         $langDefault = (int) Configuration::get('PS_LANG_DEFAULT');
         $carriers = Carrier::getCarriers($langDefault, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
         // Если наш перевозчик был по умолчанию, назначим кого-нибудь другого
         if (Configuration::get('PS_CARRIER_DEFAULT') == $carrierId) {
             foreach ($carriers as $c) {
                 if ($c['active'] && !$c['deleted'] && $c['name'] != $carrier->name) {
                     Configuration::updateValue('PS_CARRIER_DEFAULT', $c['id_carrier']);
                 }
             }
         }
         if (!$carrier->deleted) {
             $carrier->deleted = 1;
             if (!$carrier->update()) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:qant,项目名称:russianpostcarrier,代码行数:24,代码来源:russianpostcarrier.php

示例3: deleteShowShipping

 public function deleteShowShipping()
 {
     foreach ($this->carriers as $value) {
         $carriers = new Carrier((int) Configuration::get(self::PREFIX . $value));
         if ($carriers->deleted == '0') {
             $carriers->deleted = 1;
             $carriers->update();
             $previousPage = $_SERVER["HTTP_REFERER"];
             Tools::redirect($previousPage);
         }
     }
 }
开发者ID:Send24com,项目名称:Send24-for-Prestashop,代码行数:12,代码来源:send24.php

示例4: uninstall

 public function uninstall()
 {
     global $cookie;
     $so_id = (int) Configuration::get('SOCOLISSIMO_CARRIER_ID');
     if (!parent::uninstall() or !Db::getInstance()->Execute('DROP TABLE IF EXISTS`' . _DB_PREFIX_ . 'socolissimo_delivery_info`') or !$this->unregisterHook('extraCarrier') or !$this->unregisterHook('payment') or !$this->unregisterHook('AdminOrder') or !$this->unregisterHook('newOrder') or !$this->unregisterHook('updateCarrier') or !Configuration::deleteByName('SOCOLISSIMO_ID') or !Configuration::deleteByName('SOCOLISSIMO_KEY') or !Configuration::deleteByName('SOCOLISSIMO_URL') or !Configuration::deleteByName('SOCOLISSIMO_OVERCOST') or !Configuration::deleteByName('SOCOLISSIMO_PREPARATION_TIME') or !Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID') or !Configuration::deleteByName('SOCOLISSIMO_SUP') or !Configuration::deleteByName('SOCOLISSIMO_SUP_URL') or !Configuration::deleteByName('SOCOLISSIMO_OVERCOST_TAX')) {
         return false;
     }
     //Delete So Carrier
     $soCarrier = new Carrier($so_id);
     //if socolissimo carrier is default set other one as default
     if (Configuration::get('PS_CARRIER_DEFAULT') == (int) $soCarrier->id) {
         $carriersD = Carrier::getCarriers((int) $cookie->id_lang);
         foreach ($carriersD as $carrierD) {
             if ($carrierD['active'] and !$carrierD['deleted'] and $carrierD['name'] != $this->_config['name']) {
                 Configuration::updateValue('PS_CARRIER_DEFAULT', $carrierD['id_carrier']);
             }
         }
     }
     //save old carrier id
     Configuration::updateValue('SOCOLISSIMO_CARRIER_ID_HIST', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST') . '|' . (int) $soCarrier->id);
     $soCarrier->deleted = 1;
     if (!$soCarrier->update()) {
         return false;
     }
     return true;
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:26,代码来源:socolissimo.php

示例5: ajaxProcessFinishStep

 public function ajaxProcessFinishStep()
 {
     $return = array('has_error' => false);
     if (!$this->access('edit')) {
         $return = array('has_error' => true, $return['errors'][] = $this->trans('You do not have permission to use this wizard.', array(), 'Admin.Shipping.Notification'));
     } else {
         $this->validateForm(false);
         if ($id_carrier = Tools::getValue('id_carrier')) {
             $current_carrier = new Carrier((int) $id_carrier);
             // if update we duplicate current Carrier
             /** @var Carrier $new_carrier */
             $new_carrier = $current_carrier->duplicateObject();
             if (Validate::isLoadedObject($new_carrier)) {
                 // Set flag deteled to true for historization
                 $current_carrier->deleted = true;
                 $current_carrier->update();
                 // Fill the new carrier object
                 $this->copyFromPost($new_carrier, $this->table);
                 $new_carrier->position = $current_carrier->position;
                 $new_carrier->update();
                 $this->updateAssoShop((int) $new_carrier->id);
                 $this->duplicateLogo((int) $new_carrier->id, (int) $current_carrier->id);
                 $this->changeGroups((int) $new_carrier->id);
                 //Copy default carrier
                 if (Configuration::get('PS_CARRIER_DEFAULT') == $current_carrier->id) {
                     Configuration::updateValue('PS_CARRIER_DEFAULT', (int) $new_carrier->id);
                 }
                 // Call of hooks
                 Hook::exec('actionCarrierUpdate', array('id_carrier' => (int) $current_carrier->id, 'carrier' => $new_carrier));
                 $this->postImage($new_carrier->id);
                 $this->changeZones($new_carrier->id);
                 $new_carrier->setTaxRulesGroup((int) Tools::getValue('id_tax_rules_group'));
                 $carrier = $new_carrier;
             }
         } else {
             $carrier = new Carrier();
             $this->copyFromPost($carrier, $this->table);
             if (!$carrier->add()) {
                 $return['has_error'] = true;
                 $return['errors'][] = $this->trans('An error occurred while saving this carrier.', array(), 'Admin.Shipping.Notification');
             }
         }
         if ($carrier->is_free) {
             //if carrier is free delete shipping cost
             $carrier->deleteDeliveryPrice('range_weight');
             $carrier->deleteDeliveryPrice('range_price');
         }
         if (Validate::isLoadedObject($carrier)) {
             if (!$this->changeGroups((int) $carrier->id)) {
                 $return['has_error'] = true;
                 $return['errors'][] = $this->trans('An error occurred while saving carrier groups.', array(), 'Admin.Shipping.Notification');
             }
             if (!$this->changeZones((int) $carrier->id)) {
                 $return['has_error'] = true;
                 $return['errors'][] = $this->trans('An error occurred while saving carrier zones.', array(), 'Admin.Shipping.Notification');
             }
             if (!$carrier->is_free) {
                 if (!$this->processRanges((int) $carrier->id)) {
                     $return['has_error'] = true;
                     $return['errors'][] = $this->trans('An error occurred while saving carrier ranges.', array(), 'Admin.Shipping.Notification');
                 }
             }
             if (Shop::isFeatureActive() && !$this->updateAssoShop((int) $carrier->id)) {
                 $return['has_error'] = true;
                 $return['errors'][] = $this->trans('An error occurred while saving associations of shops.', array(), 'Admin.Shipping.Notification');
             }
             if (!$carrier->setTaxRulesGroup((int) Tools::getValue('id_tax_rules_group'))) {
                 $return['has_error'] = true;
                 $return['errors'][] = $this->trans('An error occurred while saving the tax rules group.', array(), 'Admin.Shipping.Notification');
             }
             if (Tools::getValue('logo')) {
                 if (Tools::getValue('logo') == 'null' && file_exists(_PS_SHIP_IMG_DIR_ . $carrier->id . '.jpg')) {
                     unlink(_PS_SHIP_IMG_DIR_ . $carrier->id . '.jpg');
                 } else {
                     $logo = basename(Tools::getValue('logo'));
                     if (!file_exists(_PS_TMP_IMG_DIR_ . $logo) || !copy(_PS_TMP_IMG_DIR_ . $logo, _PS_SHIP_IMG_DIR_ . $carrier->id . '.jpg')) {
                         $return['has_error'] = true;
                         $return['errors'][] = $this->trans('An error occurred while saving carrier logo.', array(), 'Admin.Shipping.Notification');
                     }
                 }
             }
             $return['id_carrier'] = $carrier->id;
         }
     }
     die(json_encode($return));
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:86,代码来源:AdminCarrierWizardController.php

示例6: uninstall

 public function uninstall()
 {
     // Uninstall
     if (!parent::uninstall() || !Configuration::deleteByName('COURIERSERVICE_OVERCOST') || !Configuration::deleteByName('DELIVERYPOINTS_OVERCOST') || !$this->unregisterHook('updateCarrier') || !$this->unregisterHook('displayBackOfficeHeader') || !DpdCarrierOptions::uninstallDb() || !DpdDeliveryPoints::uninstallDb() || !DpdOrderOptions::uninstallDb() || !DpdDeliveryPrice::uninstallDb()) {
         //          || !$this->removeBulkActionButtons() //Using this only if Overwrite using already other model!
         return false;
     }
     // Delete External Carrier
     $carrier1 = new Carrier((int) Configuration::get('COURIERSERVICE_CARRIER_ID'));
     $carrier2 = new Carrier((int) Configuration::get('DELIVERYPOINTS_CARRIER_ID'));
     // If external carrier is default set other one as default
     if (Configuration::get('PS_CARRIER_DEFAULT') == (int) $carrier1->id || Configuration::get('PS_CARRIER_DEFAULT') == (int) $carrier2->id) {
         $carriers_d = Carrier::getCarriers(Context::getContext()->cookie->id_lang, true, false, false, null, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
         foreach ($carriers_d as $carrier_d) {
             if ($carrier_d['active'] && !$carrier_d['deleted'] && $carrier_d['name'] != $this->_config['name']) {
                 Configuration::updateValue('PS_CARRIER_DEFAULT', $carrier_d['id_carrier']);
             }
         }
     }
     // Then delete Carrier
     $carrier1->deleted = 1;
     $carrier2->deleted = 1;
     if (!$carrier1->update() || !$carrier2->update()) {
         return false;
     }
     $settings = array(self::CONST_PREFIX . 'ENABLED', self::CONST_PREFIX . 'SERVICE_USERNAME', self::CONST_PREFIX . 'SERVICE_USERPASS', self::CONST_PREFIX . 'SERVICE_USERID', self::CONST_PREFIX . 'API_URL', self::CONST_PREFIX . 'BTNSUBMIT', self::CONST_PREFIX . 'TAB', self::CONST_PREFIX . 'USERNAME');
     foreach ($settings as $setting) {
         Configuration::deleteByName($setting);
     }
     $tab = new Tab(Tab::getIdFromClassName('AdminCallcarrier'));
     $tab->delete();
     return true;
 }
开发者ID:uab-balticode,项目名称:dpd-shipping-module-prestashop-2,代码行数:33,代码来源:dynamicparceldistribution.php

示例7: uninstall

 public function uninstall()
 {
     $so_id = (int) Configuration::get('SOCOLISSIMO_CARRIER_ID');
     $so_id_seller = (int) Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER');
     Configuration::deleteByName('SOCOLISSIMO_ID');
     Configuration::deleteByName('SOCOLISSIMO_VERSION');
     Configuration::deleteByName('SOCOLISSIMO_USE_FANCYBOX');
     Configuration::deleteByName('SOCOLISSIMO_USE_IFRAME');
     Configuration::deleteByName('SOCOLISSIMO_KEY');
     Configuration::deleteByName('SOCOLISSIMO_URL');
     Configuration::deleteByName('SOCOLISSIMO_URL_MOBILE');
     Configuration::deleteByName('SOCOLISSIMO_OVERCOST');
     Configuration::deleteByName('SOCOLISSIMO_COST_SELLER');
     Configuration::deleteByName('SOCOLISSIMO_UPG_COUNTRY');
     Configuration::deleteByName('SOCOLISSIMO_PREPARATION_TIME');
     Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID');
     Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID_SELLER');
     Configuration::deleteByName('SOCOLISSIMO_SUP');
     Configuration::deleteByName('SOCOLISSIMO_EXP_BEL');
     Configuration::deleteByName('SOCOLISSIMO_SUP_BELG');
     Configuration::deleteByName('SOCOLISSIMO_SUP_URL');
     Configuration::deleteByName('SOCOLISSIMO_OVERCOST_TAX');
     if (!parent::uninstall() || !Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'socolissimo_delivery_info`') || !$this->unregisterHook('extraCarrier') || !$this->unregisterHook('payment') || !$this->unregisterHook('AdminOrder') || !$this->unregisterHook('newOrder') || !$this->unregisterHook('updateCarrier') || !$this->unregisterHook('paymentTop') || !$this->unregisterHook('backOfficeHeader')) {
         return false;
     }
     // Delete So Carrier
     $so_carrier = new Carrier($so_id);
     // If socolissimo carrier is default set other one as default
     if (Configuration::get('PS_CARRIER_DEFAULT') == (int) $so_carrier->id) {
         $carriers_d = Carrier::getCarriers($this->context->language->id);
         foreach ($carriers_d as $carrier_d) {
             if ($carrier_d['active'] && !$carrier_d['deleted'] && $carrier_d['name'] != $this->config['name']) {
                 Configuration::updateValue('PS_CARRIER_DEFAULT', $carrier_d['id_carrier']);
             }
         }
     }
     // Save old carrier id
     Configuration::updateValue('SOCOLISSIMO_CARRIER_ID_HIST', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST') . '|' . (int) $so_carrier->id);
     $so_carrier->deleted = 1;
     if (!$so_carrier->update()) {
         return false;
     }
     // Delete So Carrier Seller
     $so_carrier = new Carrier($so_id_seller);
     // If socolissimo carrier is default set other one as default
     if (Configuration::get('PS_CARRIER_DEFAULT') == (int) $so_carrier->id) {
         $carriers_d = Carrier::getCarriers($this->context->language->id);
         foreach ($carriers_d as $carrier_d) {
             if ($carrier_d['active'] && !$carrier_d['deleted'] && $carrier_d['name'] != $this->config['name']) {
                 Configuration::updateValue('PS_CARRIER_DEFAULT', $carrier_d['id_carrier']);
             }
         }
     }
     // Save old carrier id
     Configuration::updateValue('SOCOLISSIMO_CARRIER_ID_HIST', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST') . '|' . (int) $so_carrier->id);
     $so_carrier->deleted = 1;
     if (!$so_carrier->update()) {
         return false;
     }
     return true;
 }
开发者ID:sylvaincha,项目名称:Prestashop-SoColissimo,代码行数:61,代码来源:socolissimo.php

示例8: addOrder

 /**
  * @param ShopgateOrder $order
  *
  * @return array
  * @throws PrestaShopException
  * @throws ShopgateLibraryException
  */
 public function addOrder(ShopgateOrder $order)
 {
     /**
      * check exits shopgate order
      */
     if (ShopgateOrderPrestashop::loadByOrderNumber($order->getOrderNumber())->status == 1) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_DUPLICATE_ORDER, sprintf('external_order_id: %s', $order->getOrderNumber()), true);
     }
     /** @var CarrierCore $sgCarrier */
     $sgCarrier = new Carrier(Configuration::get('SG_CARRIER_ID'));
     if (version_compare(_PS_VERSION_, '1.5.0', '<') && empty($sgCarrier->name)) {
         $sgCarrier->name = 'shopgate_tmp_carrier';
     }
     if ($order->getShippingType() != ShopgateShipping::DEFAULT_PLUGIN_API_KEY) {
         if ($order->getShippingInfos()->getAmount() > 0) {
             if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
                 ShopgateModObjectModel::updateShippingPrice(pSQL($order->getShippingInfos()->getAmount()));
             } else {
                 $data = array('price' => pSQL($order->getShippingInfos()->getAmount()));
                 $where = 'a.id_carrier = ' . (int) Configuration::get('SG_CARRIER_ID');
                 ObjectModel::updateMultishopTable('Delivery', $data, $where);
             }
             $sgCarrier->is_free = 0;
         } else {
             $sgCarrier->is_free = 1;
         }
     }
     $sgCarrier->update();
     $customerModel = new ShopgateItemsCustomerImportJson($this->getPlugin());
     $paymentModel = new ShopgatePayment($this->getModule());
     $shippingModel = new ShopgateShipping($this->getModule());
     /**
      * read / check customer
      */
     if (!($customerId = Customer::customerExists($order->getMail(), true, false))) {
         /**
          * prepare customer
          */
         $shopgateCustomerItem = new ShopgateCustomer();
         $shopgateCustomerItem->setLastName($order->getInvoiceAddress()->getLastName());
         $shopgateCustomerItem->setFirstName($order->getInvoiceAddress()->getFirstName());
         $shopgateCustomerItem->setGender($order->getInvoiceAddress()->getGender());
         $shopgateCustomerItem->setBirthday($order->getInvoiceAddress()->getBirthday());
         $shopgateCustomerItem->setNewsletterSubscription(Configuration::get('SG_SUBSCRIBE_NEWSLETTER') ? true : false);
         $customerId = $customerModel->registerCustomer($order->getMail(), md5(_COOKIE_KEY_ . time()), $shopgateCustomerItem);
     }
     /** @var CustomerCore $customer */
     $customer = new Customer($customerId);
     /**
      * prepare cart
      */
     if (!$order->getDeliveryAddress()->getPhone()) {
         $order->getDeliveryAddress()->setPhone($order->getPhone());
     }
     if (!$order->getInvoiceAddress()->getPhone()) {
         $order->getInvoiceAddress()->setPhone($order->getPhone());
     }
     $this->getCart()->id_address_delivery = $customerModel->createAddress($order->getDeliveryAddress(), $customer);
     $this->getCart()->id_address_invoice = $customerModel->createAddress($order->getInvoiceAddress(), $customer);
     $this->getCart()->id_customer = $customerId;
     // id_guest is a connection to a ps_guest entry which includes screen width etc.
     // is_guest field only exists in Prestashop 1.4.1.0 and higher
     if (version_compare(_PS_VERSION_, '1.4.1.0', '>=')) {
         $this->getCart()->id_guest = $customer->is_guest;
     }
     $this->getCart()->secure_key = $customer->secure_key;
     $this->getCart()->id_carrier = $shippingModel->getCarrierIdByApiOrder($order);
     $shopgateCustomFieldsHelper = new ShopgateCustomFieldsHelper();
     $shopgateCustomFieldsHelper->saveCustomFields($this->getCart(), $order->getCustomFields());
     $this->getCart()->add();
     /**
      * add cart items
      */
     $canCreateOrder = true;
     $errorMessages = array();
     foreach ($order->getItems() as $item) {
         list($productId, $attributeId) = ShopgateHelper::getProductIdentifiers($item);
         if ($productId == 0) {
             continue;
         }
         $updateCart = $this->getCart()->updateQty($item->getQuantity(), $productId, $attributeId, false, 'up', $this->getCart()->id_address_delivery);
         if ($updateCart !== true) {
             $canCreateOrder = false;
             $errorMessages[] = array('product_id' => $productId, 'attribute_id' => $attributeId, 'quantity' => $item->getQuantity(), 'result' => $updateCart, 'reason' => $updateCart == -1 ? 'minimum quantity not reached' : '');
         }
     }
     /**
      * coupons
      */
     foreach ($order->getExternalCoupons() as $coupon) {
         /** @var CartRuleCore $cartRule */
         $cartRule = new CartRule(CartRule::getIdByCode($coupon->getCode()));
         if (Validate::isLoadedObject($cartRule)) {
//.........这里部分代码省略.........
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:101,代码来源:Json.php

示例9: unistallExternalCarrier

 public function unistallExternalCarrier($id_carrier)
 {
     if ((int) $id_carrier) {
         $Carrier1 = new Carrier((int) $id_carrier);
         // If external carrier is default set other one as default
         if (Configuration::get('PS_CARRIER_DEFAULT') == (int) $Carrier1->id) {
             $this->module->_errors[] = 'Please select different default carrier before uninstall';
             return false;
         }
         // Then delete Carrier
         $Carrier1->deleted = 1;
         if (!$Carrier1->update()) {
             return false;
         }
     }
     return true;
 }
开发者ID:ulozenka,项目名称:prestashop-1-5,代码行数:17,代码来源:PrestahostModuleInstall.php

示例10: uninstall

 public function uninstall()
 {
     global $cookie;
     if (!parent::uninstall() or !Db::getInstance()->Execute('DROP TABLE IF EXISTS`' . _DB_PREFIX_ . 'socolissimo_delivery_info`') or !$this->unregisterHook('extraCarrier') or !$this->unregisterHook('payment') or !$this->unregisterHook('AdminOrder') or !Configuration::deleteByName('SOCOLISSIMO_ID') or !$this->unregisterHook('newOrder') or !$this->unregisterHook('updateCarrier') or !Configuration::deleteByName('SOCOLISSIMO_KEY') or !Configuration::deleteByName('SOCOLISSIMO_URL') or !Configuration::deleteByName('SOCOLISSIMO_EXP_BEL') or !Configuration::deleteByName('SOCOLISSIMO_VERSION') or !Configuration::deleteByName('SOCOLISSIMO_SUP_BELG') or !Configuration::deleteByName('SOCOLISSIMO_COST_SELLER') or !Configuration::deleteByName('SOCOLISSIMO_OVERCOST') or !Configuration::deleteByName('SOCOLISSIMO_PREPARATION_TIME') or !Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID') or !Configuration::deleteByName('SOCOLISSIMO_PRODUCT_ID') or !Configuration::deleteByName('SOCOLISSIMO_CAT_ID') or !Configuration::deleteByName('SOCOLISSIMO_SUP') or !Configuration::deleteByName('SOCOLISSIMO_SUP_URL') or !Configuration::deleteByName('SOCOLISSIMO_OVERCOST_TAX')) {
         return false;
     }
     //Delete So Carrier
     $soCarrier = new Carrier(intval(Configuration::get('SOCOLISSIMO_CARRIER_ID')));
     //if socolissimo carrier is default set other one as default
     if (Configuration::get('PS_CARRIER_DEFAULT') == intval($soCarrier->id)) {
         $carriersD = Carrier::getCarriers(intval($cookie->id_lang));
         foreach ($carriersD as $carrierD) {
             if ($carrierD['active'] and !$carrierD['deleted'] and $carrierD['name'] != $this->_config['name']) {
                 Configuration::updateValue('PS_CARRIER_DEFAULT', $carrierD['id_carrier']);
             }
         }
     }
     //save old carrier id
     Configuration::updateValue('SOCOLISSIMO_CARRIER_ID_HIST', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST') . '|' . intval($soCarrier->id));
     $soCarrier->deleted = 1;
     if (!$soCarrier->update()) {
         return false;
     }
     //Delete So Carrier
     $soCarrier = new Carrier(intval(Configuration::get('SOCOLISSIMO_CARRIER_ID_SELLER')));
     //if socolissimo carrier is default set other one as default
     if (Configuration::get('PS_CARRIER_DEFAULT') == intval($soCarrier->id)) {
         $carriersD = Carrier::getCarriers(intval($cookie->id_lang));
         foreach ($carriersD as $carrierD) {
             if ($carrierD['active'] and !$carrierD['deleted'] and $carrierD['name'] != $this->_config['name']) {
                 Configuration::updateValue('PS_CARRIER_DEFAULT', $carrierD['id_carrier']);
             }
         }
     }
     //save old carrier id
     Configuration::updateValue('SOCOLISSIMO_CARRIER_ID_HIST', Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST') . '|' . intval($soCarrier->id));
     $soCarrier->deleted = 1;
     if (!$soCarrier->update()) {
         return false;
     }
     //delete hidden category and product overcost
     if (Configuration::get('SOCOLISSIMO_CAT_ID') != '' and Configuration::get('SOCOLISSIMO_PRODUCT_ID') != '') {
         $category = new Category(Configuration::get('SOCOLISSIMO_CAT_ID'));
         $product = new Product(Configuration::get('SOCOLISSIMO_PRODUCT_ID'));
         $category->delete();
         $product->delete();
     }
     return true;
 }
开发者ID:quadra-informatique,项目名称:SoColissimo-1.x-PrestaShop,代码行数:49,代码来源:socolissimo.php


注:本文中的Carrier::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。