mardi 20 mars 2018

getResourceSingleton() Not working multiple time on single call magento 1

We have used

Mage::getResourceSingleton('catalog/category_tree')->load();

$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
    $root = $tree->getNodeById($rootCategoryId);
                if($root && $root->getId() == 1) { 
                    $root->setName(Mage::helper('catalog')->__('Root')); 
                }
                $collection = Mage::getModel('catalog/category')->getCollection() 
                    ->addAttributeToSelect('name') 
                    ->addAttributeToFilter('is_active','1');
                    //->addAttributeToFilter('display_mode',array('nlike'=>'PAGE'))
                    //->setLoadProductCount(true)
                    //->setProductStoreId($store)
                    //->addAttributeToFilter('include_in_menu','1');

                $tree->addCollectionData($collection, true);

We have created a api, and calling this in widget categories as well as category listing, but its only loading for last one only, not resulting for all calls.

kindly suggest a proper way

Aucun commentaire:

Enregistrer un commentaire