本文整理汇总了PHP中GroupReduction::deleteProductReduction方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupReduction::deleteProductReduction方法的具体用法?PHP GroupReduction::deleteProductReduction怎么用?PHP GroupReduction::deleteProductReduction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupReduction
的用法示例。
在下文中一共展示了GroupReduction::deleteProductReduction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setProductReduction
public static function setProductReduction($id_product, $id_group = null, $id_category = null, $reduction = null)
{
$res = true;
GroupReduction::deleteProductReduction((int) $id_product);
$categories = Product::getProductCategories((int) $id_product);
if ($categories) {
foreach ($categories as $category) {
$reductions = GroupReduction::getGroupsByCategoryId((int) $category);
if ($reductions) {
foreach ($reductions as $reduction) {
$current_group_reduction = new GroupReduction((int) $reduction['id_group_reduction']);
$res &= $current_group_reduction->_setCache();
}
}
}
}
return $res;
}
示例2: setProductReduction
public static function setProductReduction($id_product, $id_group = null, $id_category, $reduction = null)
{
$res = true;
GroupReduction::deleteProductReduction((int) $id_product);
$reductions = GroupReduction::getGroupsByCategoryId((int) $id_category);
if ($reductions) {
foreach ($reductions as $reduction) {
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`)
VALUES (' . (int) $id_product . ', ' . (int) $reduction['id_group'] . ', ' . (double) $reduction['reduction'] . ')');
}
}
return $res;
}
示例3: setGroupReduction
/**
* Set Group reduction if needed
*/
public function setGroupReduction()
{
$row = GroupReduction::getGroupByCategoryId((int) $this->id_category_default);
if (!$row) {
if (!GroupReduction::deleteProductReduction((int) $this->id)) {
return false;
}
} else {
if (!GroupReduction::setProductReduction((int) $this->id, $row['id_group'], (int) $this->id_category_default, (double) $row['reduction'])) {
return false;
}
}
return true;
}
示例4: 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 = Adapter_ServiceLocator::get('Core_Foundation_Database_EntityManager')->getRepository('WarehouseProductLocation')->findByIdProduct($this->id);
foreach ($warehouse_product_locations as $warehouse_product_location) {
$warehouse_product_location->delete();
}
$stocks = Adapter_ServiceLocator::get('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() && $this->deleteSceneProducts();
// 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;
}