Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.

You might want to read an updated version of this page for the current version, PrestaShop 8. Read the updated version of this page

Learn how to upgrade to the latest version.

Customer domain

Customer Commands

AddCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\AddCustomerCommand Adds new customer with provided data

Command details
Constructor parameters
  • $string $firstName
  • $string $lastName
  • $string $email
  • $string $password
  • $int $defaultGroupId
  • $array $groupIds
  • $int $shopId
  • $?int $genderId = NULL
  • $?bool $isEnabled = true
  • $?bool $isPartnerOffersSubscribed = false
  • $?string $birthday = NULL
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\AddCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\AddCustomerHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Customer\ValueObject\CustomerId

BulkDeleteCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\BulkDeleteCustomerCommand Deletes given customers.

Command details
Constructor parameters
  • $array $customerIds
  • $string $deleteMethod
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\BulkDeleteCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\BulkDeleteCustomerHandlerInterface
Return type void

BulkDisableCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\BulkDisableCustomerCommand Disables customers in bulk action.

Command details
Constructor parameters
  • $array $customerIds
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\BulkDisableCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\BulkDisableCustomerHandlerInterface
Return type void

BulkEnableCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\BulkEnableCustomerCommand Enables customers in bulk action.

Command details
Constructor parameters
  • $array $customerIds
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\BulkEnableCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\BulkEnableCustomerHandlerInterface
Return type void

DeleteCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\DeleteCustomerCommand Deletes given customer.

Command details
Constructor parameters
  • $int $customerId
  • $string $deleteMethod
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\DeleteCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\DeleteCustomerHandlerInterface
Return type void

EditCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\EditCustomerCommand Edits provided customer. It can edit either all or partial data. Only not-null values are considered when editing customer. For example, if the email is null, then the original value is not modified, however, if email is set, then the original value will be overwritten.

Command details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\EditCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\EditCustomerHandlerInterface
Return type void

SetPrivateNoteAboutCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\SetPrivateNoteAboutCustomerCommand Sets private note about customer that can only be seen in Back Office

Command details
Constructor parameters
  • $int $customerId
  • $string $privateNote
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\SetPrivateNoteAboutCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\SetPrivateNoteAboutCustomerHandlerInterface
Return type void

SetRequiredFieldsForCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\SetRequiredFieldsForCustomerCommand Sets required fields for new customer when signing up in Front Office

Command details
Constructor parameters
  • $array $requiredFields
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\SetRequiredFieldsForCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\SetRequiredFieldsForCustomerHandlerInterface
Return type void

TransformGuestToCustomerCommand

PrestaShop\PrestaShop\Core\Domain\Customer\Command\TransformGuestToCustomerCommand Transforms guest (customer without password) into registered customer account

Command details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Customer\CommandHandler\TransformGuestToCustomerHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\CommandHandler\TransformGuestToCustomerHandlerInterface
Return type void

Customer Queries

GetCustomerCarts

PrestaShop\PrestaShop\Core\Domain\Customer\Query\GetCustomerCarts Query for getting summarized customer carts

Query details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Customer\QueryHandler\GetCustomerCartsHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\GetCustomerCartsHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\CartSummary[]

GetCustomerForAddressCreation

PrestaShop\PrestaShop\Core\Domain\Customer\Query\GetCustomerForAddressCreation Gets customer information for address creation.

Query details
Constructor parameters
  • $string $customerEmail
Handler class PrestaShop\PrestaShop\Adapter\Customer\QueryHandler\GetCustomerForAddressCreationHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\GetCustomerForAddressCreationHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\AddressCreationCustomerInformation

GetCustomerForEditing

PrestaShop\PrestaShop\Core\Domain\Customer\Query\GetCustomerForEditing Gets customer information for editing.

Query details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Customer\QueryHandler\GetCustomerForEditingHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\GetCustomerForEditingHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\EditableCustomer

GetCustomerForViewing

PrestaShop\PrestaShop\Core\Domain\Customer\Query\GetCustomerForViewing Gets detailed customer information for viewing in Back Office.

Query details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Customer\QueryHandler\GetCustomerForViewingHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\GetCustomerForViewingHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\ViewableCustomer

GetCustomerOrders

PrestaShop\PrestaShop\Core\Domain\Customer\Query\GetCustomerOrders Query for getting summarized customer orders

Query details
Constructor parameters
  • $int $customerId
Handler class PrestaShop\PrestaShop\Adapter\Customer\QueryHandler\GetCustomerOrdersHandler

Implements:

  • PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\GetCustomerOrdersHandlerInterface
Return type PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\OrderSummary[]

GetRequiredFieldsForCustomer

PrestaShop\PrestaShop\Core\Domain\Customer\Query\GetRequiredFieldsForCustomer Gets fields that are required for customer sign up

Query details
Constructor parameters
    Handler class PrestaShop\PrestaShop\Adapter\Customer\QueryHandler\GetRequiredFieldsForCustomerHandler

    Implements:

    • PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\GetRequiredFieldsForCustomerHandlerInterface
    Return type string[]

    SearchCustomers

    PrestaShop\PrestaShop\Core\Domain\Customer\Query\SearchCustomers Searchers for customers by phrases matching customer's first name, last name, email and id

    Query details
    Constructor parameters
    • $array $phrases
    Handler class PrestaShop\PrestaShop\Adapter\Customer\QueryHandler\SearchCustomersHandler

    Implements:

    • PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\SearchCustomersHandlerInterface
    Return type array