smallbizwiz Posted July 24, 2014 Share Posted July 24, 2014 In a module, I need to create a cart rule that contains product restrictions. I can see that we set $cart_rule->product_restriction to 1 to indicate there is a product restriction fro the cart rule. How do we take the next step to indicate the actual products/categories that are included in the restriction? That is, after executing $cart_rule->add(), how does the cart rule know what restriction to apply exactly? I would assume we pass an array of types and IDs to a function that will do this???? I could certainly use brute force to insert data into cart_rule_product_rule, cart_rule_product_rule_value and cart_rule_product_rule_group tables, but there has to be a systematic way to do this in PS. Help!!!! Thanks guys, Teo Link to comment Share on other sites More sharing options...
Mahdi Shad Posted February 19, 2015 Share Posted February 19, 2015 Simple way : 1- your customers must create one or more cart rules 2- select one of available cart rules in admin of your module 3- your module will work with selected item settings (restrictions , ...) Hard way : you must check admincartrulecontroller and cartrule class, then use their methods to create cart rules with some restrictions Link to comment Share on other sites More sharing options...
Recommended Posts