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


PHP Pack::deleteItems方法代码示例

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


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

示例1: updatePackItems

 public function updatePackItems($product)
 {
     Pack::deleteItems($product->id);
     if (Tools::getValue('ppack') and $items = Tools::getValue('inputPackItems') and sizeof($ids = array_unique(explode('-', $items)))) {
         if (!Pack::addItems($product->id, $ids)) {
             return false;
         }
     }
     return true;
 }
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:10,代码来源:AdminProducts.php

示例2: updatePackItems

 public function updatePackItems($product)
 {
     Pack::deleteItems($product->id);
     // lines format: QTY x ID-QTY x ID
     if (Tools::getValue('ppack') and $items = Tools::getValue('inputPackItems') and sizeof($lines = array_unique(explode('-', $items)))) {
         foreach ($lines as $line) {
             // line format QTY x ID
             list($qty, $item_id) = explode('x', $line);
             if ($qty > 0 && isset($item_id)) {
                 if (!Pack::addItem((int) $product->id, (int) $item_id, (int) $qty)) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:17,代码来源:AdminProducts.php

示例3: setWsProductBundle

 public function setWsProductBundle($items)
 {
     if ($this->is_virtual) {
         return false;
     }
     Pack::deleteItems($this->id);
     foreach ($items as $item) {
         if ((int) $item['id'] > 0) {
             Pack::addItem($this->id, (int) $item['id'], (int) $item['quantity']);
         }
     }
     return true;
 }
开发者ID:yewed,项目名称:share,代码行数:13,代码来源:Product.php

示例4: importFile

 /**
  * @param $aDataToImported
  * @param $aDataImported
  */
 public function importFile($aDataToImported, &$aDataImported)
 {
     foreach ($aDataToImported as $aData) {
         if (empty($aData['error'])) {
             // Get product information
             $aProduct = NowProduct::getProductLight($aData['id_product']);
             // Gestion des accessoires
             // Delete old accessories
             if (!NowProduct::deleteAccessories($aData['id_product'])) {
                 $aData['error'] = sprintf($this->module->l('Impossible to deleting old accesories to this product: %s', 'AdminNowAllImport'), $aProduct['reference']);
             }
             // Insert new accesssories
             if (!NowProduct::changeAccessories($aData['id_product'], explode('::', $aData['accessories']))) {
                 $aData['error'] = sprintf($this->module->l('Impossible to adding the new accesories to this product: %s', 'AdminNowAllImport'), $aProduct['reference']);
             }
             // Gestion des types de produits
             // On récupère le type de produit
             $oNowProductTypeProduct = NowProductTypeProduct::getObjectByProductId($aData['id_product']);
             if (Validate::isLoadedObject($oNowProductTypeProduct)) {
                 // Il est valide, on le supprime
                 $oNowProductTypeProduct->delete();
             }
             if (isset($aData['id_now_product_type']) && (bool) $aData['id_now_product_type']) {
                 // On l'ajoute de nouveau
                 $oNowProductTypeProduct = new NowProductTypeProduct();
                 $oNowProductTypeProduct->id_product = (int) $aData['id_product'];
                 $oNowProductTypeProduct->id_now_product_type = (int) $aData['id_now_product_type'];
                 $oNowProductTypeProduct->active = (bool) $aData['active'];
                 $oNowProductTypeProduct->add();
             }
             // Gestion des conseils ou idées
             // Delete old ideas or tips
             if (!NowIdeasOrTips::deleteIdeasOrTips($aData['id_product'])) {
                 $aData['error'] = sprintf($this->module->l('Impossible to deleting old ideas or tips to this product: %s', 'AdminNowAllImport'), $aProduct['reference']);
             }
             // Insert new ideas or tips
             if (!NowIdeasOrTips::changeIdeasOrTips($aData['id_product'], explode('::', $aData['ideas_tips']))) {
                 $aData['error'] = sprintf($this->module->l('Impossible to adding the new ideas or tips to this product: %s', 'AdminNowAllImport'), $aProduct['reference']);
             }
             // Gestion des packs de produits
             // Delete old products pack
             if (!Pack::deleteItems($aData['id_product'])) {
                 $aData['error'] = sprintf($this->module->l('Impossible to deleting old product to this product pack: %s', 'AdminNowAllImport'), $aProduct['reference']);
             }
             // Insert new products pack
             if (!NowProduct::changeProductsPacks($aData['id_product'], explode('::', $aData['products_pack']))) {
                 $aData['error'] = sprintf($this->module->l('Impossible to adding the new product to this product pack: %s', 'AdminNowAllImport'), $aProduct['reference']);
             }
             $aDataImported[] = array('id_product' => $aProduct['id_product'], 'product_reference' => $aProduct['reference'], 'product_name' => $aProduct['name'], 'active' => $aData['active'], 'accessories' => isset($aData['accessories']) && $aData['accessories'] ? $this->getNewAccessories($aData['accessories']) : '', 'id_now_product_type' => Validate::isLoadedObject($oNowProductTypeProduct) ? $oNowProductTypeProduct->id_now_product_type : '', 'ideas_tips' => isset($aData['ideas_tips']) && $aData['ideas_tips'] ? $this->getNewIdeasOrTips($aData['ideas_tips']) : '', 'products_pack' => isset($aData['products_pack']) && $aData['products_pack'] ? $this->getNewProductsPacks($aData['products_pack']) : '', 'error' => $aData['error']);
         } else {
             $this->errors[] = $aData['error'];
         }
     }
 }
开发者ID:TheTypoMaster,项目名称:neonflexible,代码行数:58,代码来源:AdminNowAllImport.php

示例5: importProductsPacks

 /**
  * Permet d'importer les nouveaux packs de produits
  * @param $aDataToImported
  * @param $aDataImported
  */
 public function importProductsPacks($aDataToImported, &$aDataImported)
 {
     foreach ($aDataToImported as $aData) {
         if (empty($aData['error'])) {
             // get product information
             $aProduct = NowProduct::getProductLight($aData['id_product']);
             // Delete old products pack
             if (!Pack::deleteItems($aData['id_product'])) {
                 $aData['error'] = sprintf($this->module->l('Impossible to deleting old product to this product pack: %s', 'AdminNowImportPacks'), $aProduct['reference']);
             }
             // Insert new products pack
             if (!NowProduct::changeProductsPacks($aData['id_product'], explode('::', $aData['products_pack']))) {
                 $aData['error'] = sprintf($this->module->l('Impossible to adding the new product to this product pack: %s', 'AdminNowImportPacks'), $aProduct['reference']);
             }
             $aDataImported[] = array('id_product' => $aProduct['id_product'], 'product_reference' => $aProduct['reference'], 'product_name' => $aProduct['name'], 'products_pack' => $this->getNewProductsPacks($aData['products_pack']), 'error' => $aData['error']);
         } else {
             $this->errors[] = $aData['error'];
         }
     }
 }
开发者ID:TheTypoMaster,项目名称:neonflexible,代码行数:25,代码来源:AdminNowImportPacks.php

示例6: updatePackItems

 /**
  * delete all items in pack, then check if type_product value is 2.
  * if yes, add the pack items from input "inputPackItems"
  *
  * @param Product $product
  * @return boolean
  */
 public function updatePackItems($product)
 {
     Pack::deleteItems($product->id);
     // lines format: QTY x ID-QTY x ID
     if (Tools::getValue('type_product') == Product::PTYPE_PACK) {
         $items = Tools::getValue('inputPackItems');
         $lines = array_unique(explode('-', $items));
         // lines is an array of string with format : QTYxID
         if (count($lines)) {
             foreach ($lines as $line) {
                 if (!empty($line)) {
                     list($qty, $item_id) = explode('x', $line);
                     if ($qty > 0 && isset($item_id)) {
                         if (!Pack::addItem((int) $product->id, (int) $item_id, (int) $qty)) {
                             $this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:29,代码来源:AdminProductsController.php


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