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?

  • Try this line <EM_CategoryFix before="Mage_Adminhtml">EM_CategoryFix_Adminhtml</EM_CategoryFix> You should use EM_CategoryFix instead of CategoryFix. – Kingshuk Deb Apr 13 '17 at 12:56
  • add<depends><Mage_Adminhtml/></depends> at EM_CategoryFix.xml – Amit Bera Apr 13 '17 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. – Ellen-Rose van Dijk Apr 20 '17 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. – Kingshuk Deb Apr 20 '17 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. – Ellen-Rose van Dijk Apr 21 '17 at 11:12
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

  • 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. – Ellen-Rose van Dijk Apr 20 '17 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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