Example #1
0
 /**
  * Copies the values of the order address item into the address item.
  *
  * @param \Aimeos\MShop\Order\Item\Base\Address\Iface $item Order address item
  */
 public function copyFrom(\Aimeos\MShop\Order\Item\Base\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());
 }
Example #2
0
 /**
  * Adds a single address item to the address list of the XML object
  *
  * @param \Aimeos\MShop\Order\Item\Base\Address\Iface $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(\Aimeos\MShop\Order\Item\Base\Address\Iface $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);
 }
 /**
  * Fills the order address object with the values from the array.
  *
  * @param \Aimeos\MShop\Order\Item\Base\Address\Iface $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 \Aimeos\Controller\Frontend\Basket\Exception
  */
 protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $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 \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors);
     }
 }