/** * 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; }
/** * Copies the values of the address item into another one. * * @param \Aimeos\MShop\Common\Item\Address\Iface $item Address item * @return \Aimeos\MShop\Common\Item\Address\Iface Common address item for chaining method calls */ public function copyFrom(\Aimeos\MShop\Common\Item\Address\Iface $item) { $this->setCompany($item->getCompany()); $this->setVatID($item->getVatID()); $this->setSalutation($item->getSalutation()); $this->setTitle($item->getTitle()); $this->setFirstname($item->getFirstname()); $this->setLastname($item->getLastname()); $this->setAddress1($item->getAddress1()); $this->setAddress2($item->getAddress2()); $this->setAddress3($item->getAddress3()); $this->setPostal($item->getPostal()); $this->setCity($item->getCity()); $this->setState($item->getState()); $this->setCountryId($item->getCountryId()); $this->setLanguageId($item->getLanguageId()); $this->setTelephone($item->getTelephone()); $this->setTelefax($item->getTelefax()); $this->setEmail($item->getEmail()); $this->setWebsite($item->getWebsite()); $this->setFlag($item->getFlag()); $this->setModified(); return $this; }
/** * 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; }