/** * Preprocess profile * * @param \XLite\Model\Profile $profile Profile * @param array $column Column data * @param \XLite\Model\Order $entity Order * * @return string */ protected function preprocessProfile(\XLite\Model\Profile $profile, array $column, \XLite\Model\Order $entity) { $address = $profile->getBillingAddress() ?: $profile->getShippingAddress(); return $address ? $address->getName() : $profile->getLogin(); }
/** * {@inheritDoc} */ public function getShippingAddress() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getShippingAddress', array()); return parent::getShippingAddress(); }
/** * Get "destination" XML data for "Create Non-Contract Shipment" and "Create Shipment" requests * * @param \XLite\Model\Profile $profile Customer profile * * @return string */ protected function getDestinationXmlData(\XLite\Model\Profile $profile) { $destLocation = $profile->getShippingAddress(); $destLocationZipcode = static::strToUpper(preg_replace('/\\s+/', '', $destLocation->getZipcode())); $xmlData = <<<XML <destination> <name>{$destLocation->getFirstname()} {$destLocation->getLastname()}</name> <client-voice-number>{$destLocation->getPhone()}</client-voice-number> <address-details> <address-line-1>{$destLocation->getStreet()}</address-line-1> <city>{$destLocation->getCity()}</city> <prov-state>{$destLocation->getState()->getCode()}</prov-state> <country-code>{$destLocation->getCountry()->getCode()}</country-code> <postal-zip-code>{$destLocationZipcode}</postal-zip-code> </address-details> </destination> XML; return $xmlData; }
/** * Get XML block: returner (sender) address * * @param \XLite\Model\Profile $profile Returner profile * * @return string */ protected function getXmlBlockReturnerAddress(\XLite\Model\Profile $profile) { $address = $profile->getShippingAddress(); $addressZipcode = preg_replace('/\\s+/', '', $address->getZipcode()); $xmlData = <<<XML <returner> <name>{$address->getFirstname()} {$address->getLastname()}</name> <domestic-address> <address-line-1>{$address->getStreet()}</address-line-1> <city>{$address->getCity()}</city> <province>{$address->getState()->getCode()}</province> <postal-code>{$addressZipcode}</postal-code> </domestic-address> </returner> XML; return $xmlData; }