/**
  * @param Customer $customer
  * @return CustomerUpdateForm
  */
 protected function hydrateCustomerForm(Customer $customer)
 {
     // Get default adress of the customer
     $address = $customer->getDefaultAddress();
     // Prepare the data that will hydrate the form
     $data = array('id' => $customer->getId(), 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'email' => $customer->getEmail(), 'title' => $customer->getTitleId(), 'discount' => $customer->getDiscount(), 'reseller' => $customer->getReseller());
     if ($address !== null) {
         $data['company'] = $address->getCompany();
         $data['address1'] = $address->getAddress1();
         $data['address2'] = $address->getAddress2();
         $data['address3'] = $address->getAddress3();
         $data['phone'] = $address->getPhone();
         $data['cellphone'] = $address->getCellphone();
         $data['zipcode'] = $address->getZipcode();
         $data['city'] = $address->getCity();
         $data['country'] = $address->getCountryId();
     }
     // A loop is used in the template
     return new CustomerUpdateForm($this->getRequest(), 'form', $data);
 }
예제 #2
0
 /**
  * Send a message to the customer.
  *
  * @param string   $messageCode
  * @param Customer $customer
  * @param array    $messageParameters an array of (name => value) parameters that will be available in the message.
  */
 public function sendEmailToCustomer($messageCode, $customer, $messageParameters = [])
 {
     // Always add the customer ID to the parameters
     $messageParameters['customer_id'] = $customer->getId();
     $this->sendEmailMessage($messageCode, [ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName()], [$customer->getEmail() => $customer->getFirstname() . " " . $customer->getLastname()], $messageParameters, $customer->getCustomerLang()->getLocale());
 }
예제 #3
0
 /**
  * @param Customer $object
  * @return string
  */
 protected function getObjectLabel($object)
 {
     return $object->getRef() . "(" . $object->getLastname() . " " . $object->getFirstname() . ")";
 }