yvoronoy / magento-extension-extra-fee

Magento Extension Extra Fee based on Shopping Cart Price Rule
GNU General Public License v2.0
33 stars 17 forks source link

Total weight in subselect sales rule #16

Open etsanov opened 6 years ago

etsanov commented 6 years ago

Hi,

I installed your extension (nicely done by the way).

Additionally, in ./app/code/local/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php, I changed:

            'qty'  => Mage::helper('salesrule')->__('total quantity'),
            'base_row_total'  => Mage::helper('salesrule')->__('total amount'),

to

            'qty'  => Mage::helper('salesrule')->__('total quantity'),
            'base_row_total'  => Mage::helper('salesrule')->__('total amount'),
            'weight'  => Mage::helper('salesrule')->__('total weight'),

I did that, because I needed to apply a rule that will add extra fee based on the total weight of items per supplier in the cart. It actually works fine for single products (quantity "1" in cart), but if I increase the quantity of an item in the cart, the total weight per supplier seems not to increase as expected, and the extra fee stays the same.

For example, I set up a rule to add extra fee of "10" if total weight is greater than 4 for a subselection of items in cart matching ALL of these conditions: supplier is "X". I have 2 different items in the cart, each "2.5 kg". Each item has "X" as supplier. The extra fee of "10" is added in cart/checkout. If I remove one of the items, the extra fee is removed (total weight for items with supplier "X" is now "2.5 kg").

However, if I remove one of the items, but I increase the quantity of the one item left, I would expect the total weight to become "5", and the extra fee should appear. However, that does not happen. Even if I increase the quantity for that item to "10", the weight remains "2.5 kg", and the extra fee never appears.

I am sorry for the long description of the problem. I am not sure if the problem is with your extension or with the way I added "weight" to Subselect.php. I would be happy to hear a suggestion on the issue, though.

Thanks.