SHamann Posted October 4, 2017 Share Posted October 4, 2017 Hey Guys Quick summary what i try to build. We are an Promotion / Voucher Cloud Service, where our users can create such Voucher / Promotion with very specific condition and we validate if these are valid. Im the lucky one who is doing the shop integretation. So basically im completely new to Presta. Below is the step by step plan im working on. // 1. Catch Voucher Submit Event --> ?? // 2. Connect to API --> Repo // 3. Validate Code --> Repo // 4. Get Discount from API --> Repo // 5. Create Cart Rule and add() --> https://www.prestashop.com/forums/topic/430329-how-to-apply-coupon-code-programatically-for-api/ //--> or: https://www.prestashop.com/forums/topic/269743-module-to-apply-cartrules-or-voucher-code-on-shopping-order-through-ajax-php/ //--> or: https://www.prestashop.com/forums/topic/249088-creating-a-cart-rule-via-php-code/ As you can see there are some links from the Presta forum. So I alreday searched a lot for this on Stackoverflow, the Prest Forum or tried myself to understand in existing Modules Code. So now my Question: 1. How can i attach my code after the user pressed the submit button. I guess there must be a hook or a Function for this. Im using Presta 1.7 and so far i build an working Modul which can be installed and have an little form on the back office for API settings. Also if you think im having a wrong approach on this topic, im thankful for any tipps! Thanks in advance Steffen Link to comment Share on other sites More sharing options...
SHamann Posted October 9, 2017 Author Share Posted October 9, 2017 Did no one ever run into the same problem? Link to comment Share on other sites More sharing options...
SHamann Posted October 17, 2017 Author Share Posted October 17, 2017 #push Link to comment Share on other sites More sharing options...
Geimsdin Posted September 22, 2019 Share Posted September 22, 2019 This forum sometimes sucks, I have many posts that noone answered... In any case, I know it is very late but here's your solution: You have to override the CartRule.php class, there you will find the "public function checkValidity(..." Hope it helps you or someone else wondering the same. Simone Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now