Jump to content

Hook for Voucher Submit


Recommended Posts

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

  • 2 weeks later...
  • 1 year later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...