Author Topic: Add hooks to BlocksMenu controller  (Read 6348 times)

yonghan

  • Guest
Add hooks to BlocksMenu controller
« on: June 17, 2016, 01:55:39 AM »
Hi admins, please consider to add hooks into BlocksMenu controller. I need to replace an item link via my extension. The link will be replaced if the extension is turned on and vice versa. I don't see another way to do that except replacing the items info for now. Thanks a lot.

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2046
  • Karma: +318/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Add hooks to BlocksMenu controller
« Reply #1 on: June 17, 2016, 07:40:09 AM »
you should to create hook for admin side, on your extension status changing event. 
Just replace link of item via menu_control class.
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

yonghan

  • Guest
Re: Add hooks to BlocksMenu controller
« Reply #2 on: June 17, 2016, 10:00:26 AM »
Hi abolabo. I want to apologize for not explaining in detail. I was saying about storefront blocksmenu controller, not admin side.

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2046
  • Karma: +318/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Add hooks to BlocksMenu controller
« Reply #3 on: June 17, 2016, 12:24:28 PM »
please clarify "The link will be replaced if the extension is turned on and vice versa."
Turn On where? on admin or storefront side?

“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

yonghan

  • Guest
Re: Add hooks to BlocksMenu controller
« Reply #4 on: June 17, 2016, 07:51:55 PM »
The extension is turned on via admin side. The link that i want to change is storefront side.

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2046
  • Karma: +318/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Add hooks to BlocksMenu controller
« Reply #5 on: June 21, 2016, 04:38:22 AM »
so.. when you turn on your extension on admin side you should to replace link for menu item with admin-side hook.
Just use core/lib/menu_control_storefront.php in it.
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

yonghan

  • Guest
Re: Add hooks to BlocksMenu controller
« Reply #6 on: August 22, 2016, 07:03:45 AM »
Thanks Abolabo, I'll try it. Sorry for late reply.

yonghan

  • Guest
Re: Add hooks to BlocksMenu controller
« Reply #7 on: August 22, 2016, 08:16:57 AM »
Hi Abolabo, i can get the menu item link replaced by using your suggestion. So i hook the extension status and change the menu item link based on the status. Thanks a lot.

 

Powered by SMFPacks Social Login Mod