/**
  * Exports the delivery address
  */
 protected function exportDeliveryAddress()
 {
     if ($this->ShippingAddress === null) {
         return;
     }
     if ($this->PLENTY_customerID === null) {
         return;
     }
     $city = trim($this->ShippingAddress->getCity());
     $street_arr = PlentymarketsUtils::extractStreetAndHouseNo($this->ShippingAddress->getStreet());
     if (isset($street_arr['street']) && strlen($street_arr['street']) > 0) {
         $streetName = $street_arr['street'];
     } else {
         $streetName = trim($this->ShippingAddress->getStreet());
     }
     if (isset($street_arr['houseNo']) && strlen($street_arr['houseNo']) > 0) {
         $streetHouseNumber = $street_arr['houseNo'];
     } else {
         $streetHouseNumber = '';
     }
     $zip = trim($this->ShippingAddress->getZipCode());
     if (empty($city)) {
         $city = PlentymarketsConfig::getInstance()->get('CustomerDefaultCity');
     }
     if (!isset($streetHouseNumber) || $streetHouseNumber == '') {
         $streetHouseNumber = PlentymarketsConfig::getInstance()->get('CustomerDefaultHouseNumber');
     }
     if (!isset($streetName) || $streetName == '') {
         $streetName = PlentymarketsConfig::getInstance()->get('CustomerDefaultStreet');
     }
     if ($zip == '') {
         $zip = PlentymarketsConfig::getInstance()->get('CustomerDefaultZipcode');
     }
     $Request_SetCustomerDeliveryAddresses = new PlentySoapRequest_SetCustomerDeliveryAddresses();
     $Request_SetCustomerDeliveryAddresses->DeliveryAddresses = array();
     $Object_SetCustomerDeliveryAddressesCustomer = new PlentySoapRequest_ObjectSetCustomerDeliveryAddresses();
     $Object_SetCustomerDeliveryAddressesCustomer->AdditionalName = null;
     // string
     $Object_SetCustomerDeliveryAddressesCustomer->City = $city;
     $Object_SetCustomerDeliveryAddressesCustomer->Company = $this->ShippingAddress->getCompany();
     $Object_SetCustomerDeliveryAddressesCustomer->CountryID = $this->getDeliveryCountryID();
     // int
     $Object_SetCustomerDeliveryAddressesCustomer->CustomerID = $this->PLENTY_customerID;
     // int
     $Object_SetCustomerDeliveryAddressesCustomer->ExternalDeliveryAddressID = PlentymarketsUtils::getExternalCustomerID($this->ShippingAddress->getId());
     // string
     $Object_SetCustomerDeliveryAddressesCustomer->FirstName = $this->ShippingAddress->getFirstName();
     $Object_SetCustomerDeliveryAddressesCustomer->FormOfAddress = $this->getDeliveryFormOfAddress();
     // int
     $Object_SetCustomerDeliveryAddressesCustomer->HouseNumber = $streetHouseNumber;
     $Object_SetCustomerDeliveryAddressesCustomer->Street = $streetName;
     $Object_SetCustomerDeliveryAddressesCustomer->Surname = $this->ShippingAddress->getLastName();
     $Object_SetCustomerDeliveryAddressesCustomer->ZIP = $zip;
     $Request_SetCustomerDeliveryAddresses->DeliveryAddresses[] = $Object_SetCustomerDeliveryAddressesCustomer;
     $Response_SetCustomerDeliveryAddresses = PlentymarketsSoapClient::getInstance()->SetCustomerDeliveryAddresses($Request_SetCustomerDeliveryAddresses);
     if (!$Response_SetCustomerDeliveryAddresses->Success) {
         throw new PlentymarketsExportEntityException('The delivery address of the customer with the number »' . $this->getCustomerNumber() . '« could not be exported', 2120);
     }
     $this->PLENTY_addressDispatchID = (int) $Response_SetCustomerDeliveryAddresses->ResponseMessages->item[0]->SuccessMessages->item[0]->Value;
 }
Esempio n. 2
0
 /**
  * send maker verification mail with Registration URL for new Email.
  *
  * @param unknown $observer        	
  */
 public function sendMakerRegisterMail($observer)
 {
     $maker_email = $observer->getMaker_email();
     $approver_name = $observer->getApprover_name();
     $approver_id = $observer->getApprover_id();
     $approver_company = $observer->getCompany();
     $customer_name = "Customer";
     $maker_data = implode(',', array('maker_email' => $maker_email, 'approver_name' => $approver_name, 'approver_id' => $approver_id, 'company' => $approver_company));
     $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, array('_secure' => true)) . "customer/account/login/id/reg/mkregister/" . urlencode(base64_encode($maker_data));
     $mail_vars = array('maker_email' => $maker_email, 'approver_name' => $approver_name, 'sender' => $approver_name, 'approver_id' => $approver_id, 'company' => $approver_company, 'url' => $url, 'name' => $customer_name);
     $email_template = Mage::getModel('core/email_template');
     $template = Mage::getStoreConfig(self::EMAIL_TEMPLATE_XML_PATH);
     // Send mail
     $email_template->sendTransactional($template, 'sales', $maker_email, $customer_name, $mail_vars);
 }
Esempio n. 3
0
 /**
  * Fills in the form data array
  *
  * @param  unknown        $object
  * @return array
  */
 protected function createFormDataArray($object)
 {
     return array("label" => $object->getLabel(), "title" => $object->getTitleId(), "firstname" => $object->getFirstname(), "lastname" => $object->getLastname(), "address1" => $object->getAddress1(), "address2" => $object->getAddress2(), "address3" => $object->getAddress3(), "zipcode" => $object->getZipcode(), "city" => $object->getCity(), "country" => $object->getCountryId(), "cellphone" => $object->getCellphone(), "phone" => $object->getPhone(), "company" => $object->getCompany());
 }