toanloau Posted February 28, 2014 Share Posted February 28, 2014 (edited) I'm using prestashop 1.5.6, i has problem with getting admin controller link. example: In controller: $this->context->smarty->assign( array( "data" => $this->inputData['PS_SOLRBRIGHT_INDEX_ENGLISH'], "url" => $this->context->link->getAdminLink('SolrBrigdeIndex'), ) ); but the tpl file it display: index.php?controller=SolrBrigdeIndex&token=db1d79f3f87e3d378bf632a1f851df38 the same below is true. http://localhost:81/prestashop/admin123/index.php?controller=SolrbrigdeIndex&token=db1d79f3f87e3d378bf632a1f851df38 but i can't get the same. please help me. thank! Edited February 28, 2014 by toanloau (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted February 28, 2014 Share Posted February 28, 2014 Is it a back office controller? If not, you have to manually write the name of the admin folder, it's not saved anywhere (in a constant, actually, yes, but it's not assigned in the front office anyway) Link to comment Share on other sites More sharing options...
toanloau Posted February 28, 2014 Author Share Posted February 28, 2014 Is it a back office controller? If not, you have to manually write the name of the admin folder, it's not saved anywhere (in a constant, actually, yes, but it's not assigned in the front office anyway) yes it's a back office controller, i use custom template for this controller. Link to comment Share on other sites More sharing options...
NemoPS Posted February 28, 2014 Share Posted February 28, 2014 Well then, using that link should lead you to the back office itself, no? It's a relative link so you should be redirected to the same path Link to comment Share on other sites More sharing options...
toanloau Posted February 28, 2014 Author Share Posted February 28, 2014 Well then, using that link should lead you to the back office itself, no? It's a relative link so you should be redirected to the same path if i use in tpl this is ok, but i want to get this url and put it on jquery: the same $(document).ready(function() { $('#desc-configuration-save').hide(); $('input').click(function(){ window.location.href = {$url}; }); }); it not work! Link to comment Share on other sites More sharing options...
NemoPS Posted February 28, 2014 Share Posted February 28, 2014 Oh I see! What about string manipulation? http://stackoverflow.com/questions/3602323/trying-to-get-a-full-url-without-filename-in-php Then you simply add the index.php part, once you have the base! 1 Link to comment Share on other sites More sharing options...
toanloau Posted February 28, 2014 Author Share Posted February 28, 2014 Oh I see! What about string manipulation? http://stackoverflow.com/questions/3602323/trying-to-get-a-full-url-without-filename-in-php Then you simply add the index.php part, once you have the base! I have resolved this problem, thank a lot! Link to comment Share on other sites More sharing options...
pinarello Posted March 26, 2014 Share Posted March 26, 2014 I'm sorry could you say how you got the link to your controller. I have your same problem with my controller on my form, I can not figure out how to call it in the tpl file. I get to use: dirname (miocontroller), but does not work Link to comment Share on other sites More sharing options...
toanloau Posted March 27, 2014 Author Share Posted March 27, 2014 (edited) I'm sorry could you say how you got the link to your controller. I have your same problem with my controller on my form, I can not figure out how to call it in the tpl file. I get to use: dirname (miocontroller), but does not work $this->context->smarty->assign(array('link' => $this->context->link->getAdminLink('your admincontroller',false))) you assign this into smarty and in .tpl file you get it. or if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){ $urls = 'https://'; } else{ $urls = 'http://'; } $url = $urls.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); then you combine with link got above. Sorry for english. Edited March 27, 2014 by toanloau (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts