Where is the location of function which is called by this link “admin/catalog_category/tree/store/17/id/588/?isAjax=true”

magento.stackexchange https://magento.stackexchange.com//questions/90822

Question

I am working on multi website sub admin functionality.When i go to manage categories page and switch between websites an ajax call is working for the same.Which is call lime this link

admin/catalog_category/tree/store/17/id/588/?isAjax=true

i want to get where function is written for this.

Was it helpful?

Solution

This function is written in

app\code\core\Mage\Adminhtml\controllers\Catalog\CategoryController.php

In

public function treeAction()
    {
        $storeId = (int) $this->getRequest()->getParam('store');
        $categoryId = (int) $this->getRequest()->getParam('id');

        if ($storeId) {
            if (!$categoryId) {
                $store = Mage::app()->getStore($storeId);
                $rootId = $store->getRootCategoryId();
                $this->getRequest()->setParam('id', $rootId);
            }
        }

        $category = $this->_initCategory(true);

        $block = $this->getLayout()->createBlock('adminhtml/catalog_category_tree');
        $root  = $block->getRoot();
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
            'data' => $block->getTree(),
            'parameters' => array(
                'text'        => $block->buildNodeName($root),
                'draggable'   => false,
                'allowDrop'   => ($root->getIsVisible()) ? true : false,
                'id'          => (int) $root->getId(),
                'expanded'    => (int) $block->getIsWasExpanded(),
                'store_id'    => (int) $block->getStore()->getId(),
                'category_id' => (int) $category->getId(),
                'root_visible'=> (int) $root->getIsVisible()
        ))));
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top