SlideShare a Scribd company logo
1 of 27
Ivan Chepurnyi

Hidden Secrets of Magento
     Promotion Rules
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
Short Overview
•   Price Calculation Basics
•   Catalog Rule vs Shopping Cart Rule
•   The Base of Promo Rules
•   How To Customize
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
Minimal Price


It is just minimal variation of
           final price
HOW IS CALCULATED FINAL
         PRICE?
Final Price

                Option Price 1

Minimal         Option Price 2
Base Price             …
                Option Price N
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.
Option Price
• Configurable Product Options
  (If Product is Configurable)

• Custom Options
And finally
PRICE RULES
Price Rules
• Easy way to set up discounts for a group
  of products

• Conditional Discounts Based on
  – Product Attributes
  – Customer Group
  – Shopping Cart Content
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
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)
And finally some code
MAGE_RULE MODULE
Mage_Rule Module

                        Condition
                        Mage_Rule_Model_Condition_Abstract



Rule Model
Mage_Rule_Model_Rule



                       Action
                       Mage_Rule_Model_Action_Abstract
Rule Model
Contains such information
• Conditions set
• Actions set
• Takes care about matched object
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
Action Model
• Supposed to be flexible list of actions that
  should be performed
• Currently is not used in the system
Specific Implementations
Magento Community Edition
• Mage_CatalogRule
• Mage_SalesRule

Magento Enterprise Edition
• Enterprise_TargetRule
• Enterprise_CustomerSegment
Doing Simple

CUSTOMIZATION
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
Properties Initialization
protected function _initProperties()
{
    $this->_properties = array(
          ‘attribute_' => array(
               'label' => ‘Some Field Name’,
               'type' => 'select',
               'data_path' => ’data/path’,
               'options' => array()
          )
     );
}
Property Types
Types:
• string
• numeric
• date
• select
• multiselect
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()
  );
Thank You!
Test Driven Development
Training Course in
Berlin, 09-10 Jan

http://bit.ly/QeOmia
Questions?
Twitter:
@IvanChepurnyi


Email:
ivan@ecomdev.org


Blog:
ecomdev.org

More Related Content

What's hot

Apex Trigger in Salesforce
Apex Trigger in SalesforceApex Trigger in Salesforce
Apex Trigger in SalesforceCloud Analogy
 
Introduction to Lightning Web Component
Introduction to Lightning Web Component Introduction to Lightning Web Component
Introduction to Lightning Web Component SmritiSharan1
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooksSamundra khatri
 
Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web ComponentMohith Shrivastava
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationWebStackAcademy
 
Lightning web components
Lightning web components Lightning web components
Lightning web components Cloud Analogy
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners Varun Raj
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelSalesforce Developers
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
Vue.js Getting Started
Vue.js Getting StartedVue.js Getting Started
Vue.js Getting StartedMurat Doğan
 
Copado - SoftClouds | Expertise
Copado - SoftClouds | ExpertiseCopado - SoftClouds | Expertise
Copado - SoftClouds | ExpertiseSoftClouds LLC
 

What's hot (20)

Nuxt.js - Introduction
Nuxt.js - IntroductionNuxt.js - Introduction
Nuxt.js - Introduction
 
Apex Trigger in Salesforce
Apex Trigger in SalesforceApex Trigger in Salesforce
Apex Trigger in Salesforce
 
Introduction to Lightning Web Component
Introduction to Lightning Web Component Introduction to Lightning Web Component
Introduction to Lightning Web Component
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web Component
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and Authorization
 
Spring boot
Spring bootSpring boot
Spring boot
 
Lightning web components
Lightning web components Lightning web components
Lightning web components
 
React/Redux
React/ReduxReact/Redux
React/Redux
 
CSS
CSSCSS
CSS
 
Angular 2
Angular 2Angular 2
Angular 2
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security Model
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Vue.js
Vue.jsVue.js
Vue.js
 
Vue.js Getting Started
Vue.js Getting StartedVue.js Getting Started
Vue.js Getting Started
 
React hooks
React hooksReact hooks
React hooks
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
 
Copado - SoftClouds | Expertise
Copado - SoftClouds | ExpertiseCopado - SoftClouds | Expertise
Copado - SoftClouds | Expertise
 

Similar to Hidden Secrets of Magento Price Rules

Merchandising & Miva Merchant 9 - Unlocking The Power Of Price Groups
Merchandising & Miva Merchant 9 - Unlocking The Power Of Price GroupsMerchandising & Miva Merchant 9 - Unlocking The Power Of Price Groups
Merchandising & Miva Merchant 9 - Unlocking The Power Of Price GroupsMiva
 
MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...
MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...
MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...Miva
 
