smarty - Override Prestashop setMedia function to put js and css files at the bottom -
i have known frontcontroller override
class frontcontroller extends frontcontrollercore { public function setmedia() { parent::setmedia(); $this->addjs(array( _theme_js_dir_.'adds.js' )); } }
this wokrks expected 1 issue -> adds new js/css files @ top of included files list, here:
<script type="text/javascript" src="/js/adds.js"></script> <script type="text/javascript" src="/js/jquery/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="/js/jquery/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="/js/jquery/plugins/jquery.easing.js"></script> <script type="text/javascript" src="/js/tools.js"></script> <script type="text/javascript" src="/themes/default-bootstrap/js/global.js"></script>
and bad because script land above jquery's script..
how make this
<script type="text/javascript" src="/js/jquery/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="/js/jquery/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="/js/jquery/plugins/jquery.easing.js"></script> <script type="text/javascript" src="/js/tools.js"></script> <script type="text/javascript" src="/themes/default-bootstrap/js/global.js?version=2"></script> <script type="text/javascript" src="/js/adds.js"></script>
i made simple custom module (50 lines) hookheader function below. works charm!
public function hookheader($params) { $this->context->controller->addcss($this->_path.'css/adds.css', 'all'); $this->context->controller->addjs($this->_path.'js/adds.js', 'all'); }
Comments
Post a Comment