Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Creating a custom cart based rule - Help! 
 
thecurve
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-05-13
New York, US
 

Can anyone offer guidance on how I’d accomplish the feature outlined in this thread: http://www.magentocommerce.com/boards/viewthread/8387/

To summarize, I’d like to create a cart-level promo that scales depending on the amount of a particular product-type is in the cart. This functionality doesn’t exist with core magento, so Moshe suggested I modify a few files. Here is his response, but I’m new enough to magento that I dont know what to make of it or where to begin!:

any help is greatly appreciated smile
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

With existing price rules logic components it is not possible to create this promotion.

However, it is possible to extend price rules to allow this functionality.

Basically that would boil down to counting quantity of matching “condition” wall mount items in cart, and then limiting discounted items to this quantity for matching “action” cable items.
I know it sounds obvious, but that previous sentence would directly translate to programming steps.
Overloaded files would be Mage/SalesRule/Model/Validator.php and Mage/Sales/Model/Quote/Address/Total/Discount.php

Alternatively you could bind to event “sales_quote_address_discount_item” (dispatched in Mage/Sales/Model/Quote/Address/Total/Discount.php) and using simple logic set for matching items (cables) these values if other items match to wall mount items, limiting by total quantity of wall mounts:
* discount_percent to 100
* discount_amount to row_total
* base_discount_amount to base_row_total

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top