Exemple #1
0
 /**
  * Adds the customer and address data to the given customer item
  *
  * @param \Aimeos\MShop\Customer\Item\Iface $customer Customer object
  * @param \Aimeos\MShop\Common\Item\Address\Iface $address Billing address object
  * @return \Aimeos\MShop\Customer\Item\Iface Customer object filled with data
  */
 protected function addCustomerData(\Aimeos\MShop\Customer\Item\Iface $customer, \Aimeos\MShop\Common\Item\Address\Iface $address, $code, $password)
 {
     $label = $address->getLastname();
     if (($part = $address->getFirstname()) !== '') {
         $label = $part . ' ' . $label;
     }
     if (($part = $address->getCompany()) !== '') {
         $label .= ' (' . $part . ')';
     }
     $customer->setPaymentAddress($address);
     $customer->setCode($code);
     $customer->setPassword($password);
     $customer->setLabel($label);
     $customer->setStatus(1);
     return $customer;
 }
Exemple #2
0
 /**
  * Adds the customer and address data to the given customer item
  *
  * @param \Aimeos\MShop\Customer\Item\Iface $customer Customer object
  * @param \Aimeos\MShop\Common\Item\Address\Iface $address Billing address object
  * @param string $code Unique customer code, e.g. user name or e-mail address
  * @param string $password Plain-text password for the customer
  * @return \Aimeos\MShop\Customer\Item\Iface Customer object filled with data
  */
 protected function addCustomerData(\Aimeos\MShop\Customer\Item\Iface $customer, \Aimeos\MShop\Common\Item\Address\Iface $address, $code, $password)
 {
     $extra = $this->getContext()->getSession()->get('client/html/checkout/standard/address/extra');
     $label = $address->getLastname();
     if (($part = $address->getFirstname()) !== '') {
         $label = $part . ' ' . $label;
     }
     if (($part = $address->getCompany()) !== '') {
         $label .= ' (' . $part . ')';
     }
     $customer->setPaymentAddress($address);
     $customer->setPassword($password);
     $customer->setLabel($label);
     $customer->setCode($code);
     $customer->setStatus(1);
     try {
         $customer->setBirthday((string) $extra['customer.birthday']);
     } catch (\Aimeos\MShop\Exception $e) {
         // don't break on invalid birthdays
     }
     /** client/html/checkout/standard/order/account/standard/groupids
      * List of groups new customers should be assigned to
      *
      * Newly created customers will be assigned automatically to the groups
      * given by their IDs. This is especially useful if those groups limit
      * functionality for those users.
      *
      * @param array List of group IDs
      * @since 2016.03
      * @category User
      * @category Developer
      */
     $config = $this->getContext()->getConfig();
     $gids = (array) $config->get('client/html/checkout/standard/order/account/standard/groupids', array());
     $customer->setGroups($gids);
     return $customer;
 }