當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mage_Catalog_Model_Category::getParentCategory方法代碼示例

本文整理匯總了PHP中Mage_Catalog_Model_Category::getParentCategory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mage_Catalog_Model_Category::getParentCategory方法的具體用法?PHP Mage_Catalog_Model_Category::getParentCategory怎麽用?PHP Mage_Catalog_Model_Category::getParentCategory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mage_Catalog_Model_Category的用法示例。


在下文中一共展示了Mage_Catalog_Model_Category::getParentCategory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _applyCustomDesignSettings

 /**
  * Recursively apply custom design settings to product if it's container
  * category custom_use_for_products option is setted to 1.
  * If not or product shows not in category - applyes product's internal settings
  *
  * @deprecated after 1.4.2.0-beta1, functionality moved to Mage_Catalog_Model_Design
  * @param Mage_Catalog_Model_Category|Mage_Catalog_Model_Product $object
  * @param Mage_Core_Model_Layout_Update $update
  */
 protected function _applyCustomDesignSettings($object, $update)
 {
     if ($object instanceof Mage_Catalog_Model_Category) {
         // lookup the proper category recursively
         if ($object->getCustomUseParentSettings()) {
             $parentCategory = $object->getParentCategory();
             if ($parentCategory && $parentCategory->getId() && $parentCategory->getLevel() > 1) {
                 $this->_applyCustomDesignSettings($parentCategory, $update);
             }
             return;
         }
         // don't apply to the product
         if (!$object->getCustomApplyToProducts()) {
             return;
         }
     }
     if ($this->_designProductSettingsApplied) {
         return;
     }
     $date = $object->getCustomDesignDate();
     if (array_key_exists('from', $date) && array_key_exists('to', $date) && Mage::app()->getLocale()->isStoreDateInInterval(null, $date['from'], $date['to'])) {
         if ($object->getPageLayout()) {
             $this->_designProductSettingsApplied['layout'] = $object->getPageLayout();
         }
         $this->_designProductSettingsApplied['update'] = $object->getCustomLayoutUpdate();
     }
 }
開發者ID:xiaoguizhidao,項目名稱:blingjewelry-prod,代碼行數:36,代碼來源:ProductController.php

示例2: _applyCustomDesignSettings

 /**
  * Recursively apply custom design settings to category if it's option
  * custom_use_parent_settings is setted to 1 while parent option is not
  *
  * @deprecated after 1.4.2.0-beta1, functionality moved to Mage_Catalog_Model_Design
  * @param Mage_Catalog_Model_Category $category
  * @param Mage_Core_Model_Layout_Update $update
  *
  * @return Mage_Catalog_CategoryController
  */
 protected function _applyCustomDesignSettings($category, $update)
 {
     if ($category->getCustomUseParentSettings() && $category->getLevel() > 1) {
         $parentCategory = $category->getParentCategory();
         if ($parentCategory && $parentCategory->getId()) {
             return $this->_applyCustomDesignSettings($parentCategory, $update);
         }
     }
     $validityDate = $category->getCustomDesignDate();
     if (array_key_exists('from', $validityDate) && array_key_exists('to', $validityDate) && Mage::app()->getLocale()->isStoreDateInInterval(null, $validityDate['from'], $validityDate['to'])) {
         if ($category->getPageLayout()) {
             $this->getLayout()->helper('page/layout')->applyHandle($category->getPageLayout());
         }
         $update->addUpdate($category->getCustomLayoutUpdate());
     }
     return $this;
 }
開發者ID:jpbender,項目名稱:mage_virtual,代碼行數:27,代碼來源:CategoryController.php

示例3: getSubcategoriesHeadingData

 protected function getSubcategoriesHeadingData(Mage_Catalog_Model_Category $startCategory)
 {
     $data = array();
     $rootId = $this->getLayer()->getCurrentStore()->getRootCategoryId();
     //Get parent category of the current category
     if ($rootId != $startCategory->getId()) {
         $parent = $startCategory->getParentCategory();
         if ($parent->getId() != $rootId && !$this->isExcluded($parent->getId())) {
             $data[] = $this->_prepareItemData($parent, -1);
         }
         //Add current category
         $data[] = $this->_prepareItemData($startCategory, 0);
     }
     return $data;
 }
開發者ID:vishalpatel14,項目名稱:indiankalaniketan,代碼行數:15,代碼來源:Category.php

示例4: testGetParentCategory

 public function testGetParentCategory()
 {
     $category = $this->_model->getParentCategory();
     $this->assertInstanceOf('Mage_Catalog_Model_Category', $category);
     $this->assertSame($category, $this->_model->getParentCategory());
 }
開發者ID:nemphys,項目名稱:magento2,代碼行數:6,代碼來源:CategoryTreeTest.php

示例5: getSubcategoriesHeadingData

 protected function getSubcategoriesHeadingData(Mage_Catalog_Model_Category $startCategory)
 {
     $data = array();
     $rootId = $this->getLayer()->getCurrentStore()->getRootCategoryId();
     //Get parent category of the current category
     if ($rootId != $startCategory->getId()) {
         $parent = $startCategory->getParentCategory();
         if ($parent->getId() != $rootId && !$this->isExcluded($parent->getId())) {
             $data[] = $this->_prepareItemData($parent, -1);
         }
         //Add current category
         //Workaround to load qty properly
         $current = $this->getChildrenData($startCategory->getParentCategory());
         foreach ($current as $head) {
             if ($head['id'] == $startCategory->getId()) {
                 $data[] = $head;
                 break;
             }
         }
     }
     return $data;
 }
開發者ID:rcclaudrey,項目名稱:dev,代碼行數:22,代碼來源:Category.php


注:本文中的Mage_Catalog_Model_Category::getParentCategory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。