Exemplo n.º 1
0
 /**
  * Copies the values of the order address item into the address item.
  *
  * @param MShop_Order_Item_Base_Address_Interface $item Order address item
  */
 public function copyFrom(MShop_Order_Item_Base_Address_Interface $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());
 }
Exemplo n.º 2
0
 /**
  * Adds a single address item to the address list of the XML object
  *
  * @param MShop_Order_Item_Base_Address_Interface $address Address object with personal information
  * @param DOMDocument $dom DOM document object with contains the XML structure
  * @param DOMElement $addresslist DOM element which will be the parent of the new child
  * @throws DOMException If an error occures
  */
 protected function _buildXMLAddress(MShop_Order_Item_Base_Address_Interface $address, DOMDocument $dom, DOMElement $addresslist)
 {
     $addressitem = $dom->createElement('addressitem');
     $this->_appendChildCDATA('type', $address->getType(), $dom, $addressitem);
     $this->_appendChildCDATA('salutation', $address->getSalutation(), $dom, $addressitem);
     $this->_appendChildCDATA('title', $address->getTitle(), $dom, $addressitem);
     $this->_appendChildCDATA('firstname', $address->getFirstname(), $dom, $addressitem);
     $this->_appendChildCDATA('lastname', $address->getLastname(), $dom, $addressitem);
     $this->_appendChildCDATA('company', $address->getCompany(), $dom, $addressitem);
     $this->_appendChildCDATA('address1', $address->getAddress1(), $dom, $addressitem);
     $this->_appendChildCDATA('address2', $address->getAddress2(), $dom, $addressitem);
     $this->_appendChildCDATA('address3', $address->getAddress3(), $dom, $addressitem);
     $this->_appendChildCDATA('postalcode', $address->getPostal(), $dom, $addressitem);
     $this->_appendChildCDATA('city', $address->getCity(), $dom, $addressitem);
     $this->_appendChildCDATA('state', $address->getState(), $dom, $addressitem);
     $this->_appendChildCDATA('countrycode', strtoupper($address->getCountryId()), $dom, $addressitem);
     $this->_appendChildCDATA('email', $address->getEmail(), $dom, $addressitem);
     $this->_appendChildCDATA('phone', $address->getTelephone(), $dom, $addressitem);
     $this->_appendChildCDATA('vatid', $address->getVatID(), $dom, $addressitem);
     $addresslist->appendChild($addressitem);
 }
Exemplo n.º 3
0
 /**
  * Fills the order address object with the values from the array.
  *
  * @param MShop_Order_Item_Base_Address_Interface $address Address item to store the values into
  * @param array $map Associative array of key/value pairs. The keys must be the same as when calling toArray() from
  * 	an address item.
  * @throws Controller_Frontend_Basket_Exception
  */
 protected function _setAddressFromArray(MShop_Order_Item_Base_Address_Interface $address, array $map)
 {
     foreach ($map as $key => $value) {
         $map[$key] = strip_tags($value);
         // prevent XSS
     }
     $errors = $address->fromArray($map);
     if (count($errors) > 0) {
         $msg = sprintf('Invalid address properties, please check your input');
         throw new Controller_Frontend_Basket_Exception($msg, 0, null, $errors);
     }
 }