2. About Me
• Devoted to Magento Platform since 2007
• Ex Magento Core Team member
• 5+ Years of Magento Development Experience
• Co-Founder & Technical Director at EcomDev
• Providing Training Courses for Magento
Developers
3. Short Overview
• Price Calculation Basics
• Catalog Rule vs Shopping Cart Rule
• The Base of Promo Rules
• How To Customize
4. General Magento Price Types
Final Price Minimal Price
• Based on Qty & • Based on Customer
Customer Group Group
• Calculated • Calculated by
Dynamically Indexer
• Used in: • Used in:
– Shopping Cart – Product List
– Product View
7. Final Price
Option Price 1
Minimal Option Price 2
Base Price …
Option Price N
8. Minimal Base Price
• Product Price Magento takes
• Tier Price minimal value
• Group Price (CE1.7) from the following
• Special Price calculated price
• Catalog Rule Price variations.
11. Price Rules
• Easy way to set up discounts for a group
of products
• Conditional Discounts Based on
– Product Attributes
– Customer Group
– Shopping Cart Content
12. Price Rule Types
Catalog Price Rules Shopping Cart Price Rules
• Pre-applied • Applied on the fly
• Affect Final Product • Affect Shopping Cart
Price Totals
• Conditions only for • Various Set of
Product Attributes Conditions
– Product Sub-select
– Address Match
– Advanced Customer
Targeting
13. Use Cases
Catalog Price Rules Shopping Cart Price Rule
• Season Sale • Buy X Get Y Free
Discount Discount
• Customer Group • Free Shipping on
Discount Particular Items
• Discount on Product • Special Discount for
Attribute Match Loyal Customers (in
conjunction with
Customer Segment)
15. Mage_Rule Module
Condition
Mage_Rule_Model_Condition_Abstract
Rule Model
Mage_Rule_Model_Rule
Action
Mage_Rule_Model_Action_Abstract
16. Rule Model
Contains such information
• Conditions set
• Actions set
• Takes care about matched object
17. Condition Model
• Conditions can be complex or simple
• Matched against some Varien_Object
(Product, Address, Customer, etc)
• All condition models extended from
Mage_Rule_Model_Condition_Abstract
18. Action Model
• Supposed to be flexible list of actions that
should be performed
• Currently is not used in the system
21. Create Custom Condition
1. Extend from this class in gist:
https://gist.github.com/4136339
2. Implement _getLabel() method
3. Implement _initProperties() method
4. Add your condition to combine condition model for
existing rule
24. Adding To Combine Cond
For Sales Rules
• Add observer to salesrule_rule_condition_combine
• Add an array item to additional event property:
$observer->getEvent()->setAdditional(
Mage::getModel(‘yourcondition/model’)->getNewChildSelectOptions()
);