0

To dodge the max of 1000 products in a category I tried to override CategoryController.php. I think I did everything right, but the module doesn't work. I'm working with Magento 1.7.0.2 Community Edition.

In code/local/EM/CategoryFix/etc/config.xml I have:

<?xml version="1.0"?>
    <config>
        <modules>
        <EM_CategoryFix>
            <version>0.1.0</version>
        </EM_CategoryFix>
    </modules>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <CategoryFix before="Mage_Adminhtml">EM_CategoryFix_Adminhtml</CategoryFix>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

In code/local/EM/CategoryFix/Adminhtml/Catalog/CategoryController.php:

require_once 'Mage/Adminhtml/controllers/Catalog/CategoryController.php';
class EM_CategoryFix_Adminhtml_Catalog_CategoryController extends Mage_Adminhtml_Catalog_CategoryController
{  
   //public function to override
}

And in etc/modules/EM_CategoryFix.xml

<?xml version="1.0"?>
<config>
    <modules>
        <EM_CategoryFix>
            <active>true</active>
            <codePool>local</codePool>
        </EM_CategoryFix>
    </modules>
</config> 

I checked everything a thousand times, what do I miss?

5
  • Try this line <EM_CategoryFix before="Mage_Adminhtml">EM_CategoryFix_Adminhtml</EM_CategoryFix> You should use EM_CategoryFix instead of CategoryFix. Commented Apr 13, 2017 at 12:56
  • add<depends><Mage_Adminhtml/></depends> at EM_CategoryFix.xml
    – Amit Bera
    Commented Apr 13, 2017 at 15:01
  • @KingshukDeb, thanks for your input. I tested it, but is doesn't do the trick. After saving the category, the quantity of products gets reduced to 1000. Commented Apr 20, 2017 at 11:22
  • @Ellen-RosevanDijk i only told you how your override should work. You were trying to override a core class and that was not working. Thats why i told you that thing. Now its your code which should check 1000 products max. Commented Apr 20, 2017 at 11:26
  • @KingshukDeb, I understand ;) The code works if I put it in the core file, but I don't want to adjust a core file. That's why I would like to put it in a custom module. But so far, I can't get my module to work unfortunately. Commented Apr 21, 2017 at 11:12

1 Answer 1

0

Location of rewrite controller is wrong

app/code/local/EM/CategoryFix/Adminhtml/Catalog/CategoryController.php

it should be

app/code/local/EM/CategoryFix/controllers/Adminhtml/Catalog/CategoryController.php

Also add <depends><Mage_Adminhtml/></depends> at EM_CategoryFix.xml

1
  • Thanks for your input. I tried both options, also together, but unfortunately it doesn't do the trick. After saving the category it still reduces the quantity of products to 1000. Commented Apr 20, 2017 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.