Page blanche = erreur PHP a priori, donc non, ce n'est pas le bon code
Il ne faut pas ajouter tout le code de AddressesController, mais modifier uniquement la fonction initContent dans MyAccountController en s'inspirant de ce qui est fait dans l'autre
Code original PS 1.6.1.23:
public function initContent()
{
parent::initContent();
$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'));
$this->setTemplate(_PS_THEME_DIR_.'my-account.tpl');
}
Code modifié:
public function initContent()
{
parent::initContent();
$has_address = $this->context->customer->getAddresses($this->context->language->id);
// Récupération des adresses du client
$addresses = $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'),
// Passage des adresses au template
'addresses' => $addresses,
));
$this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Hook::exec('displayCustomerAccount'));
$this->setTemplate(_PS_THEME_DIR_.'my-account.tpl');
}