0

I am trying to rewrite Mage_SalesRule_Model_Rule_Condition_Product_Subselect but it seems like my changes are not being picked. Below is what i've done trying to rewrite the Model.

app/code/local/Invent/SalesRule/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Invent_SalesRule>
            <version>0.0.1</version>
        </Invent_SalesRule>
    </modules>
    <global>
        <models>
            <salesrule>
                <rewrite>
                    <rule_condition_product_subselect>Invent_SalesRule_Model_Rule_Condition_Product_Subselect</rule_condition_product_subselect>
                </rewrite>
            </salesrule>
        </models>
    </global>
</config>

app/etc/modules/Invent_SalesRule.xml

<config>
    <modules>
        <Invent_SalesRule>
            <active>true</active>
            <codePool>local</codePool>
        </Invent_SalesRule>
    </modules>
</config>

app/code/local/Invent/SalesRule/Model/Rule/Condition/Product/Subselect.php

<?php
class Invent_SalesRule_Model_Rule_Condition_Product_Subselect extends Mage_SalesRule_Model_Rule_Condition_Product_Subselect
{
    public function validate(Varien_Object $object)
    {
       // the code
    }
}
3

Please use below code in respective folders

app\etc\modules\Invent_SalesRule.xml

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

app\code\local\Invent\SalesRule\etc\config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Invent_SalesRule>
      <version>0.1.0</version>
    </Invent_SalesRule>
  </modules>
  <global>   
    <models>
            <salesrule>
                <rewrite>
                    <rule_condition_product_subselect>Invent_SalesRule_Model_SalesRule_Rule_Condition_Product_Subselect</rule_condition_product_subselect>
                </rewrite>
            </salesrule>
    </models>
  </global>
</config> 

app\code\local\Invent\SalesRule\Model\SalesRule\Rule\Condition\Product\Subselect.php

class Invent_SalesRule_Model_SalesRule_Rule_Condition_Product_Subselect extends Mage_SalesRule_Model_Rule_Condition_Product_Subselect
{
}

Hope it will help you!.

  • @mthe beseti - Welcome and Thanks for accepting my answer. :-) – Vino Jul 7 '17 at 8:46
  • I would like to make a custom condition to get url parameters, would you know what I need in this model? – Gustavo Souza Jan 9 '18 at 19:23

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.