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


PHP StockAvailable::removeProductFromStockAvailable方法代码示例

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


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

示例1: delete

 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     // Removes the product from StockAvailable, for the current shop
     StockAvailable::removeProductFromStockAvailable((int) $this->id_product, (int) $this->id);
     if (!$this->hasMultishopEntries() && !$this->deleteAssociations()) {
         return false;
     }
     return true;
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:12,代码来源:Combination.php

示例2: delete

 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     // Removes the product from StockAvailable, for the current shop
     StockAvailable::removeProductFromStockAvailable((int) $this->id_product, (int) $this->id);
     if ($specific_prices = SpecificPrice::getByProductId((int) $this->id_product, (int) $this->id)) {
         foreach ($specific_prices as $specific_price) {
             $price = new SpecificPrice((int) $specific_price['id_specific_price']);
             $price->delete();
         }
     }
     if (!$this->hasMultishopEntries() && !$this->deleteAssociations()) {
         return false;
     }
     return true;
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:18,代码来源:Combination.php

示例3: delete

 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     // Removes the product from StockAvailable, for the current shop
     StockAvailable::removeProductFromStockAvailable((int) $this->id_product, (int) $this->id);
     if ($specific_prices = SpecificPrice::getByProductId((int) $this->id_product, (int) $this->id)) {
         foreach ($specific_prices as $specific_price) {
             $price = new SpecificPrice((int) $specific_price['id_specific_price']);
             $price->delete();
         }
     }
     if (!$this->hasMultishopEntries() && !$this->deleteAssociations()) {
         return false;
     }
     $this->deleteFromSupplier($this->id_product);
     Product::updateDefaultAttribute($this->id_product);
     Tools::clearColorListCache((int) $this->id_product);
     return true;
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:21,代码来源:Combination.php

