Search code examples
controlleroverridingsmartyprestashopprestashop-1.6

Override MyAccountController Prestashop


I'm using PS 1.6.1.1 and i would like to override MyAccountController to add new var in my tpl file.

I create my file in override/controllers/front/MyAccountController with :

class MyAccountControllerCore extends FrontController
public function initContent()
{        
    $smarty = new Smarty;
    $smarty->assign('firstname', 'Doug');

    $this->setTemplate(_PS_THEME_DIR_.'my-account.tpl');
}

}

When i call <span>{$firstname}</span> in my tpl file, not work.

I removed cache/class_index.php

Any idea ?

Thanks !


Solution

  • try with :

    class MyAccountControllerCore extends FrontController
        public function initContent()
        {           
            $this->context->smarty->assign('firstname', 'Doug');
            Parent::initContent();
        }
    }
    

    Regards