Merchandising & miva merchant 9 – unlocking the power of price groups
Merchandising & miva merchant 9 – unlocking the power of price groupsMerchandising & miva merchant 9 – unlocking the power of price groups
Merchandising & miva merchant 9 – unlocking the power of price groupsMiva
 
Merchandising & Miva Merchant 9 - Price Groups
Merchandising & Miva Merchant 9 - Price GroupsMerchandising & Miva Merchant 9 - Price Groups
Merchandising & Miva Merchant 9 - Price GroupsMiva
 
PromoTale - a sale story
PromoTale - a sale storyPromoTale - a sale story
PromoTale - a sale storyAdina Nichitean
 
eCommerce with Magento
eCommerce with MagentoeCommerce with Magento
eCommerce with MagentoTLLMN
 
Magento Product Recommendations powered by Adobe Sensei (AI)
Magento Product Recommendations powered by Adobe Sensei (AI)Magento Product Recommendations powered by Adobe Sensei (AI)
Magento Product Recommendations powered by Adobe Sensei (AI)Deepika Janiyani
 
NANO MBA3 Category Management by kongkiat phanawadee
NANO MBA3 Category Management by kongkiat phanawadee NANO MBA3 Category Management by kongkiat phanawadee
NANO MBA3 Category Management by kongkiat phanawadee Utai Sukviwatsirikul
 
Beyond Accuracy: Goal-Driven Recommender Systems Design
Beyond Accuracy: Goal-Driven Recommender Systems DesignBeyond Accuracy: Goal-Driven Recommender Systems Design
Beyond Accuracy: Goal-Driven Recommender Systems DesignData Science London
 
Common design patterns in php
Common design patterns in phpCommon design patterns in php
Common design patterns in phpDavid Stockton
 
Drupal Commerce Drupalhagen 2012
Drupal Commerce Drupalhagen 2012Drupal Commerce Drupalhagen 2012
Drupal Commerce Drupalhagen 2012Jakob Torp
 
Pricing and the ceo may 2018 for xpeg
Pricing and the ceo may 2018 for xpegPricing and the ceo may 2018 for xpeg
Pricing and the ceo may 2018 for xpegSteven Forth
 
Salesforce CPQ by yuvaraj
Salesforce CPQ by yuvarajSalesforce CPQ by yuvaraj
Salesforce CPQ by yuvarajYuvaraj P
 
Bmgt 411 chapter_12
Bmgt 411 chapter_12Bmgt 411 chapter_12
Bmgt 411 chapter_12Chris Lovett
 
Webinar: Successful B2B Pricing Strategies with Magento
Webinar: Successful B2B Pricing Strategies with MagentoWebinar: Successful B2B Pricing Strategies with Magento
Webinar: Successful B2B Pricing Strategies with MagentoAPPSeCONNECT
 
Webinar discover acquisio campaign automation algorithms
Webinar discover acquisio campaign automation algorithmsWebinar discover acquisio campaign automation algorithms
Webinar discover acquisio campaign automation algorithmsAcquisio
 
Ebay的自动化
Ebay的自动化Ebay的自动化
Ebay的自动化yiditushe
 
Pricing for product managers vancouver nov 2017
Pricing for product managers vancouver nov 2017Pricing for product managers vancouver nov 2017
Pricing for product managers vancouver nov 2017Steven Forth
 

Similar to Hidden Secrets of Magento Price Rules (20)

Merchandising & Miva Merchant 9 - Unlocking The Power Of Price Groups
Merchandising & Miva Merchant 9 - Unlocking The Power Of Price GroupsMerchandising & Miva Merchant 9 - Unlocking The Power Of Price Groups
Merchandising & Miva Merchant 9 - Unlocking The Power Of Price Groups
 
MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...
MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...
MivaCon Seattle - Merchandising & Miva Merchant 9: Unlocking the Power of Pri...
 
Merchandising & miva merchant 9 – unlocking the power of price groups
Merchandising & miva merchant 9 – unlocking the power of price groupsMerchandising & miva merchant 9 – unlocking the power of price groups
Merchandising & miva merchant 9 – unlocking the power of price groups
 
Merchandising & Miva Merchant 9 - Price Groups
Merchandising & Miva Merchant 9 - Price GroupsMerchandising & Miva Merchant 9 - Price Groups
Merchandising & Miva Merchant 9 - Price Groups
 
PromoTale - a sale story
PromoTale - a sale storyPromoTale - a sale story
PromoTale - a sale story
 
eCommerce with Magento
eCommerce with MagentoeCommerce with Magento
eCommerce with Magento
 
