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


PHP Mage_Catalog_Model_Category::getAllChildren方法代码示例

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


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

示例1: testGetAllChildren

 public function testGetAllChildren()
 {
     $this->_model->load(4);
     $this->assertEquals('4,5', $this->_model->getAllChildren());
     $this->_model->load(5);
     $this->assertEquals('5', $this->_model->getAllChildren());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:7,代码来源:CategoryTreeTest.php

示例2: move

 public function move(Mage_Catalog_Model_Category $category, $newParentId)
 {
     $oldStoreId = $category->getStoreId();
     $parent = Mage::getModel('catalog/category')->setStoreId($category->getStoreId())->load($category->getParentId());
     $newParent = Mage::getModel('catalog/category')->setStoreId($category->getStoreId())->load($newParentId);
     $oldParentStores = $parent->getStoreIds();
     $newParentStores = $newParent->getStoreIds();
     $category->setParentId($newParentId)->save();
     $parent->save();
     $newParent->save();
     // Add to new stores
     $addToStores = array_diff($newParentStores, $oldParentStores);
     foreach ($addToStores as $storeId) {
         $newCategory = clone $category;
         $newCategory->setStoreId($storeId)->save();
         $children = $category->getAllChildren();
         if ($children && ($arrChildren = explode(',', $children))) {
             foreach ($arrChildren as $childId) {
                 if ($childId == $category->getId()) {
                     continue;
                 }
                 $child = Mage::getModel('catalog/category')->setStoreId($oldStoreId)->load($childId)->setStoreId($storeId)->save();
             }
         }
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:27,代码来源:Category.php

示例3: _getValidIdsForCategory

 /**
  * For a given category, get all ids to other categories related to it.
  *
  * For a normal category, add ids of all it's parents
  * For an anchor - also add all it's children
  *
  * @param Mage_Catalog_Model_Category $category
  * @return array
  */
 protected function _getValidIdsForCategory(Mage_Catalog_Model_Category $category)
 {
     return explode(',', $category->getAllChildren());
 }
开发者ID:styladev,项目名称:magentoStylaConnect,代码行数:13,代码来源:Collection.php

示例4: addCategoryFilter

 public function addCategoryFilter(Mage_Catalog_Model_Category $category, $renderAlias = false)
 {
     if ($category->getIsAnchor()) {
         $categoryCondition = $this->getConnection()->quoteInto('{{table}}.category_id IN (?)', explode(',', $category->getAllChildren()));
         $this->getSelect()->group('e.entity_id');
     } else {
         $categoryCondition = $this->getConnection()->quoteInto('{{table}}.category_id=?', $category->getId());
     }
     if ($renderAlias) {
         $alias = 'category_' . $category->getId();
     } else {
         $alias = 'position';
     }
     $this->joinField($alias, 'catalog/category_product', 'position', 'product_id=entity_id', $categoryCondition);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:16,代码来源:Collection.php


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