Categories are not appearing when editing products

I am using Magento Enterprise and only the top level category is available to choose when I am editing a product. All the sub categories are active and appear in the navigation menu, but not when editing a product.

Does anyone know how to fix this?

Chris

3 thoughts on “Categories are not appearing when editing products”

  1. With 2 installs we had this issue. The 3rd time was done by downloading Magento directly from the server using wget command and then extracting and installing. Then it worked. I think whoever installed it the previous 2 times downloaded it to their desktop and then ftpd it up to the server.

  2. Agreed – I had this issue after FTPing the Mage files.

    After a wipe and re-install using hosts’ script the issue is sorted. Shouldn’t be necessary…

  3. A matching flaw appears to exists in 1.5.0.1 of Community Edition, in the CE version its a regression in the getSelectedCategoriesPathIds() method of Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Categories

    Reverting to the 1.4.* code for this method appears to fix it, all credit to rrroulio for tracking down this one on the magento boards: http://www.magentocommerce.com/boards/viewreply/316838/

    The old 1.4 code for this method is as follows:

    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;
    }
    

Leave a Reply

Your email address will not be published. Required fields are marked *