Jump to content

Is possible to override a Admin theme JS file?


Recommended Posts

Hi community!

I've been some hours trying to resolve my problem.

I need to modify the default product's link_rewrite value format when a product is saving. I need the link_rewrite format to be of type "test-product-name-[idproduct]" instead of "test-product-name".

I've seen that this functionality is in: /PS_ROOT/admin/themes/default/js/bundle/product/form.js in the next function:

/** Update friendly URL */
var updateFriendlyUrl = function(elem) {
/** Attr name equals "form[step1][name][1]".
* We need in this string the second integer */
var id_lang = elem.attr('name').match(/\d+/g)[1];
$('#form_step5_link_rewrite_' + id_lang).val(str2url(elem.val(), 'UTF-8'));
};

 

Is it possible to override this js file? In such case... where should I create this override file? Would be correct to create it in: /PS_ROOT/admin/themes/new-theme/js/bundle/product/form.js and add this JS in the AdminController.php like this: 

$this->addJS(__PS_BASE_URI__.$this->admin_webpath.'/themes/new-theme/js/bundle/product/form.js');

 

Thank you very much!

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...