AbanteCart Community

AbanteCart Development => Development Help Needed => Topic started by: dhigz on August 31, 2016, 06:05:41 PM

Title: aroundClassNameMethodName does not work. But what I really want to do...
Post by: dhigz on August 31, 2016, 06:05:41 PM
No matter what I do I cannot get the aroundClassNameMethodName_InitData function to work in my hooks file. Everything else (on, before, etc.) works fine.

What I am attempting to do is to replace the main function on storefront/pages/checkout/confirm.php with my own function and stop the native function from running. Using around will not allow my function to run but the native function still does. Using any other extension hook for InitData, my function will run but will still allow the native function to run. I can't use update data because the "damage is already done". In other words the order gets saved, exactly what I am trying to stop.

What I really want to do is is stop the existing "save order" function call in and replace it with a "save order" function of my own. I have specific requirements that do not work with the existing order core file.

I have tried replacing the entire confirm.php file with my own by placing my version in my extensions storefront/pages/checkout directory and adding the path in my extensions main.php file, but apparently this does not work as the controller will not be overridden. (interesting result though, when you remove the native controller file, it does use the extension controller file).

So I have two possible solutions and neither work. 1) use the extension hook "around" or 2) get the extension controller file to override the native file.

Any thought, ideas?

Don
Title: Re: aroundClassNameMethodName does not work. But what I really want to do...
Post by: yonghan on August 31, 2016, 10:51:19 PM
Hi, have you tried using
Code: [Select]
onControllerPagesCheckoutConfirm_InitData()
Title: Re: aroundClassNameMethodName does not work. But what I really want to do...
Post by: dhigz on September 01, 2016, 12:14:08 AM
Ah... yes, of course.

I just didn't use it in my example.
Title: Re: aroundClassNameMethodName does not work. But what I really want to do...
Post by: dhigz on September 01, 2016, 12:15:14 AM
Actually while I would like a solution to one of my two problems, I did find a way around the issue. It's just talking more coding.
Title: Re: aroundClassNameMethodName does not work. But what I really want to do...
Post by: yonghan on September 01, 2016, 12:25:44 AM
Sorry that i didn't read carefully your first post that you had used on. I suppose you can create your own confirm page and then change the link via guest2 and shipping/payment page.
Title: Re: aroundClassNameMethodName does not work. But what I really want to do...
Post by: abolabo on September 01, 2016, 05:59:26 AM
you can use
$this->baseObject_method
inside your hook to define what method of controller have been called
Title: Re: aroundClassNameMethodName does not work. But what I really want to do...
Post by: dhigz on September 02, 2016, 04:40:39 PM
Dmitriy,

Do you need to identify the method when there is only one method in the class? I didn't try it as I mentioned I did find a work around.

Bottom line, the around_ method does not seem to work.

Thanks for your help.

Don