Jump to content

[SOLVED] Additional javascript in product.tpl removes categories in blockcategories


Trevor Lawson

Recommended Posts

I am trying to add a bit of javascript to the product.tpl as shown here:

 

<script src="http://www.gbamedical.com/prettyphoto/js/jquery-1.6.1.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="http://www.gbamedical.com/prettyphoto/css/prettyPhoto.css" type="text/css" media="screen" charset="utf-8" />
<script src="http://www.gbamedical.com/prettyphoto/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>

 

for a light box like effect that I plan to use for youtube content. The script needs to be between the <head> tags of the page where I want the effect. I can get the script to work but it removes all the content from the categories block. What can I do to avoid this?

 

Also, in the process of testing it. Even when I remove the script and bring it back to the original product.tpl file. . . .. now when I view the product.. . . . The text color in the category block is blue when it should be gray as in the rest of the templates. Any ideas on what I have done?

 

My website address is: http://www.gbamedical.com

 

Thanks in advance for your help.

Link to comment
Share on other sites

create overridden ProductController extending ProductControllerCore in override/controllers

override method setmedia and also call the parent function

use addjs function of tools class in above function for adding your custom js files

same this can be done for css files using addcss function

Link to comment
Share on other sites

Thank you vinaym! Success!

 

I used your suggestions and found this site to help me along: http://www.prestadb.com/prestashop-override-controllers/

 

Here was my final code:

<?php
   class ProductController extends ProductControllerCore {
    public function setMedia() {
	    parent::setMedia();
	    Tools::addCSS(_THEME_CSS_DIR_.'prettyPhoto.css');
  Tools::addjs(_THEME_JS_DIR_.'jquery-1.6.1.min.js');
  Tools::addjs(_THEME_JS_DIR_.'jquery.prettyPhoto.js');
    }
   }
?>

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