Jump to content

How to define a js file in the right place for widget module


Hassene kh

Recommended Posts

I had created a module prestashop  using  "extends Module implements WidgetInterface"  and i added js file in construct function  every things works  , when i call a method with ajax a resive an erreur

" Uncaught Error: Call to a member function registerJavascript() on null in /var/www/html/PrestaShop-1.7.6.7/modules/ns_monmodule/ns_monmodule.php:54
Stack trace:
#0 [internal function]: Ns_MonModule->__construct()

#1 /var/www/html/PrestaShop-1.7.6.7/src/Core/Foundation/IoC/Container.php(131): ReflectionClass->newInstance()
#2 /var/www/html/PrestaShop-1.7.6.7/src/Core/Foundation/IoC/Container.php(164): PrestaShop\PrestaShop\Core\Foundation\IoC\Container->makeInstanceFromClassName('ns_monmodule', Array)
#3 /var/www/html/PrestaShop-1.7.6.7/src/Core/Foundation/IoC/Container.php(177): PrestaShop\PrestaShop\Core\Foundation\IoC\Container->doMake('ns_monmodule', Array)
#4 /var/www/html/PrestaShop-1.7.6.7/src/Adapter/ServiceLocator.php(65): PrestaShop\PrestaShop\Core\Foundation\IoC\Container->make('ns_monmodule')
#5 /var/www/html/PrestaShop-1.7.6.7/classes/module/Module.php(1141): PrestaShop\PrestaShop\Adapter\ServiceLocator::get('ns_monmodule')
#6 /var/www/html/PrestaShop-1.7.6.7/classes/module/Module.php(1120): Modul in <b>/var/www/html/PrestaShop-1.7.6.7/modules/ns_monmodule/ns_monmodule.php</b> on line <b>54</b><br />

i nedd to konw how to define in the right place and use ajax to call methods from controllers a file js in a module , thanks in advance 

Capture d’écran de 2020-12-10 12-11-32.png

Capture d’écran de 2020-12-10 12-10-40.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...