jemmeli Posted May 31, 2013 Share Posted May 31, 2013 hello everybody I have a custom controller that have an function and I want to know if there is any solution to Call this custom controller action method from a href link and thank you Link to comment Share on other sites More sharing options...
vekia Posted May 31, 2013 Share Posted May 31, 2013 for back office or for front office? and what ps version? 1 Link to comment Share on other sites More sharing options...
jemmeli Posted May 31, 2013 Author Share Posted May 31, 2013 for a back office and the version is prestashop 1.5 Link to comment Share on other sites More sharing options...
vekia Posted May 31, 2013 Share Posted May 31, 2013 index.php?controller=YOUR_CONTROLLER&action=example&token=922fb5c427f8abfa1eaf7aa175c9529b then, in your code, you can create if condition like: if ($_GET['action']=='example'){ $this->yourexamplefunction(); } 1 1 Link to comment Share on other sites More sharing options...
jemmeli Posted May 31, 2013 Author Share Posted May 31, 2013 thinks for the repley Link to comment Share on other sites More sharing options...
vekia Posted May 31, 2013 Share Posted May 31, 2013 let me know if this method works for you, if you've got questions - feel free to continue discussion here 1 Link to comment Share on other sites More sharing options...
jemmeli Posted May 31, 2013 Author Share Posted May 31, 2013 yes it works very well thx a lot Link to comment Share on other sites More sharing options...
vekia Posted June 1, 2013 Share Posted June 1, 2013 thanks for information that my solution works for you i marked this thread as solved if you've got an y questions related to this topic - feel free to continue discussion here - solved isn't mean closed regards 1 Link to comment Share on other sites More sharing options...
jemmeli Posted June 3, 2013 Author Share Posted June 3, 2013 yes thx a lot friend i put the code you giving me in the constructor of the controller and it work well for me Link to comment Share on other sites More sharing options...
jbastarras Posted July 23, 2014 Share Posted July 23, 2014 (edited) Hello , i´ll try in class AdminOrdersController extends AdminOrdersControllerCore and not works I call like index.php?controller=AdminOrders&token=b25b78729e33e99c5359c54482392669&action=example with form <form method="post" action="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&action={$action|escape:'htmlall':'UTF-8'}"> <input type="submit" id="submitFunction" value="Actualize" name="submitFunction" class="button" > </form> And in my controller code public function __construct() { if ($_GET['action']=='example'){ $this->function_example(); }else{ parent::__construct(); $this->_conf = $this->_conf + array(32 => $this->l('texto')); } } Thanks Edited July 23, 2014 by jbastarras (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2014 Share Posted July 23, 2014 hello and what's going on if you will try to die() inside your if condition? Link to comment Share on other sites More sharing options...
kfakk Posted February 2, 2015 Share Posted February 2, 2015 index.php?controller=YOUR_CONTROLLER&action=example&token=922fb5c427f8abfa1eaf7aa175c9529b then, in your code, you can create if condition like: if ($_GET['action']=='example'){ $this->yourexamplefunction(); } Hello. Where should I put this code? I'am trying to add showdetails method in productList (back office). I put 'showdetails' rowAction in AdminProductsController in renderList() method and write displayShowDetailsLink() method in HelperList.php. public function displayShowDetailsLink($token = null, $id, $name = null) { $tpl = $this->createTemplate('list_action_details.tpl'); if (!array_key_exists('Details', self::$cache_lang)) self::$cache_lang['Details'] = $this->l('Details', 'Helper'); $ajax_params = $this->ajax_params; if (!is_array($ajax_params) || !isset($ajax_params['action'])) $ajax_params['action'] = 'details'; $tpl->assign(array( 'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&showdetails'.$this->table.'&token='.($token != null ? $token : $this->token), 'action' => self::$cache_lang['Details'], 'id' => $id )); return $tpl->fetch(); } I think it should be work but i don't know where place the showdetails action. Best Regards Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now