cedricpdp Posted May 10, 2013 Share Posted May 10, 2013 Hi ! I wonder if it is possible to include files like address.tpl, identity.tpl etc... to have all informations on the my-account template instead of links ? As it is by default of course it's not because the controller is missing so the tpl doesn't display correctly. Thanks Link to comment Share on other sites More sharing options...
vekia Posted May 10, 2013 Share Posted May 10, 2013 to include .tpl files you can use this: {include file="$tpl_dir./sample-template-file.tpl"} you can crate own sample-template-file.tpl content with any link you want etc. Link to comment Share on other sites More sharing options...
cedricpdp Posted May 21, 2013 Author Share Posted May 21, 2013 Hi there, I don't understand why it's not working. For example if I include addresses.tpl, it says that this customer has no addresses but if i clink on the default link to the TPL it's working. In those two cases, the URL remain the same ... Someone has an explanation ? Thanks Link to comment Share on other sites More sharing options...
cedricpdp Posted May 21, 2013 Author Share Posted May 21, 2013 (edited) Ok, found a solution. I modified my-account.tpl like this: {capture name=path}{l s='My account'}{/capture} <h1 >{l s='My account'}</h1> {if isset($account_created)} <p class="success"> {l s='Your account has been created.'} </p> {/if} {if $has_customer_an_address} {include file="$tpl_dir./address.tpl" } {/if} {include file="$tpl_dir./history.tpl"} {if $returnAllowed} {include file="$tpl_dir./order-follow.tpl"} {/if} {include file="$tpl_dir./order-slip.tpl"} {include file="$tpl_dir./addresses.tpl"} {include file="$tpl_dir./identity.tpl"} {if $voucherAllowed} {include file="$tpl_dir./discount.tpl"} {/if} and MyAccountController.php like this : class MyAccountControllerCore extends FrontController { public $auth = true; public $php_self = 'my-account'; public $authRedirection = 'my-account'; public $ssl = true; public function setMedia() { parent::setMedia(); $this->addCSS(_THEME_CSS_DIR_.'my-account.css'); $this->addCSS(_THEME_CSS_DIR_.'addresses.css'); $this->addJS(_THEME_JS_DIR_.'tools.js'); $this->addJS(_THEME_JS_DIR_.'tools/statesManagement.js'); $this->addCSS(_THEME_CSS_DIR_.'history.css'); $this->addJqueryPlugin('scrollTo'); $this->addJS(_THEME_JS_DIR_.'history.js'); } /** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $AddressesControllerCore = new AddressesControllerCore(); $AddressControllerCore = new AddressControllerCore(); $HistoryControllerCore = new HistoryControllerCore(); $OrderFollowControllerCore = new OrderFollowControllerCore(); $OrderSlipControllerCore = new OrderSlipControllerCore(); $IdentityControllerCore = new IdentityControllerCore(); $DiscountControllerCore = new DiscountControllerCore(); $has_address = $this->context->customer->getAddresses($this->context->language->id); $this->context->smarty->assign(array( 'has_customer_an_address' => empty($has_address), 'voucherAllowed' => (int)CartRule::isFeatureActive(), 'returnAllowed' => (int)Configuration::get('PS_ORDER_RETURN') )); $this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Hook::exec('displayCustomerAccount')); $AddressesControllerCore->initContent(); $AddressControllerCore->initContent(); $HistoryControllerCore->initContent(); $OrderFollowControllerCore->initContent(); $OrderSlipControllerCore->initContent(); $IdentityControllerCore->initContent(); $DiscountControllerCore->initContent(); $this->setTemplate(_PS_THEME_DIR_.'my-account.tpl'); } } Edited May 21, 2013 by cedricpdp (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 21, 2013 Share Posted May 21, 2013 thanks for your solution we really appreciate it im going to mark this thread as solved regards Link to comment Share on other sites More sharing options...
Mehdib92 Posted October 17, 2013 Share Posted October 17, 2013 (edited) thanks for the solution ! Edited October 17, 2013 by Mehdib92 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts