• info@synamen.com
  • +91-89396 79369
  • Reach Us
synamen-logo
  • Home
  • Solutions
    E-Commerce Development Magento E-Commerce Management Mobile App Development Oracle Cloud Solutions
  • Products
    Splurgify for M-commerce MeterDesk -Energy Management & Industrial Analytics Enquiry Management System
  • Portfolio
  • Company
    About Us Our Team News Reach Us
  • Careers
  • Blog

Home >> Blog >> Custom Shopping Cart Price Rule Condition

magento-solutions

30 Aug 2017

Custom Shopping Cart Price Rule Condition

Posted By : AdminPerson E-Commerce Magento

Scenario: Magento offers a set of Shopping cart price rules, which will be helpful for the merchant for various promotions. However, there are difficult situations that merchant face to promote unique offers with given conditions & attributes. Hence merchant requires to have an additional condition for shopping cart price rule (Discount with or without coupon). Detailed Description: Magento is a leading open-source e-commerce platform written in PHP. Fully functional, user-friendly, customizable, secure, robust and feature-rich, Magento has strong evidence of success in the eCommerce market. Successful companies know that sales promotions are among the most effective methods of increasing sales and building customer satisfaction. A survey found that up to 50% of consumers make a purchase only with a promotion. Magento offers standard price rules for Catalog and Shopping cart. Many a time, the standard rules are not sufficient to create new promotional rules for a merchant offer. For anyone looking for Magento Development, we explain here the method to add a custom condition (discount applicable only for orders from mobile app) in Shopping cart price rules. Solution:

Step -1: Override the class Mage_SalesRule_Model_Rule_Condition_Address. (Copy the file Address.php from app/code/core/Mage/SalesRule/Model/Rule/Condition/ to app/code/local/Mage/SalesRule/Model/Rule/Condition/)

Step -2: Add the new condition (highlighted) in the $attributes array as given below $attributes = array( 'base_subtotal' => Mage::helper('salesrule')->__('Subtotal'), 'total_qty' => Mage::helper('salesrule')->__('Total Items Quantity'), 'weight' => Mage::helper('salesrule')->__('Total Weight'), 'payment_method' => Mage::helper('salesrule')->__('Payment Method'), 'shipping_method' => Mage::helper('salesrule')->__('Shipping Method'), 'postcode' => Mage::helper('salesrule')->__('Shipping Postcode'), 'region' => Mage::helper('salesrule')->__('Shipping Region'), 'region_id' => Mage::helper('salesrule')->__('Shipping State/Province'), 'country_id' => Mage::helper('salesrule')->__('Shipping Country'), 'only_for_app' => Mage::helper('salesrule')->__('Only for Mobile App'), /* Newly Added Condition */ ); Step -3: Now the condition will display in the shopping cart price rule, Admin -> Promotions -> Shopping Cart Price Rules -> Add New Rule -> Conditions -> Add New. Step -4: To validate this new condition while applying shopping cart price rules, add the below condition (you shall change condition according to your requirement) into validate function public function validate(Varien_Object $object) { : : if ($this->getAttribute() == 'only_for_app') /* checking new condition */ { /* Your custom logic to validate the condition */ if(Mage::getSingleton('core/session')->getMobile()) { return true; /* If validation success apply rule */ } } : : return parent::validate($object); } Step -5: After adding your logic invalidate function, create the shopping cart price rule with your own new condition and check it out from the front end.

Share this Article on

  • Facebook
  • Twitter
  • LinkedIn

Tags: add new condition in shopping cart , custom shopping cart price rule , magento


Related Posts

How Magento Framework Benefits B2B E-Commerce Businesses?

Out Of Stock Products To The End Of The List In Magento Category Page

Use Of Colors In Magento Admin Sales Order Grid

3 New Magento Tools To Boost Your E-Commerce Growth In 2022

Are you ready to take international customers and reach the global market?

Archive

  • 2022

    September

    July

    April

    March

    February

  • 2019

    March

    February

    January

  • 2018

    December

    November

    October

    September

    August

    July

    June

    March

    February

    January

  • 2017

    December

    November

    October

    September

    August

    July

    June

    May

    April

    March

    February

  • 2013

    December

    September

Tags

add new condition in shopping cart admin admob analytics artificial intelligence augmented information augmented reality automation avoid jquery b2b b2b business b2c bounce rate bvp corporate crawling custom catalogs custom shopping cart price rule customer customer engagement customer satisfaction digital marketing e-commerce e-commerce checkout ecommerce customer experience erp form rules form validation generic google ranking google search googlebot http https hybrid ideas innovation international ionic javascript m-commerce machine learning magento magento e-commerce magento pwa studio mobile advertising platform mobile app development mobile application mobile apps mobile commerce strategy
Synamen-logo

Synamen is an Internet consulting company focusing on efficient use of Internet and Web technologies in business. We are into E-Commerce Development, Magento Development and Mobile App Development Services.

Read More

Solutions

  • E-Commerce Development
  • Magento E-Commerce Management
  • Mobile App Development
  • Oracle Cloud Solutions

Products

  • Mobile E-Commerce Solution
  • Energy Management & Industrial Analytics
  • Enquiry Management System

Reach Us

  • Synamen Thinklabs Pvt Ltd
    #7, Second Floor, Seetha Nagar Main Road, Nungambakkam, Chennai - 600034. India.
  • +91-89396 79369
  • info@synamen.com

© 2007 - Synamen Thinklabs Pvt Ltd. All rights reserved     Privacy Policy