Developer question about javascripts in shop back office

Hi, I would like to ask you a couple of question: 1) I need to do something in the backend orders list page, Is there an hook that hooks when the orders list page is loaded? 2) Is there a way to add a custom javascript for the backend theme during the installation of a custom module? Thank you in advance. Best regards.


PrestaShop expert answer about javascript usage in shop's back office

Hello
  1. You can use hook: actionAdminControllerSetMedia it is executed on every page in shop back office.
    If you want to run it only on orders list page you can use some php's if condition inside hookactionAdminControllerSetMedia() function to check what controller is currently viewed:
    if (Tools::getValue('controller') == 'AdminOrders')
  2. by default no, but you can do it with some work around. You can insert a script to modules page with module's __construct function. It will be included always - no matter if module will be installed (like it is with module usage inside hooks) or not. Then build some javascript code that will identify the module installation process.
Share on Google Plus

About VEKIA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment