Hidden Secrets of Magento Price Rules

27,093 views

Published on

Meet Magento Poland Presenetation

Published in: Technology
1 Comment
15 Likes
Statistics
Notes
  • Nice presentation! Thank you
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
27,093
On SlideShare
0
From Embeds
0
Number of Embeds
74
Actions
Shares
0
Downloads
145
Comments
1
Likes
15
Embeds 0
No embeds

No notes for slide

Hidden Secrets of Magento Price Rules

  1. 1. Ivan ChepurnyiHidden Secrets of Magento Promotion Rules
  2. 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. 3. Short Overview• Price Calculation Basics• Catalog Rule vs Shopping Cart Rule• The Base of Promo Rules• How To Customize
  4. 4. General Magento Price TypesFinal 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
  5. 5. Minimal PriceIt is just minimal variation of final price
  6. 6. HOW IS CALCULATED FINAL PRICE?
  7. 7. Final Price Option Price 1Minimal Option Price 2Base Price … Option Price N
  8. 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.
  9. 9. Option Price• Configurable Product Options (If Product is Configurable)• Custom Options
  10. 10. And finallyPRICE RULES
  11. 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. 12. Price Rule TypesCatalog 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. 13. Use CasesCatalog 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)
  14. 14. And finally some codeMAGE_RULE MODULE
  15. 15. Mage_Rule Module Condition Mage_Rule_Model_Condition_AbstractRule ModelMage_Rule_Model_Rule Action Mage_Rule_Model_Action_Abstract
  16. 16. Rule ModelContains such information• Conditions set• Actions set• Takes care about matched object
  17. 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. 18. Action Model• Supposed to be flexible list of actions that should be performed• Currently is not used in the system
  19. 19. Specific ImplementationsMagento Community Edition• Mage_CatalogRule• Mage_SalesRuleMagento Enterprise Edition• Enterprise_TargetRule• Enterprise_CustomerSegment
  20. 20. Doing SimpleCUSTOMIZATION
  21. 21. Create Custom Condition1. Extend from this class in gist: https://gist.github.com/41363392. Implement _getLabel() method3. Implement _initProperties() method4. Add your condition to combine condition model for existing rule
  22. 22. Properties Initializationprotected function _initProperties(){ $this->_properties = array( ‘attribute_ => array( label => ‘Some Field Name’, type => select, data_path => ’data/path’, options => array() ) );}
  23. 23. Property TypesTypes:• string• numeric• date• select• multiselect
  24. 24. Adding To Combine CondFor 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() );
  25. 25. Thank You!
  26. 26. Test Driven DevelopmentTraining Course inBerlin, 09-10 Janhttp://bit.ly/QeOmia
  27. 27. Questions?Twitter:@IvanChepurnyiEmail:ivan@ecomdev.orgBlog:ecomdev.org

×