示例4: processGenerate

 public function processGenerate()
 {
     if (!is_array(Tools::getValue('options'))) {
         $this->errors[] = Tools::displayError('Please select at least one attribute.');
     } else {
         $tab = array_values(Tools::getValue('options'));
         if (count($tab) && Validate::isLoadedObject($this->product)) {
             AdminAttributeGeneratorController::setAttributesImpacts($this->product->id, $tab);
             $this->combinations = array_values(AdminAttributeGeneratorController::createCombinations($tab));
             $values = array_values(array_map(array($this, 'addAttribute'), $this->combinations));
             // @since 1.5.0
             if ($this->product->depends_on_stock == 0) {
                 $attributes = Product::getProductAttributesIds($this->product->id, true);
                 foreach ($attributes as $attribute) {
                     StockAvailable::removeProductFromStockAvailable($this->product->id, $attribute['id_product_attribute'], Context::getContext()->shop);
                 }
             }
             SpecificPriceRule::disableAnyApplication();
             $this->product->deleteProductAttributes();
             $this->product->generateMultipleCombinations($values, $this->combinations);
             // @since 1.5.0
             if ($this->product->depends_on_stock == 0) {
                 $attributes = Product::getProductAttributesIds($this->product->id, true);
                 $quantity = str_replace(',', '.', Tools::getValue('quantity'));
                 foreach ($attributes as $attribute) {
                     StockAvailable::setQuantity($this->product->id, $attribute['id_product_attribute'], $quantity);
                 }
             } else {
                 StockAvailable::synchronize($this->product->id);
             }
             SpecificPriceRule::enableAnyApplication();
             SpecificPriceRule::applyAllRules(array((int) $this->product->id));
             Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts') . '&id_product=' . (int) Tools::getValue('id_product') . '&updateproduct&key_tab=Combinations&conf=4');
         } else {
             $this->errors[] = Tools::displayError('Unable to initialize these parameters. A combination is missing or an object cannot be loaded.');
         }
     }
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:38,代码来源:AdminAttributeGeneratorController.php

示例5: processGenerate

 public function processGenerate()
 {
     if (!is_array(Tools::getValue('options'))) {
         $this->errors[] = $this->trans('Please select at least one attribute.', array(), 'Admin.Catalog.Notification');
     } else {
         $tab = array_values(Tools::getValue('options'));
         if (count($tab) && Validate::isLoadedObject($this->product)) {
             AdminAttributeGeneratorController::setAttributesImpacts($this->product->id, $tab);
             $this->combinations = array_values(AdminAttributeGeneratorController::createCombinations($tab));
             $values = array_values(array_map(array($this, 'addAttribute'), $this->combinations));
             // @since 1.5.0
             if ($this->product->depends_on_stock == 0) {
                 $attributes = Product::getProductAttributesIds($this->product->id, true);
                 foreach ($attributes as $attribute) {
                     StockAvailable::removeProductFromStockAvailable($this->product->id, $attribute['id_product_attribute'], Context::getContext()->shop);
                 }
             }
             SpecificPriceRule::disableAnyApplication();
             $this->product->deleteProductAttributes();
             $this->product->generateMultipleCombinations($values, $this->combinations);
             // Reset cached default attribute for the product and get a new one
             Product::getDefaultAttribute($this->product->id, 0, true);
             Product::updateDefaultAttribute($this->product->id);
             // @since 1.5.0
             if ($this->product->depends_on_stock == 0) {
                 $attributes = Product::getProductAttributesIds($this->product->id, true);
                 $quantity = (int) Tools::getValue('quantity');
                 foreach ($attributes as $attribute) {
                     if (Shop::getContext() == Shop::CONTEXT_ALL) {
                         $shops_list = Shop::getShops();
                         if (is_array($shops_list)) {
                             foreach ($shops_list as $current_shop) {
                                 if (isset($current_shop['id_shop']) && (int) $current_shop['id_shop'] > 0) {
                                     StockAvailable::setQuantity($this->product->id, (int) $attribute['id_product_attribute'], $quantity, (int) $current_shop['id_shop']);
                                 }
                             }
                         }
                     } else {
                         StockAvailable::setQuantity($this->product->id, (int) $attribute['id_product_attribute'], $quantity);
                     }
                 }
             } else {
                 StockAvailable::synchronize($this->product->id);
             }
             SpecificPriceRule::enableAnyApplication();
             SpecificPriceRule::applyAllRules(array((int) $this->product->id));
             Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts') . '&id_product=' . (int) Tools::getValue('id_product') . '&updateproduct&key_tab=Combinations&conf=4');
         } else {
             $this->errors[] = $this->trans('Unable to initialize these parameters. A combination is missing or an object cannot be loaded.');
         }
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:52,代码来源:AdminAttributeGeneratorController.php

示例6: delete

 public function delete()
 {
     /*
      * @since 1.5.0
      * It is NOT possible to delete a product if there are currently:
      * - physical stock for this product
      * - supply order(s) for this product
      */
     if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $this->advanced_stock_management) {
         $stock_manager = StockManagerFactory::getManager();
         $physical_quantity = $stock_manager->getProductPhysicalQuantities($this->id, 0);
         $real_quantity = $stock_manager->getProductRealQuantities($this->id, 0);
         if ($physical_quantity > 0) {
             return false;
         }
         if ($real_quantity > $physical_quantity) {
             return false;
         }
     }
     // Removes the product from StockAvailable, for the current shop
     StockAvailable::removeProductFromStockAvailable($this->id);
     $result = parent::delete();
     $result &= $this->deleteProductAttributes() && $this->deleteImages() && $this->deleteSceneProducts();
     // If there are still entries in product_shop, don't remove completly the product
     if ($this->hasMultishopEntries()) {
         return true;
     }
     Hook::exec('actionProductDelete', array('product' => $this));
     if (!$result || !GroupReduction::deleteProductReduction($this->id) || !$this->deleteCategories(true) || !$this->deleteProductFeatures() || !$this->deleteTags() || !$this->deleteCartProducts() || !$this->deleteAttributesImpacts() || !$this->deleteAttachments() || !$this->deleteCustomization() || !SpecificPrice::deleteByProductId((int) $this->id) || !$this->deletePack() || !$this->deleteProductSale() || !$this->deleteSearchIndexes() || !$this->deleteAccessories() || !$this->deleteFromAccessories() || !$this->deleteFromSupplier() || !$this->deleteDownload() || !$this->deleteFromCartRules()) {
         return false;
     }
     return true;
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:33,代码来源:Product.php

示例7: delete

 public function delete()
 {
     /*
      * @since 1.5.0
      * It is NOT possible to delete a product if there are currently:
      * - physical stock for this product
      * - supply order(s) for this product
      */
     if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $this->advanced_stock_management) {
         $stock_manager = StockManagerFactory::getManager();
         $physical_quantity = $stock_manager->getProductPhysicalQuantities($this->id, 0);
         $real_quantity = $stock_manager->getProductRealQuantities($this->id, 0);
         if ($physical_quantity > 0) {
             return false;
         }
         if ($real_quantity > $physical_quantity) {
             return false;
         }
         $warehouse_product_locations = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get('\\PrestaShop\\PrestaShop\\Core\\Foundation\\Database\\EntityManager')->getRepository('WarehouseProductLocation')->findByIdProduct($this->id);
         foreach ($warehouse_product_locations as $warehouse_product_location) {
             $warehouse_product_location->delete();
         }
         $stocks = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get('\\PrestaShop\\PrestaShop\\Core\\Foundation\\Database\\EntityManager')->getRepository('Stock')->findByIdProduct($this->id);
         foreach ($stocks as $stock) {
             $stock->delete();
         }
     }
     $result = parent::delete();
     // Removes the product from StockAvailable, for the current shop
     StockAvailable::removeProductFromStockAvailable($this->id);
     $result &= $this->deleteProductAttributes() && $this->deleteImages();
     // If there are still entries in product_shop, don't remove completely the product
     if ($this->hasMultishopEntries()) {
         return true;
     }
     Hook::exec('actionProductDelete', array('id_product' => (int) $this->id, 'product' => $this));
     if (!$result || !GroupReduction::deleteProductReduction($this->id) || !$this->deleteCategories(true) || !$this->deleteProductFeatures() || !$this->deleteTags() || !$this->deleteCartProducts() || !$this->deleteAttributesImpacts() || !$this->deleteAttachments(false) || !$this->deleteCustomization() || !SpecificPrice::deleteByProductId((int) $this->id) || !$this->deletePack() || !$this->deleteProductSale() || !$this->deleteSearchIndexes() || !$this->deleteAccessories() || !$this->deleteFromAccessories() || !$this->deleteFromSupplier() || !$this->deleteDownload() || !$this->deleteFromCartRules()) {
         return false;
     }
     return true;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:41,代码来源:Product.php


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