Jump to content

Override AdminProductController and change price.js


manudas

Recommended Posts

Hi!

I´m trying to override AdminProductController.php and this is working fine, with almost all my overrided functions, but I ´m trying to import another distinct prices.js located in my module folder (original is located in /rootfolder/js/ folder).

 

The strange thing here is that js is not set in setMedia function but in postProcess (look at adminProductController of ps 1.5.6) and changing _PS_JS_DIR_.'price.js', to _PS_MODULE_DIR_.'pricerules/js/price.js', is not working

 

If I look with the chrome inspector, I see the imported file is the original one and not my module js.

 

Any ideas about what I´m doing wrong ?

Link to comment
Share on other sites

I´m getting crazy...

If I put a die("messege") before $this->addJS() call function in AdminProductController::postProcess(), I can read the message in the screen when installing the override and entering in the add product or edit product tab. So the code is executed till there. But I cant see the JS code to be added!

This is how the override class include the js:

 

$this->addJS(array(
_PS_JS_DIR_.'productTabsManager.js',
_PS_JS_DIR_.'admin-products.js',
_PS_JS_DIR_.'attributesBack.js',
_PS_JS_DIR_.'price.js',
 
...)
 
I just change _PS_JS_DIR_.'price.js' for _PS_MODULE_DIR.'pricerules/js/price.js') without success. The program flow executes till at least the prior line where I did the die call, so... whats wrong ?
 
I noticed that comenting the $this->addJS full call doesn´t change anything, so more mistery then... Where is added the /js/price.js ?
 
Another, maybe, important detail may be the way this js is passed to the navigator:
 
<script type="text/javascript" src="/telerosa/admin6919/../js/price.js"></script>
 
It jumps from my admin folder to the previous one with .., and in the AdminProductController this is not being done because there it´s passed _PS_JS_DIR_.'price.js' to addJS call. As far as I know _PS_JS_DIR_ doesn't concatenate inside itself the admin dir.
 
Any help will be appreciated
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...