I'm trying to override some javascript that is from a 3rd party extension. The js is found at skin/frontend/base/default/js/mageworx/searchsuite/searchsuite.js I tried creating a new js file at skin/frontend/my-theme/default/js/mageworx/searchsuite/searchsuite.js

I thought maybe the js would override in the same way templates do... But unfortunately it's still pulling the js from base.

How can I override this extensions js file?


I searched for searchsuite.js in app and it look like it's getting pulled in from code/community/MageWorx/SearchSuite/Model/Observer.php with a line that looks like this:



Actually, the fallback should be working fine. Looking at the code of Mage_Page_Block_Html_Head, you can see that skin CSS and JS files are processed through the fallback mechanism.

So, I'd try a couple things:

  • start with clearing your cache. This is always a great first step in Magento troubleshooting.

  • Clear the merged Javascript and CSS files, if you are using merging.

  • Check the layout file where the initial JS is being included: is it being added as skin_js, or just js? You want skin JS.

  • As strange as it sounds, ensure that the original file is being output - if it's not, don't expect your fallbacks to override it.

Also, it would be helpful if you would share a bit more about what you mean by, "it's not working." Do you mean that it's not output to your page, or that the functionality isn't working as expected?

  • Thanks for your answer! I've updated my question with more details. I've tried clearing my cache and JS is not being merged. I've also tried edit the original js file from base and it's the one being output. – NateW Nov 18 '16 at 23:36
  • Is MageWorx_SearchSuite a paid or free extension? If it's open source, could you post the contents of MageWorx_SearchSuite_Helper_Data::addFooterJs()? – tjons Nov 21 '16 at 14:18
  • @NateW any updates? – tjons Dec 7 '16 at 2:32
  • Thanks for checking back... Unfortunately it's a paid extension. :| – NateW Dec 15 '16 at 14:37

If you want to override this js-file you should change app/code/community/MageWorx/SearchSuite/Helper/Data.php. Copy this file to the local code-pool (app/code/local/MageWorx/SearchSuite/Helper/Data.php) and change the getFooterJsHtml method from the:

foreach ($this->_js as $src) {
    $js.='<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/base/default/js/' . $src . '"></script>';


foreach ($this->_js as $src) {
    $js.='<script type="text/javascript" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/my-theme/default/js/' . $src . '"></script>';

Additionally, you should copy all the js files to your theme skin directory to prevent bugs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.