Author Topic: aroundClassNameMethodName does not work. But what I really want to do...  (Read 2979 times)

Offline dhigz

  • Newbie
  • *
  • Posts: 27
  • Karma: +8/-0
    • View Profile
    • My AbanteCart Site:
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
« Last Edit: August 31, 2016, 06:08:12 PM by dhigz »
Don Higbee

yonghan

  • Guest
Hi, have you tried using
Code: [Select]
onControllerPagesCheckoutConfirm_InitData()

Offline dhigz

  • Newbie
  • *
  • Posts: 27
  • Karma: +8/-0
    • View Profile
    • My AbanteCart Site:
Re: aroundClassNameMethodName does not work. But what I really want to do...
« Reply #2 on: September 01, 2016, 12:14:08 AM »
Ah... yes, of course.

I just didn't use it in my example.
Don Higbee

Offline dhigz

  • Newbie
  • *
  • Posts: 27
  • Karma: +8/-0
    • View Profile
    • My AbanteCart Site:
Re: aroundClassNameMethodName does not work. But what I really want to do...
« Reply #3 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.
Don Higbee

yonghan

  • Guest
Re: aroundClassNameMethodName does not work. But what I really want to do...
« Reply #4 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.

Online abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1747
  • Karma: +238/-10
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: aroundClassNameMethodName does not work. But what I really want to do...
« Reply #5 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
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline dhigz

  • Newbie
  • *
  • Posts: 27
  • Karma: +8/-0
    • View Profile
    • My AbanteCart Site:
Re: aroundClassNameMethodName does not work. But what I really want to do...
« Reply #6 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
Don Higbee