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


PHP GroupReduction::getGroupReductionByCategoryId方法代码示例

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


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

示例1: delete

 public function delete()
 {
     if ((int) $this->id === 0 || (int) $this->id === 1) {
         return false;
     }
     $this->clearCache();
     $all_cat = $this->getAllChildren();
     $all_cat[] = $this;
     foreach ($all_cat as $cat) {
         $cat->deleteLite();
         if (!$this->hasMultishopEntries()) {
             $cat->deleteImage();
             $cat->cleanGroups();
             $cat->cleanAssoProducts();
             // Delete associated restrictions on cart rules
             CartRule::cleanProductRuleIntegrity('categories', array($cat->id));
             Category::cleanPositions($cat->id_parent);
             /* Delete Categories in GroupReduction */
             if (GroupReduction::getGroupReductionByCategoryId((int) $cat->id)) {
                 GroupReduction::deleteCategory($cat->id);
             }
         }
     }
     /* Rebuild the nested tree */
     if (!$this->hasMultishopEntries() && (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)) {
         Category::regenerateEntireNtree();
     }
     Hook::exec('actionCategoryDelete', array('category' => $this));
     return true;
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:30,代码来源:Category.php

示例2: delete

    public function delete()
    {
        if ((int) $this->id === 0 or (int) $this->id === 1) {
            return false;
        }
        $this->clearCache();
        /* Get childs categories */
        $toDelete = array((int) $this->id);
        $this->recursiveDelete($toDelete, (int) $this->id);
        $toDelete = array_unique($toDelete);
        /* Delete category and its child from database */
        $list = sizeof($toDelete) > 1 ? implode(',', array_map('intval', $toDelete)) : (int) $this->id;
        Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'category` WHERE `id_category` IN (' . $list . ')');
        Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'category_lang` WHERE `id_category` IN (' . $list . ')');
        Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'category_product` WHERE `id_category` IN (' . $list . ')');
        Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'category_group` WHERE `id_category` IN (' . $list . ')');
        self::cleanPositions($this->id_parent);
        /* Delete category images and its children images */
        $tmpCategory = new Category();
        foreach ($toDelete as $id_category) {
            $tmpCategory->id = (int) $id_category;
            $tmpCategory->deleteImage();
        }
        /* Delete products which were not in others categories */
        $result = Db::getInstance()->ExecuteS('
		SELECT `id_product`
		FROM `' . _DB_PREFIX_ . 'product`
		WHERE `id_product` NOT IN (SELECT `id_product` FROM `' . _DB_PREFIX_ . 'category_product`)');
        foreach ($result as $p) {
            $product = new Product((int) $p['id_product']);
            if (Validate::isLoadedObject($product)) {
                $product->delete();
            }
        }
        /* Set category default to 1 where categorie no more exists */
        $result = Db::getInstance()->Execute('
		UPDATE `' . _DB_PREFIX_ . 'product`
		SET `id_category_default` = 1
		WHERE `id_category_default`
		NOT IN (SELECT `id_category` FROM `' . _DB_PREFIX_ . 'category`)');
        /* Rebuild the nested tree */
        if (!isset($this->doNotRegenerateNTree) or !$this->doNotRegenerateNTree) {
            self::regenerateEntireNtree();
        }
        Module::hookExec('categoryDeletion', array('category' => $this));
        /* Delete Categories in GroupReduction */
        foreach ($toDelete as $category) {
            if (GroupReduction::getGroupReductionByCategoryId((int) $category)) {
                GroupReduction::deleteCategory($category);
            }
        }
        return true;
    }
开发者ID:greench,项目名称:prestashop,代码行数:53,代码来源:Category.php


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