Since My Account is intended exclusively for processing personal data of the current customer, the controller operates in conjunction with a class-model Customer. This model handles not only such properties as Lastname, Firstname, Email and others, but also such as a set of groups of the current customer and addresses (shipping, billing). The following main methods interact with these properties:
Customer:: addGroups($groups); //adds new groups to a customer, which are transmitted through the array $groups. The groups are managed by the Group class.
Customer:: getAddresses($id_lang); //gets a list of all customer's addresses. The addresses are managed by the Addresses class.
Customer:: getAddressesTotalById($id_customer); //number of addresses created by a customer
Customer:: getCurrentCountry($id_customer, Cart $cart = null); //gets the current customer country location
Settings are configured under the “Preferences -> Customers” menu section which is located in the administration section of the store.
My Account main page.
It is generated by the controller MyAссоuntCоntrоller:
class MyAccountControllerCore extends FrontController
public $auth = true;
public $php_self = 'my-account';
public $authRedirection = 'my-account';
public $ssl = true;
public function setMedia()
* Assign template vars related to page content
* @see FrontController::initContent()
public function initContent()
$has_address = $this->context->customer->getAddresses($this->context->language->id);
'has_customer_an_address' => empty($has_address),
'voucherAllowed' => (int)CartRule::isFeatureActive(),
'returnAllowed' => (int)Configuration::get('PS_ORDER_RETURN')
As seen from the piece of code above, the page uses the template my-account.tpl .
From this page you can follow down 5 links:
- Order history and details. This page is responsible for the complete order history. It is generated by the controller HistoryController.
- My credit slips. A “credit slip” is given to the customer when he’s returned a product. Controller – OrderSlipCоntrоller.
- My addresses. Managing customer addresses.Controller – AddressCоntrоller.
- My personal information. Managing personal information.
- My favorite products. The module My Favorite Products.
If a customer is not logged in, he will be redirected to the controller AuthCоntrоller.
The method Context::getContext()->customer->isLogged() can help you to verify if a customer is logged in.
To display additional link in My Account, you can use the hook displаyCustоmerAссоunt.
The hook displayMyAccountBlock is used to output data into the block My Account. This block is located in the site’s footer.