sibrodo Posted January 21, 2016 Share Posted January 21, 2016 Hello Guys, I'd like to know whether there is a hook related to Cart Rule. I am using Prestashop 1.5.4 and here's what i'd like to achive When a customer submit a voucher code, it will then hook to a module i am developing. The module basically checks whether the code which just been submitted has a special prefix. If it does, then the module will generate a price rule on the fly (because the voucher code is not yet exist in the system). If the voucher code does not contain any prefix it will just check against the cart rule database (which already exist in the system / has been previously entered by admin). This might sounds odd, but the module i am creating is actually validating a voucher code generated by another system (external system). Please let me know whether this is possible. regards, Rama Link to comment Share on other sites More sharing options...
roja45 Posted January 21, 2016 Share Posted January 21, 2016 From what I can see it will create the new cart rule when you submit the voucher so it will call the following hook actionObjectCartRuleAddBefore before doing so. You could try creating your voucher at this point. Link to comment Share on other sites More sharing options...
sibrodo Posted January 21, 2016 Author Share Posted January 21, 2016 Hi roja45, thanks for replying. I am using presta 1.5.4 and i dont see the hook u mention here http://doc.prestashop.com/m/mobile.action#page/11272205 I am currently view it in my phone, ao probably i missed it, nevertheless i will check it again. Thanks Link to comment Share on other sites More sharing options...
roja45 Posted January 21, 2016 Share Posted January 21, 2016 Yup, 1.5.4, I read your original post. I'm checking in 1.5.something (not exactly sure which point release this is). The important thing however is that it is in the code: Check ObjectModel -> add -> Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this)); There are many secret hooks in Prestashop, the code and a debugger are always your friend. Link to comment Share on other sites More sharing options...
sibrodo Posted February 9, 2016 Author Share Posted February 9, 2016 Hello @roja45, Thanks for your clarification, however it seems that the following code will be called upon, right before creating a new cart rule. public function hookActionObjectCartRuleAddBefore() { echo "testing"; die(); } However what i am trying to do is to have something like this : public function callThisWhenCustomerSubmitVoucherCodeFromChecktOut() { /* Place your code here. */ } I am wondering whether such hook exists ? Cheers Link to comment Share on other sites More sharing options...
Jibax Posted September 4, 2019 Share Posted September 4, 2019 Same need here with PS 1.7.3 : @sibrodo did you find the hook ? 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