Magento Product Recommendations powered by Adobe Sensei (AI)
Magento Product Recommendations powered by Adobe Sensei (AI)Magento Product Recommendations powered by Adobe Sensei (AI)
Magento Product Recommendations powered by Adobe Sensei (AI)
 
Pricing
PricingPricing
Pricing
 
NANO MBA3 Category Management by kongkiat phanawadee
NANO MBA3 Category Management by kongkiat phanawadee NANO MBA3 Category Management by kongkiat phanawadee
NANO MBA3 Category Management by kongkiat phanawadee
 
Beyond Accuracy: Goal-Driven Recommender Systems Design
Beyond Accuracy: Goal-Driven Recommender Systems DesignBeyond Accuracy: Goal-Driven Recommender Systems Design
Beyond Accuracy: Goal-Driven Recommender Systems Design
 
Common design patterns in php
Common design patterns in phpCommon design patterns in php
Common design patterns in php
 
Drupal Commerce Drupalhagen 2012
Drupal Commerce Drupalhagen 2012Drupal Commerce Drupalhagen 2012
Drupal Commerce Drupalhagen 2012
 
Recommender systems
Recommender systems Recommender systems
Recommender systems
 
Pricing and the ceo may 2018 for xpeg
Pricing and the ceo may 2018 for xpegPricing and the ceo may 2018 for xpeg
Pricing and the ceo may 2018 for xpeg
 
Salesforce CPQ by yuvaraj
Salesforce CPQ by yuvarajSalesforce CPQ by yuvaraj
Salesforce CPQ by yuvaraj
 
Bmgt 411 chapter_12
Bmgt 411 chapter_12Bmgt 411 chapter_12
Bmgt 411 chapter_12
 
Webinar: Successful B2B Pricing Strategies with Magento
Webinar: Successful B2B Pricing Strategies with MagentoWebinar: Successful B2B Pricing Strategies with Magento
Webinar: Successful B2B Pricing Strategies with Magento
 
Webinar discover acquisio campaign automation algorithms
Webinar discover acquisio campaign automation algorithmsWebinar discover acquisio campaign automation algorithms
Webinar discover acquisio campaign automation algorithms
 
Ebay的自动化
Ebay的自动化Ebay的自动化
Ebay的自动化
 
Pricing for product managers vancouver nov 2017
Pricing for product managers vancouver nov 2017Pricing for product managers vancouver nov 2017
Pricing for product managers vancouver nov 2017
 

More from Ivan Chepurnyi

How to import 1 million SKUs in under 10 minutes
How to import 1 million SKUs in under 10 minutesHow to import 1 million SKUs in under 10 minutes
How to import 1 million SKUs in under 10 minutesIvan Chepurnyi
 
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceMeet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceIvan Chepurnyi
 
Varnish Cache and its usage in the real world!
Varnish Cache and its usage in the real world!Varnish Cache and its usage in the real world!
Varnish Cache and its usage in the real world!Ivan Chepurnyi
 
Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)Ivan Chepurnyi
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentIvan Chepurnyi
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for MagentoIvan Chepurnyi
 

More from Ivan Chepurnyi (6)

How to import 1 million SKUs in under 10 minutes
How to import 1 million SKUs in under 10 minutesHow to import 1 million SKUs in under 10 minutes
How to import 1 million SKUs in under 10 minutes
 
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceMeet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
 
Varnish Cache and its usage in the real world!
Varnish Cache and its usage in the real world!Varnish Cache and its usage in the real world!
Varnish Cache and its usage in the real world!
 
Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)Making Magento flying like a rocket! (A set of valuable tips for developers)
Making Magento flying like a rocket! (A set of valuable tips for developers)
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for Magento
 

Recently uploaded

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Hidden Secrets of Magento Price Rules

  • 1. Ivan Chepurnyi Hidden Secrets of Magento Promotion Rules
  • 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
  • 5. Minimal Price It is just minimal variation of final price
  • 6. HOW IS CALCULATED FINAL PRICE?
  • 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.
  • 9. Option Price • Configurable Product Options (If Product is Configurable) • Custom Options
  • 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)
  • 14. And finally some code MAGE_RULE MODULE
  • 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
  • 19. Specific Implementations Magento Community Edition • Mage_CatalogRule • Mage_SalesRule Magento Enterprise Edition • Enterprise_TargetRule • Enterprise_CustomerSegment
  • 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
  • 22. Properties Initialization protected function _initProperties() { $this->_properties = array( ‘attribute_' => array( 'label' => ‘Some Field Name’, 'type' => 'select', 'data_path' => ’data/path’, 'options' => array() ) ); }
  • 23. Property Types Types: • string • numeric • date • select • multiselect
  • 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() );
  • 26. Test Driven Development Training Course in Berlin, 09-10 Jan http://bit.ly/QeOmia