[email protected] Posted February 10, 2021 Share Posted February 10, 2021 Hello Prestashop adicts I wiriting a Theme and try to change the look of the Autocomplete Search box. Actual there is "Category > Product" displayed. I try to add the product image and remove the Category. What is the best way to overwrite the ps_searchbar.js from a Theme? I tryed to insert a ps_searchbar.js in my Theme. But this is not the way it works. Thanks and have a nice day. Link to comment Share on other sites More sharing options...
elburgl69 Posted February 10, 2021 Share Posted February 10, 2021 creating the file in: <document_root>/themes/<your theme name>/modules/ps_searchbar/ps_searchbar.js Should have that file being rendered. Clear (Smarty) Cache (and to be sure delete cache on disk (delete all stuff in <document_root>/app/cache), or restart your cache if you use other mechanisms. Rg, Leo Link to comment Share on other sites More sharing options...
[email protected] Posted February 10, 2021 Author Share Posted February 10, 2021 Dear Leo Thank you for the answer. That's exactly what I was expecting how it could work. Unfortunately it has no effect. My js file in my theme won't load. The module ps_searchbar loads the js file in ps_searchbar.php with the function $ this->context->controller->registerJavascript(.... Presumably, this function does not consider theme files. Unfortunately, the documentation doesn't reveal anything about this either. Other ideas? Link to comment Share on other sites More sharing options...
elburgl69 Posted February 10, 2021 Share Posted February 10, 2021 Just tested it on a 1.7.2 install and it picks up the themes ps_searchbar.js file. Can't imagine it changed in higher versions. On which version are you? Look in the generated HTML which version is loaded. Should be a JS loading block at the end of your HTML. If you can't find ps_searchbar.js in the generated HTML, you probably use Smart Cache for Javascript (it is in the section where you clear cache in the back end (I'm on a dutch version so do not know the english term used)). Turn that option of an start reloading pages, until you find ps_searchbar.js. Check the location it loads from (should be the theme directory). Otherwise for one or the other reason your <document_root>/modules is read before <document_root>/themes/<your theme>/modules. Set the option in the back end to only load Prestashop module to check in that solves the problem. If so one of your modules is messing stuff up. Else it is a bug. Rg, Leo Link to comment Share on other sites More sharing options...
[email protected] Posted February 11, 2021 Author Share Posted February 11, 2021 Dear Leo Thank you again, you gave me the right tip. However, it's a little embarrassing for me. The fault was mine. I activated the wrong theme 😉 But now, thanks to your help, it's going like clockwork! By the way: I work on the last released Prestashop version 1.7.7.1 Have a nice day Daniel Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now