Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

aroundClassNameMethodName does not work. But what I really want to do...

Started by dhigz, August 31, 2016, 06:05:41 PM

Previous topic - Next topic

dhigz

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
Don Higbee

yonghan

Hi, have you tried using onControllerPagesCheckoutConfirm_InitData()

dhigz

Don Higbee

dhigz

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.
Don Higbee

yonghan

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.

abolabo

you can use
$this->baseObject_method
inside your hook to define what method of controller have been called
"No one is useless in this world who lightens the burdens of another."
― Charles Dickens

dhigz

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
Don Higbee

Forum Rules Code of conduct
AbanteCart.com 2010 -