Jump to content

How to add a new custom dynamic page in customer account in prestashop 1.6.1.3


vikasmnl

Recommended Posts

Hello,

 

Firstly create a tab-link in your themes/yourtheme/my-account.tpl.

For example :

<p class="info-account">{l s='Welcome to your account. Here you can manage all of your personal information and orders.'}</p>
<div class="row addresses-lists">
    <div class="col-xs-12">
        <ul class="myaccount-link-list">
            <li><a href="{$link->getPageLink('mypage', true)|escape:'html':'UTF-8'}"><span>{l s='My Page'}</span></a></li>
[...]

Then create a controller.

For example controllers/front/myPageController.php :

<?php

class MyPageControllerCore extends FrontController
{
    public $auth = true;
    public $php_self = 'mypage';
    public $authRedirection = 'mypage';
    public $ssl = true;

    protected $customer;

    public function init()
    {
        parent::init();
        $this->customer = $this->context->customer;
    }
    public function postProcess()
    {
        return $this->customer;
    }
    public function initContent()
    {
        parent::initContent();
        $id_customer = $this->customer->id;
        $this->context->smarty->assign(array(
            'id_customer' => $id_customer,
        ));
        $this->setTemplate(_PS_THEME_DIR_.'mypage.tpl');
    }
    public function setMedia() // Optionnal
    {
        parent::setMedia();
        $this->addCSS(_MODULE_DIR_.'...PATH...mypage.css');
        $this->addJS(_MODULE_DIR_.'...PATH...mypage.js');
    }
[...]
}

Then create your template file.

For example themes/yourtheme/mypage.tpl (page displayed when tab is clicked).

 

Inside this page, you include a custom hook.

 

Finally in this hook you transplant your module (which handles -in connexion with the controller you created before-) the customer's actions, i.e uploads).

Edited by Yopixel (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 4 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...