dollarsound Posted February 19, 2014 Share Posted February 19, 2014 Im a newbie and i can't find the answer neither googling nor testing. My doubt is let's say im creating a module with this methods: Class testmoduleAllproductsModuleFrontController extends ModuleFrontController { public function init() { parent::init(); } public function helloworld(){ } } Can i call helloworld method of this class from a url? I mean like codeigniter you can call like /controller/action/params/, thad would be /module/testmodule/Allproducts/helloworld or like index.php?fc=module&module=testmodule&controller=AllProducts&action=helloworld? Or everything has to happen inside init()? Thanks Link to comment Share on other sites More sharing options...
vekia Posted February 20, 2014 Share Posted February 20, 2014 you can pass GET params in url (after "?") then in init function you can use something like: if (Tools::getValue('mygetparam')==1){ $this->helloworld(); } Link to comment Share on other sites More sharing options...
dollarsound Posted February 20, 2014 Author Share Posted February 20, 2014 Thanks Vekia, but what i want to achive is: Class testmoduleAllproductsModuleFrontController extends ModuleFrontController { public function init() { parent::init(); } public function helloworld(){ generate an output } public function buyworld(){ generate an action } } I would like to know if it's possible in presashop to call one of these public methods directly from an url. http://mysite.com/mycontroller/helloworld as you can do in ror or in codeigniter not from inside the class. I dont know if im explaining myself right. Link to comment Share on other sites More sharing options...
kinetic Posted December 2, 2014 Share Posted December 2, 2014 Hi Dollarsound, I'm in the same situation, how you solved? Heeeeeeeeeeeeeelp!!! Link to comment Share on other sites More sharing options...
fdib Posted September 26, 2015 Share Posted September 26, 2015 Hi, sorry to bring back this old thread, but I was wondering if anyone got this issue solved? Link to comment Share on other sites More sharing options...
JD@9453 Posted April 6, 2016 Share Posted April 6, 2016 Hi, I am using supershop theme and want to customize order module. I want to list invoice of particular product on the same page where it shows success message for order confirmation. Please suggest how can I achieve this?? Link to comment Share on other sites More sharing options...
abdess Posted February 14, 2017 Share Posted February 14, 2017 example: yoursite.com/test?n1=22&n2=5 in your controller class TestControllerCore extends FrontController { public function initContent() { parent::initContent(); if (Tools::getValue('n1')&&Tools::getValue('n2')){ $n1=Tools::getValue('n1'); $n2=Tools::getValue('n2'); $res=$this->add($n1,$n2); $this->context->smarty->assign(array('res' => $res)); } $this->setTemplate(_PS_THEME_DIR_.'your_template.tpl'); } public function add($n1,$n2){ return $n1+$n2; } } your template.tpl <center> {$res} </center> $res=27 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