Magento Core: (FIX) Admin categories tree for products does not auto-expand to show product categori

Send Snippet To: Save this snippet to Code Collector Pro -- view all tamburra's snippets
language: Other
license: Other

Code for Snippet:

                
---------------
Open:
---------------
 
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Categories.php
 
 
---------------
Change the last function to:
---------------
 
    public function getSelectedCategoriesPathIds($rootId = false)
    {
        $ids = array();
        $collection = Mage::getModel('catalog/category')->getCollection()
            ->addFieldToFilter('entity_id', array('in'=>$this->getCategoryIds()));
        foreach ($collection as $item) {
            if ($rootId && !in_array($rootId, $item->getPathIds())) {
                continue;
            }
            foreach ($item->getPathIds() as $id) {
                if (!in_array($id, $ids)) {
                    $ids[] = $id;
                }
            }
        }
        return $ids;
    }
 
comments powered by Disqus

Info

Tags: Fix Core CE 1.6

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 2370
Date Added: 2012-01-22 23:49:22
Last Modified: 0000-00-00 00:00:00

Web Analytics