2012-04-19 38 views
0

我需要根據類別參數對類別導航頂部進行排序。該類別的參數奧登,這是添加到Magento的下一個腳本:如何分類Magento分類頂部菜單

$installer = $this; 
$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); 
$installer->startSetup(); 

$setup->addAttribute('catalog_category', 'sort', array(
    'group'   => 'General', 
    'input'   => 'text', 
    'type'   => 'varchar', 
    'label'   => 'sort', 
    'backend'  => '', 
    'visible'  => 1, 
    'required'  => 0, 
    'user_defined' => 1, 
    'global'  => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 
)); 

$installer->endSetup(); 

但我不知道怎麼樣在這個屬性的基礎。 如果你看到Mage_Catalog_Block_Navigation你可以看到下一個功能

/** 
* Get catagories of current store 
* 
* @return Varien_Data_Tree_Node_Collection 
*/ 
public function getStoreCategories() 
{ 
    $helper = Mage::helper('catalog/category'); 
    return $helper->getStoreCategories(); 
} 

這是一個Varien_Data_Tree_Node_Collection對象類型我不如何樣這種類型的對象,我想在基地的類別和順序此獲取集合我的自定義屬性,因爲你可以傳遞true參數

return $helper->getStoreCategories(false,true); 

,並得到並鍵入Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection和嘗試爲了這個。

這個問題的任何想法? 在此先感謝

回答

0
+0

我想排序在基地的自定義屬性,我怎麼可以添加該自定義屬性Varien_Data_Tree_Node_Collection對象???如果我有一個Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection集合,我可以使用_load_before事件做到這一點。但我不知道如何使Varien_Data _...做到這一點。 – davidselo 2012-04-19 22:56:16

相關問題