My magento install has a free shipping shopping cart rule, as well as coupon rules. When a coupon is entered, the free shipping goes away. This is undesirable, but a known condition with Magento: Magento Free shipping and Coupon discount Note: If someone knows how to correct THAT issue without overriding, that would be preferable.
I've worked on this for about 3 hours. I've searched SO, Google, and others, and cannot find the solution.
Question:
I am attempting to write a module that corrects the behavior based on this post:
Magento Issue with Cart Price
The class I am attempting to override is Mage_SalesRule_Model_Resource_Rule_Collection
Using Alan Storm's free tool, I've found that the uri is salesrule/resource_rule_collection
,
And doing some manual investigation, that the class is located here:
app/code/core/Mage/SalesRule/Model/Resource/Rule/Collection.php
There is ALSO a class here that extends the class from the above file:
app/code/core/Mage/SalesRule/Model/Mysql4/Rule/Collection.php
(which one of these should I be overriding?)
For the life of me, I cannot find the proper config.xml syntax to override the desired class.
My config currently looks like so:
<config>
<modules>
<My_Couponrule>
<version>1.0.0</version>
</My_Couponrule>
</modules>
<global>
<models>
<salesrule>
<rewrite>
<resource_rule_collection>My_Couponrule_Model_Resource_Rule_Collection</resource_rule_collection>
</rewrite>
</salesrule>
</models>
</global>
However, I have carefully tried every combination I can deduce might be appropriate and none of them have worked:
<salesrule_resource_rule><rewrite><collection>
<salesrule_resource><rewrite><rule_collection>
<salesrule_resource><rewrite><collection>
<salesrule><rewrite><resource_collection>
<salesrule><rewrite><resource_rule_collection>
<salesrule><rewrite><rule_collection>
<salesrule_mysql4><rewrite><rule_collection>
<salesrule_mysql4_rule><rewrite><collection>
Notes:
1. I know the config file is being loaded, I have checked in System->Configuration->Advanced
2. I further know the config file is being loaded because I've got the loaded classes being output to the browser, and I've tried overrideing OTHER classes and seen it output the correct class successfully
3. I know that each change I made was loaded through another rewrite that I added (and modified each time) just to verify the change was properly uploaded.
3. Yes, I was very careful about ensuring the tags were closed with the proper matching closing tag
4. Caching is disabled, so the file not being loaded is not the issue
Please help. I don't have much hair left...