0

I want to override the core class Mage_Sales_Model_Quote_Address_Total_Subtotal

So following different tutorials I did this :

Lebernard is my namespace, Vente, my module

#Lebernard/Vente/etc/config.xml
<?xml version="1.0" encoding="UTF-8" ?>

<config>
<modules>
    <lebernard_vente>
        <version>0.1</version>
    </lebernard_vente>
</modules>
<global>
    <models>
        <sales>
            <rewrite>
                <quote_address_total_subtotal>Lebernard_Vente_Model_Quote_Address_Total_Subtotal</quote_address_total_subtotal>
            </rewrite>
        </sales>
    </models>
</global>
</config>

Then I created the model which is suppose to override it by copying the core class. I want to change the fetch method.

#local/Lebernard/Vente/Model/Quote/Address/Total/Subtotal.php
class Lebernard_Vente_Model_Quote_Address_Total_Subtotal extends Mage_Sales_Model_Quote_Address_Total_Subtotal
{
   ...
}

And then I enabled the module

#etc/modules/Lebernard_Vente.xml
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<modules>
    <Lebernard_Vente>
        <active>true</active>
        <codepool>local</codepool>
    </Lebernard_Vente>
</modules>
</config>

No luck, the module is detected but the new class doesn't show up. Thank you!

  • What do you mean with "the module is detected"? How did you check it? Because with <codepool>local</codepool> (lowercase p) it cannot be loaded. – Fabian Schmengler Feb 17 '15 at 14:48
  • I mean that I can activate / desactivate the module in the backend – Pobe Feb 17 '15 at 15:00
  • That's what I suspected. You can activate/deactivate module output and actually all modules that are defined in app/etc/modules/ are listed there, even if they are not active or the code is missing or not found. – Fabian Schmengler Feb 17 '15 at 15:01
2

It could either be that another module is rewriting the class before you. Check other config.xml files for that.

Or the class is called directly instead of via the Mage god class.

new Mage_Sales_Model_Quote_Address_Total_Subtotal

vs

Mage::getModel('sales/quote_address_total_subtotal');

Next to that codepool should be with camel case, so codePool and the tag in modules too.

<modules>
    <Lebernard_Vente>
        <version>0.1</version>
    </Lebernard_Vente>
</modules>
[...]

Not sure if that is the direct cause of the issue but it might have negative effect :)

  • my money is on the codePool and on the modules subtag that should not be lowercase. – Marius Feb 17 '15 at 14:53
  • ahhh the times i've wasted minutes if not hours of my life on codepool... – Sander Mangel Feb 17 '15 at 14:58
  • 1
    change codepool to codePool, thanks, Lebernard_Vente was fine, stack formatted it. I've learn today :) – Pobe Feb 17 '15 at 15:15
0

Hi I have faced same problem in my going projects in sales->ordergrid .Ihave used below extension for which third party module is overriding

URL:http://www.magentocommerce.com/magento-connect/modules-conflict-detector.html

MySkype: kinex.sourav .join me

Email Address:kinexmediamagento@gmail.com

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.