How to check if Magento Shopping Cart Price Rule Conditions have been met












0















Really struggling with this. I'm trying to see if the conditions of a 'Shopping Cart Price Rule' have been met directly on the 'View Cart' page. If so, I want to add a product automatically to the cart.



I have been trying different methods using:



Mage::getModel('salesrule/rule')->load($id)->getConditions();


with the rule ID being 18, then echoing to see if it worked, no such luck yet.



I'm trying to make it so I can at least see if the conditions have been met before I try to automatically add a product to the cart.



Something along the lines of:



if (product conditions have been met) {
automatically add product to cart
}


I have already seen this How to check if shopping cart price rule applied to quote, however that is showing rules that have already been applied, rather than rule that 'could' be applied.



Any help would be much appreciated.



James










share|improve this question





























    0















    Really struggling with this. I'm trying to see if the conditions of a 'Shopping Cart Price Rule' have been met directly on the 'View Cart' page. If so, I want to add a product automatically to the cart.



    I have been trying different methods using:



    Mage::getModel('salesrule/rule')->load($id)->getConditions();


    with the rule ID being 18, then echoing to see if it worked, no such luck yet.



    I'm trying to make it so I can at least see if the conditions have been met before I try to automatically add a product to the cart.



    Something along the lines of:



    if (product conditions have been met) {
    automatically add product to cart
    }


    I have already seen this How to check if shopping cart price rule applied to quote, however that is showing rules that have already been applied, rather than rule that 'could' be applied.



    Any help would be much appreciated.



    James










    share|improve this question



























      0












      0








      0








      Really struggling with this. I'm trying to see if the conditions of a 'Shopping Cart Price Rule' have been met directly on the 'View Cart' page. If so, I want to add a product automatically to the cart.



      I have been trying different methods using:



      Mage::getModel('salesrule/rule')->load($id)->getConditions();


      with the rule ID being 18, then echoing to see if it worked, no such luck yet.



      I'm trying to make it so I can at least see if the conditions have been met before I try to automatically add a product to the cart.



      Something along the lines of:



      if (product conditions have been met) {
      automatically add product to cart
      }


      I have already seen this How to check if shopping cart price rule applied to quote, however that is showing rules that have already been applied, rather than rule that 'could' be applied.



      Any help would be much appreciated.



      James










      share|improve this question
















      Really struggling with this. I'm trying to see if the conditions of a 'Shopping Cart Price Rule' have been met directly on the 'View Cart' page. If so, I want to add a product automatically to the cart.



      I have been trying different methods using:



      Mage::getModel('salesrule/rule')->load($id)->getConditions();


      with the rule ID being 18, then echoing to see if it worked, no such luck yet.



      I'm trying to make it so I can at least see if the conditions have been met before I try to automatically add a product to the cart.



      Something along the lines of:



      if (product conditions have been met) {
      automatically add product to cart
      }


      I have already seen this How to check if shopping cart price rule applied to quote, however that is showing rules that have already been applied, rather than rule that 'could' be applied.



      Any help would be much appreciated.



      James







      shopping-cart-price-rules quote programmatically






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:54









      Community

      1




      1










      asked Feb 1 '16 at 18:00









      James LaneJames Lane

      294




      294






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You need to make a Observer.php file where you will be defining your rule. So when that particular product or group of product will be added to the cart,at that moment,the Observer.php will be called,will apply the rule if applicable.



          I will be writing a blog on that and will be releasing it soon.For the time being,you better try to create a Observer.php file and define the rule there and see what happens next.



          Note:For that you will have to change the config.xml file for that particular module.






          share|improve this answer

































            0














            You need to go to this path as given below->
            Promotions->Shopping Cart Rules->(Click on the rule you defined)->Conditions
            And, you will get to know if any condition is defined for that particular rule or not.I am sharing the screenshot,refer to it.



            Shopping Cart Rule Condition Section






            share|improve this answer


























            • Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.

              – James Lane
              Feb 3 '16 at 11:36











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f99920%2fhow-to-check-if-magento-shopping-cart-price-rule-conditions-have-been-met%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You need to make a Observer.php file where you will be defining your rule. So when that particular product or group of product will be added to the cart,at that moment,the Observer.php will be called,will apply the rule if applicable.



            I will be writing a blog on that and will be releasing it soon.For the time being,you better try to create a Observer.php file and define the rule there and see what happens next.



            Note:For that you will have to change the config.xml file for that particular module.






            share|improve this answer






























              1














              You need to make a Observer.php file where you will be defining your rule. So when that particular product or group of product will be added to the cart,at that moment,the Observer.php will be called,will apply the rule if applicable.



              I will be writing a blog on that and will be releasing it soon.For the time being,you better try to create a Observer.php file and define the rule there and see what happens next.



              Note:For that you will have to change the config.xml file for that particular module.






              share|improve this answer




























                1












                1








                1







                You need to make a Observer.php file where you will be defining your rule. So when that particular product or group of product will be added to the cart,at that moment,the Observer.php will be called,will apply the rule if applicable.



                I will be writing a blog on that and will be releasing it soon.For the time being,you better try to create a Observer.php file and define the rule there and see what happens next.



                Note:For that you will have to change the config.xml file for that particular module.






                share|improve this answer















                You need to make a Observer.php file where you will be defining your rule. So when that particular product or group of product will be added to the cart,at that moment,the Observer.php will be called,will apply the rule if applicable.



                I will be writing a blog on that and will be releasing it soon.For the time being,you better try to create a Observer.php file and define the rule there and see what happens next.



                Note:For that you will have to change the config.xml file for that particular module.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 47 mins ago









                Teja Bhagavan Kollepara

                2,96341847




                2,96341847










                answered Feb 3 '16 at 13:55









                Arijit DeArijit De

                262




                262

























                    0














                    You need to go to this path as given below->
                    Promotions->Shopping Cart Rules->(Click on the rule you defined)->Conditions
                    And, you will get to know if any condition is defined for that particular rule or not.I am sharing the screenshot,refer to it.



                    Shopping Cart Rule Condition Section






                    share|improve this answer


























                    • Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.

                      – James Lane
                      Feb 3 '16 at 11:36
















                    0














                    You need to go to this path as given below->
                    Promotions->Shopping Cart Rules->(Click on the rule you defined)->Conditions
                    And, you will get to know if any condition is defined for that particular rule or not.I am sharing the screenshot,refer to it.



                    Shopping Cart Rule Condition Section






                    share|improve this answer


























                    • Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.

                      – James Lane
                      Feb 3 '16 at 11:36














                    0












                    0








                    0







                    You need to go to this path as given below->
                    Promotions->Shopping Cart Rules->(Click on the rule you defined)->Conditions
                    And, you will get to know if any condition is defined for that particular rule or not.I am sharing the screenshot,refer to it.



                    Shopping Cart Rule Condition Section






                    share|improve this answer















                    You need to go to this path as given below->
                    Promotions->Shopping Cart Rules->(Click on the rule you defined)->Conditions
                    And, you will get to know if any condition is defined for that particular rule or not.I am sharing the screenshot,refer to it.



                    Shopping Cart Rule Condition Section







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 46 mins ago









                    Teja Bhagavan Kollepara

                    2,96341847




                    2,96341847










                    answered Feb 3 '16 at 10:57









                    Arijit DeArijit De

                    262




                    262













                    • Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.

                      – James Lane
                      Feb 3 '16 at 11:36



















                    • Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.

                      – James Lane
                      Feb 3 '16 at 11:36

















                    Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.

                    – James Lane
                    Feb 3 '16 at 11:36





                    Hi Arijit, I get that, and understand the conditions part which I have already set up, but I want to automatically add a product to the cart when those conditions have been met, rather than the customer having to add the product manually. In my actions, I have already set the product to be added as 100% off the price.

                    – James Lane
                    Feb 3 '16 at 11:36


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f99920%2fhow-to-check-if-magento-shopping-cart-price-rule-conditions-have-been-met%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What other Star Trek series did the main TNG cast show up in?

                    Berlina muro

                    Berlina aerponto