NXJeff Posted September 11, 2017 Share Posted September 11, 2017 (edited) Hello, I am developing a module, to make the my-account have an additional menu item at the user's my-account page, called 'Manage Machine IDs'. my-account-hook.tpl <!-- Block woi-my-account-hook --> <a class="col-lg-4 col-md-6 col-sm-6 col-xs-12" id="returns-link" href="{$urls.pages.order_follow}"> <span class="link-item"> <i class="material-icons"></i> {l s='Manage Machine IDs' d='Shop.Theme.CustomerAccount'} </span> </a> <!-- Block woi-my-account-hook --> I have make it shown by using displayCustomerAccount hook and it went well. But for the href (highlighted in red), I do not know how to point it to my module page. Next step would be linking the menu item to my module's page, I created a tpl and controller but i have no idea how to access my module page from the my-account-hook.tpl. mymodule/controllers/front/customer/ |_________ ManageMachinesController.php mymodule/views/templates/front/customer/ |_________ manage-machines.tpl ManageMachinesController.php <?php class ManageMachinesControllerCore extends ModuleFrontController { public $auth = true; public $php_self = 'my-machines'; public $authRedirection = 'my-machines'; public $ssl = true; public function initContent() { parent::initContent(); $this->setTemplate('manage-machines.tpl'); } } manage-machines.tpl <h2>hello</h2> I have no idea how to point the href in the my-account-hook.tpl to manage-machines.tpl. Can anyone suggest me on this? Thank you. Edited September 11, 2017 by NXJeff (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted September 12, 2017 Share Posted September 12, 2017 You would use the getModuleLink function of the Link class to get the URL to your controller $this->context->link->getModuleLink('mymodule', 'ManageMachines', null, true); Also, I believe you have the layout of your controller and template file wrong. Put the controller in /front/ and the name the file properly (the file name should match the controller name, and I would use all lowercase) mymodule/controllers/front/ |_________ managemachines.php mymodule/views/templates/front/ |_________ manage-machines.tpl Link to comment Share on other sites More sharing options...
NXJeff Posted September 15, 2017 Author Share Posted September 15, 2017 (edited) You would use the getModuleLink function of the Link class to get the URL to your controller $this->context->link->getModuleLink('mymodule', 'ManageMachines', null, true); Also, I believe you have the layout of your controller and template file wrong. Put the controller in /front/ and the name the file properly (the file name should match the controller name, and I would use all lowercase) mymodule/controllers/front/ |_________ managemachines.php mymodule/views/templates/front/ |_________ manage-machines.tpl Hello bellini13, thank you for helping me up, end up using same name does not solve my problem. The controller name that required from the prestashop is something like mymoduleManageMachinesFrontModuleController which is really weird to me. Since my customisation seems to be easier to do it by modifying the existing classes directly, i will give it a try instead of create a module that do alot of overriding, as this is just for a client. Anyway, thanks alot for helping up, really appreciate that! Edited September 15, 2017 by NXJeff (see edit history) 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