/**
  * {@inheritDoc}
  * 
  * Format:
  * 
  *  <Countries_Replace>
  *      <Country code="US"/>
  *  </Countries_Replace>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Countries_Replace />');
     foreach ($this->getCountries() as $country) {
         XmlHelper::appendToParent($xmlObject, $country->toXml());
     }
     return $xmlObject;
 }
Esempio n. 2
0
 /**
  * {@inheritDoc}
  *
  * Format:
  *
  *  <Module code="discount_volume" feature="discount">
  *      <!-- Non-existent product -->
  *      <ProductPricingTable group_name="Volume Pricing Product Provisioning Test 01" product_code="non-existent" />
  *  </Module>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Module />');
     $xmlObject->addAttribute('code', 'discount_volume');
     $xmlObject->addAttribute('feature', 'discount');
     foreach ($this->getProductPricingTables() as $productPricingTable) {
         XmlHelper::appendToParent($xmlObject, $productPricingTable->toXml($version, $options));
     }
     return $xmlObject;
 }
Esempio n. 3
0
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <Item code="product_display">
  *      <ImageDimensions constrain="no"/>
  * </Item>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Item />');
     $xmlObject->addAttribute('code', $this->getCode());
     XmlHelper::appendArrayToParent($xmlObject, $this->getData());
     return $xmlObject;
 }
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <ShippingMethodRules_Update module_code="upsxml" method_code="02">
  *       
  *       <Priority>5</Priority>
  *       <Description>2 Day Air</Description>
  *       <MinimumSubTotal>0.00</MinimumSubTotal>
  *       <MaximumSubTotal>0.00</MaximumSubTotal>
  *       <MinimumQuantity>0</MinimumQuantity>
  *       <MaximumQuantity>0</MaximumQuantity>
  *       <MinimumWeight>0.00</MinimumWeight>
  *       <MaximumWeight>0.00</MaximumWeight>
  *       <States>
  *           <State code="CA"/>
  *           <State code="OH"/>
  *       </States>
  *
  *        <ZipCodes>92109,44145</ZipCodes>
  *
  *            <Countries>
  *                <Country code="US"/>
  *                <Country code="GB"/>
  *            </Countries>
  *
  *            <Exclusions>
  *                <Excludes module_code="flatrate" method_code="flat_2day"/>     
  *                <ExcludedBy module_code="baseunit" method_code="base_2day"/>  
  *            </Exclusions>
  *        </ShippingMethodRules_Update>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<ShippingMethodRules_Update />');
     $xmlObject->addAttribute('module_code', $this->getModuleCode());
     $xmlObject->addAttribute('method_code', $this->getMethodCode());
     $xmlObject->addChild('Priority', $this->getPriority());
     $xmlObject->addChild('Description', $this->getDescription());
     $xmlObject->addChild('MinimumSubTotal', $this->getMinimumSubTotal());
     $xmlObject->addChild('MaximumSubTotal', $this->getMaximumSubTotal());
     $xmlObject->addChild('MinimumQuantity', $this->getMinimumQuantity());
     $xmlObject->addChild('MaximumQuantity', $this->getMaximumQuantity());
     $xmlObject->addChild('MinimumWeight', $this->getMinimumWeight());
     $xmlObject->addChild('MaximumWeight', $this->getMaximumWeight());
     if (count($this->getStates())) {
         $statesXmlRoot = $xmlObject->addChild('States');
         foreach ($this->getStates() as $state) {
             XmlHelper::appendToParent($statesXmlRoot, $state->toXml($version, $options));
         }
     }
     if (count($this->getZipCodes())) {
         $xmlObject->addChild('ZipCodes', implode(',', $this->getZipCodes()));
     }
     if (count($this->getCountries())) {
         $countriesXmlRoot = $xmlObject->addChild('Countries');
         foreach ($this->getCountries() as $country) {
             XmlHelper::appendToParent($countriesXmlRoot, $country->toXml($version, $options));
         }
     }
     if (count($this->getExclusions())) {
         $exclusionsXmlRoot = $xmlObject->addChild('Exclusions');
         foreach ($this->getExclusions() as $exclusion) {
             XmlHelper::appendToParent($exclusionsXmlRoot, $exclusion->toXml($version, $options));
         }
     }
     return $xmlObject;
 }
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <Product>                                       (required)
  *      <Code>p1</Code>                             (required)
  *      <Quantity>1</Quantity>                      (required)
  *      <DateInStock>                               (optional)
  *          <Day>01</Day>                                   (required)
  *          <Month>01</Month>                               (required)
  *          <Year>1970</Year>                               (required)
  *          <Hour>00</Hour>                                 (optional)
  *          <Minute>01</Minute>                             (optional)
  *       </DateInStock>
  * </Product>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Product />');
     $xmlObject->addChild('Code', $this->getCode());
     $xmlObject->addChild('Quantity', $this->getQuantity());
     if ($this->getDateInStock() instanceof \DateTime) {
         $dateInStockXml = $xmlObject->addChild('DateInStock');
         XmlHelper::dateTimeToXml($dateInStockXml, $this->getDateInStock());
     }
     return $xmlObject;
 }
Esempio n. 6
0
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <Page_Update code="PROD">
  *      <Item code="product_display">
  *          <ImageDimensions constrain="no"/>
  *      </Item>
  * </Page_Update>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Page_Update />');
     $xmlObject->addAttribute('code', $this->getCode());
     foreach ($this->getItems() as $item) {
         XmlHelper::appentToParent($xmlObject, $item->toXml($version, $options));
     }
     return $xmlObject;
 }
Esempio n. 7
0
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <Module code="packbyweight" feature="boxpacking">
  *     
  * </Module>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Module />');
     $xmlObject->addAttribute('code', $this->getCode());
     $xmlObject->addAttribute('feature', $this->getFeature());
     foreach ($this->getData() as $data) {
         XmlHelper::appendToParent($xmlObject, $data->toXml($version, $options));
     }
     return $xmlObject;
 }
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <OrderShipment_SetStatus code="SHIPMENT_CODE">
  *       <MarkAsShipped>1</MarkAsShipped>                (Optional)
  *       <TrackingNumber>0123456</TrackingNumber>        (Optional)
  *       <TrackingType>FedEx</TrackingType>              (Optional)
  *       <ShipDate>                                      (Optional)
  *           <Day>01</Day>                                   (required)
  *           <Month>01</Month>                               (required)
  *           <Year>1970</Year>                               (required)
  *           <Minute>30</Minute>                             (optional)
  *           <Hour>12</Hour>                                 (optional)
  *       </ShipDate>
  *   </OrderShipment_SetStatus>
  *
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<OrderShipment_SetStatus />');
     $xmlObject->addAttribute('code', $this->getCode());
     if ($this->getMarkAsShipped()) {
         $xmlObject->addChild('MarkAsShipped', $this->getMarkAsShipped());
     }
     if ($this->getTrackingNumber()) {
         $xmlObject->addChild('TrackingNumber', $this->getTrackingNumber());
     }
     if ($this->getTrackingType()) {
         $xmlObject->addChild('TrackingType', $this->getTrackingType());
     }
     if ($this->getShipDate() instanceof \DateTime) {
         $shipDateXml = $xmlObject->addChild('ShipDate');
         XmlHelper::dateTimeToXml($shipDateXml, $this->getShipDate());
     }
     return $xmlObject;
 }
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <OrderShipment_Add order_id="1000">
  *       <ProductList>                                   (Required)
  *           <Product product_code="p1" quantity="1" />      (required)
  *       </ProductList>
  *      <Code>SHIPMENT_CODE</Code>                      (Required)
  *   </OrderShipment_Add>
  *
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<OrderShipment_Add></OrderShipment_Add>');
     $xmlObject->addAttribute('order_id', $this->getOrderId());
     $productListXml = $xmlObject->addChild('ProductList');
     foreach ($this->getProductList() as $product) {
         XmlHelper::appendToParent($productListXml, $product->toXml());
     }
     $xmlObject->addChild('Code', $this->getCode());
     if (!is_null($this->getCost())) {
         $xmlObject->addChild('Cost', number_format($this->getCost(), 2, '.', ''));
     }
     return $xmlObject;
 }
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <Order_Backorder_Items order_id="1000">
  *       <ProductList>                                   (Required)
  *           <Product>                                       (required)
  *               <Code>p1</Code>                             (required)
  *               <Quantity>1</Quantity>                      (required)
  *               <DateInStock>                               (optional)
  *                   <Day>01</Day>                                   (required)
  *                   <Month>01</Month>                               (required)
  *                   <Year>1970</Year>                               (required)
  *                   <Hour>00</Hour>                                 (optional)
  *                   <Minute>01</Minute>                             (optional)
  *               </DateInStock>
  *           </Product>
  *       </ProductList>
  *   </Order_Backorder_Items>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Order_Backorder_Items />');
     $xmlObject->addAttribute('order_id', $this->getOrderId());
     if (!count($this->getProducts())) {
         throw new \Exception('OrderBackorderItems requires at least one Product in ProductList');
     }
     $productListXmlRoot = $xmlObject->addChild('ProductList');
     foreach ($this->getProducts() as $product) {
         XmlHelper::appendToParent($productListXmlRoot, $product->toXml($version, $options));
     }
     return $xmlObject;
 }
Esempio n. 11
0
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  *   <Order_Add>
  *       <ShipFirstName>Jonathan</ShipFirstName>
  *       <ShipLastName>Burchmore</ShipLastName>
  *       <ShipEmail>jburchmore@mivamerchant.com</ShipEmail>
  *       <ShipPhone>858-361-5922</ShipPhone>
  *       <ShipAddress1>5060 Shoreham Place</ShipAddress1>
  *       <ShipAddress2>Suite 330</ShipAddress2>
  *       <ShipCity>San Diego</ShipCity>
  *       <ShipState>CA</ShipState>
  *       <ShipZip>92122</ShipZip>
  *       <ShipCountry>US</ShipCountry>
  *
  *       <Items>
  *           <Item>
  *               <Code>test</Code>
  *               <Name>Test Product #1</Name>
  *               <Price>1</Price>
  *               <Weight>0</Weight>
  *               <Quantity>1</Quantity>
  *
  *               <Options>
  *                   <Option>
  *                       <AttributeCode>test</AttributeCode>
  *                   </Option>
  *
  *                   <Option>
  *                       <AttributeCode>template_attr</AttributeCode>
  *                       <Price>1.00</Price>
  *                       <OptionCode>v1</OptionCode>
  *                   </Option>
  *               </Options>
  *           </Item>
  *       </Items>
  *   </Order_Add>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Order_Add></Order_Add>');
     $xmlObject->addChild('ShipFirstName', $this->getShipFirstName());
     $xmlObject->addChild('ShipLastName', $this->getShipLastName());
     $xmlObject->addChild('ShipEmail', $this->getShipEmail());
     $xmlObject->addChild('ShipPhone', $this->getShipPhone());
     $xmlObject->addChild('ShipAddress1', $this->getShipAddress1());
     $xmlObject->addChild('ShipAddress2', $this->getShipAddress2());
     $xmlObject->addChild('ShipCity', $this->getShipCity());
     $xmlObject->addChild('ShipState', $this->getShipState());
     $xmlObject->addChild('ShipZip', $this->getShipZip());
     $xmlObject->addChild('ShipCountry', $this->getShipCountry());
     if (count($this->getItems())) {
         $itemsXml = $xmlObject->addChild('Items');
         foreach ($this->getItems() as $item) {
             XmlHelper::appendToParent($itemsXml, $item->toXml($version, $options));
         }
     }
     return $xmlObject;
 }
Esempio n. 12
0
 /**
  * {@inheritDoc}
  *
  * Format:
  *
  *  <Shipment>                                                  (Optional)
  *      <Code>Ship_Code</Code>                                  (Optional)
  *      <Cost>1</Cost>                                          (Optional)
  *      <MarkAsShipped>Yes</MarkAsShipped>                      (Optional)
  *      <TrackingNumber>1111111111</TrackingNumber>             (Required)
  *      <TrackingType>FedEx</TrackingType>                      (Required)
  *      <ShipDate>                                              (Optional)
  *          <Day>7</Day>
  *          <Month>9</Month>
  *          <Year>2012</Year>
  *      </ShipDate>
  *  </Shipment>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Shipment />');
     $xmlObject->addChild('TrackingNumber', $this->getTrackingNumber());
     $xmlObject->addChild('TrackingType', $this->getTrackingType());
     $xmlObject->addChild('MarkAsShipped', $this->getMarkAsShipped() ? 'Yes' : 'No');
     if ($this->getCode()) {
         $xmlObject->addChild('Code', $this->getCode());
     }
     if ($this->getCost()) {
         $xmlObject->addChild('Cost', $this->getCost());
     }
     if ($this->getShipDate() instanceof \DateTime) {
         $date = $xmlObject->addChild('ShipDate');
         XmlHelper::dateToXml($date, $this->getShipDate());
     }
     return $xmlObject;
 }
Esempio n. 13
0
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <ProductKit_Delete product_code="test">
  *      <AttributeTemplateAttribute_Boolean attribute_code="test" attributetemplateattribute_code="checkbox" present="true"/>
  * </ProductKit_Delete>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<ProductKit_Delete />');
     $xmlObject->addAttribute('product_code', $this->getProductCode());
     foreach ($this->getAttributes() as $attribute) {
         XmlHelper::appendToParent($xmlObject, $attribute->toXml());
     }
     return $xmlObject;
 }
Esempio n. 14
0
 /**
  * {@inheritDoc}
  *
  * Format:
  *
  * <Order_Update_Item order_id="1000" line_id="1000">                                (Required - order_id, line_id)
  *  <Code>test</Code>
  *  <Name>Test Product #1</Name>
  *  <Price>1</Price>
  *  <Weight>0</Weight>
  *  <Quantity>1</Quantity>
  *
  *  <Taxable>0|1</Taxable>
  *  <Upsold>0|1</Upsold>
  *  <Options>
  *      <Option>
  *          <AttributeCode>test</AttributeCode>
  *      </Option>
  *      <Option>
  *          <AttributeCode>template_attr</AttributeCode>
  *          <Price>1.00</Price>
  *          <OptionCode>v1</OptionCode>
  *      </Option>
  *  </Options>
  *  <Shipment>                                                  (Optional)
  *      <Code>Ship_Code</Code>                                  (Optional)
  *      <Cost>1</Cost>                                          (Optional)
  *      <MarkAsShipped>Yes</MarkAsShipped>                      (Optional)
  *      <TrackingNumber>1111111111</TrackingNumber>             (Required)
  *      <TrackingType>FedEx</TrackingType>                      (Required)
  *      <ShipDate>                                              (Optional)
  *          <Day>7</Day>
  *          <Month>9</Month>
  *          <Year>2012</Year>
  *      </ShipDate>
  *  </Shipment>
  *  <Shipment />                                                (Optional)
  * </Order_Add_Item>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Order_Update_Item />');
     $xmlObject->addAttribute('order_id', $this->getOrderId());
     $xmlObject->addAttribute('line_id', $this->getLineId());
     if ($this->getCode()) {
         $xmlObject->addChild('Code', $this->getCode());
     }
     if ($this->getName()) {
         $xmlObject->addChild('Name', $this->getName());
     }
     if ($this->getPrice()) {
         $xmlObject->addChild('Price', $this->getPrice());
     }
     if ($this->getWeight()) {
         $xmlObject->addChild('Weight', $this->getWeight());
     }
     if ($this->getQuantity()) {
         $xmlObject->addChild('Quantity', $this->getQuantity());
     }
     if (!is_null($this->getTaxable())) {
         $xmlObject->addChild('Quantity', $this->getTaxable() ? 'Yes' : 'No');
     }
     if (!is_null($this->getUpsold())) {
         $xmlObject->addChild('Upsold', $this->getUpsold() ? 'Yes' : 'No');
     }
     if (count($this->getShipments())) {
         foreach ($this->getShipments() as $shipment) {
             XmlHelper::appendToParent($xmlObject, $shipment->toXml($version, $options));
         }
     }
     if (count($this->getOptions())) {
         $optionsXml = $xmlObject->addChild('Options');
         foreach ($this->getOptions() as $option) {
             XmlHelper::appendToParent($optionsXml, $option->toXml($version, $options));
         }
     }
     return $xmlObject;
 }
Esempio n. 15
0
 /**
  * {@inheritDoc}
  *
  * Format:
  * <Order_Update order_id="X">
  *      <CustomerLogin></CustomerLogin>
  *      <ShipFirstName></ShipFirstName>
  *      <ShipLastName></ShipLastName>
  *      <ShipEmail></ShipEmail>
  *      <ShipCompany></ShipCompany>
  *      <ShipPhone></ShipPhone>
  *      <ShipFax></ShipFax>
  *      <ShipAddress1></ShipAddress1>
  *      <ShipAddress2></ShipAddress2>
  *      <ShipCity></ShipCity>
  *      <ShipState></ShipState>
  *      <ShipZip></ShipZip>
  *      <ShipCountry></ShipCountry>
  *      <BillFirstName></BillFirstName>
  *      <BillLastName></BillLastName>
  *      <BillEmail></BillEmail>
  *      <BillCompany></BillCompany>
  *      <BillPhone></BillPhone>
  *      <BillFax></BillFax>
  *      <BillAddress1></BillAddress1>
  *      <BillAddress2></BillAddress2>
  *      <BillCity></BillCity>
  *      <BillState></BillState>
  *      <BillZip></BillZip>
  *      <BillCountry></BillCountry>
  *      <Items>
  *
  *      </Items>
  *       <Charges>
  *
  *      </Charges>
  *      <CalculateCharges>
  *          <ShippingModule></ShippingModule>
  *          <ShippingModuleData></ShippingModuleData>
  *      </CalculateCharges>
  *      <Total></Total>
  *      <OrderDate></OrderDate>
  *      <ChargeList>
  *          <!-- OPTIONAL, IF SET WILL DELETE ALL EXISTING CHARGES AS OF 9.0.0.3
  *      </ChargeList>
  *  </Order_Update>
  *
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Order_Update />');
     $xmlObject->addAttribute('order_id', $this->getOrderId());
     if ($this->getCustomerLogin()) {
         $xmlObject->addChild('CustomerLogin', $this->getCustomerLogin());
     }
     if ($this->getShipFirstName()) {
         $xmlObject->addChild('ShipFirstName', $this->getShipFirstName());
     }
     if ($this->getShipLastName()) {
         $xmlObject->addChild('ShipLastName', $this->getShipLastName());
     }
     if ($this->getShipEmail()) {
         $xmlObject->addChild('ShipEmail', $this->getShipEmail());
     }
     if ($this->getShipCompany()) {
         $xmlObject->addChild('ShipCompany', $this->getShipCompany());
     }
     if ($this->getShipPhone()) {
         $xmlObject->addChild('ShipPhone', $this->getShipPhone());
     }
     if ($this->getShipFax()) {
         $xmlObject->addChild('ShipFax', $this->getShipFax());
     }
     if ($this->getShipAddress1()) {
         $xmlObject->addChild('ShipAddress1', $this->getShipAddress1());
     }
     if ($this->getShipAddress2()) {
         $xmlObject->addChild('ShipAddress2', $this->getShipAddress2());
     }
     if ($this->getShipCity()) {
         $xmlObject->addChild('ShipCity', $this->getShipCity());
     }
     if ($this->getShipState()) {
         $xmlObject->addChild('ShipState', $this->getShipState());
     }
     if ($this->getShipZip()) {
         $xmlObject->addChild('ShipZip', $this->getShipZip());
     }
     if ($this->getShipCountry()) {
         $xmlObject->addChild('ShipCountry', $this->getShipCountry());
     }
     if ($this->getBillFirstName()) {
         $xmlObject->addChild('BillFirstName', $this->getBillFirstName());
     }
     if ($this->getBillLastName()) {
         $xmlObject->addChild('BillLastName', $this->getBillLastName());
     }
     if ($this->getBillEmail()) {
         $xmlObject->addChild('BillEmail', $this->getBillEmail());
     }
     if ($this->getBillCompany()) {
         $xmlObject->addChild('BillCompany', $this->getBillCompany());
     }
     if ($this->getBillPhone()) {
         $xmlObject->addChild('BillPhone', $this->getBillPhone());
     }
     if ($this->getBillFax()) {
         $xmlObject->addChild('BillFax', $this->getBillFax());
     }
     if ($this->getBillAddress1()) {
         $xmlObject->addChild('BillAddress1', $this->getBillAddress1());
     }
     if ($this->getBillAddress2()) {
         $xmlObject->addChild('BillAddress2', $this->getBillAddress2());
     }
     if ($this->getBillCity()) {
         $xmlObject->addChild('BillCity', $this->getBillCity());
     }
     if ($this->getBillState()) {
         $xmlObject->addChild('BillState', $this->getBillState());
     }
     if ($this->getBillZip()) {
         $xmlObject->addChild('BillZip', $this->getBillZip());
     }
     if ($this->getBillCountry()) {
         $xmlObject->addChild('BillCountry', $this->getBillCountry());
     }
     if (count($this->getItems())) {
         $itemsXml = $xmlObject->addChild('Items');
         foreach ($this->getItems() as $item) {
             XmlHelper::appendToParent($itemsXml, $item->toXml($version, $options));
         }
     }
     if (count($this->getCharges())) {
         $chargesXml = $xmlObject->addChild('Charges');
         foreach ($this->getCharges() as $charge) {
             XmlHelper::appendToParent($chargesXml, $charge->toXml($version, $options));
         }
     }
     if ($this->getOrderDate()) {
         $fragment = $xmlObject->addChild('OrderDate');
         XmlHelper::dateTimeToXml($fragment, $this->getOrderDate());
     }
     return $xmlObject;
 }
Esempio n. 16
0
 /**
  * {@inheritDoc}
  *
  * Format:
  *  <Order_Add_Product order_id="X">
  *      <Code></Code>
  *      <Status></Status>
  *      <Quantity></Quantity>
  *      <TrackingNumber></TrackingNumber> <!-- optional -->
  *      <TrackingType></TrackingType> <!-- optional -->
  *      <Shipment>
  *          <!-- SEE Child/OrderShipment -->
  *      </Shipment>
  * </Order_Add_Product>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Order_Add_Product />');
     $xmlObject->addAttribute('order_id', $this->getOrderId());
     $xmlObject->addChild('Code', $this->getCode());
     $xmlObject->addChild('Status', $this->getStatus());
     if ($this->getTrackingNumber()) {
         $xmlObject->addChild('TrackingNumber', $this->getTrackingNumber());
     }
     if ($this->getTrackingType()) {
         $xmlObject->addChild('TrackingType', $this->getTrackingType());
     }
     if ($this->getShipment()) {
         XmlHelper::appendToParent($xmlObject, $this->getShipment()->toXml());
     }
     return $xmlObject;
 }
Esempio n. 17
0
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <ProductKit_Update product_code="test">
  *      <AttributeTemplateAttribute_Option attribute_code="test" attributetemplateattribute_code="radio" option_code="r2"/>
  *      <Parts>
  *          <Part product_code="part" quantity="4"/>
  *      </Parts>
  * </ProductKit_Update>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<ProductKit_Update />');
     $xmlObject->addAttribute('product_code', $this->getProductCode());
     foreach ($this->getAttributes() as $attribute) {
         XmlHelper::appendToParent($xmlObject, $attribute->toXml());
     }
     if (count($this->getParts())) {
         $partsXmlRoot = $xmlObject->addChild('Parts');
         foreach ($this->getParts() as $part) {
             XmlHelper::appendToParent($partsXmlRoot, $part->toXml());
         }
     }
     return $xmlObject;
 }
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <ProductVariant_Add product_code="test">
  *      <Options>
  *          <Attribute_Option attribute_code="select" option_code="s1"/>
  *          <Attribute_Boolean attribute_code="text" present="true"/>
  *          <AttributeTemplateAttribute_Boolean attribute_code="test" attributetemplateattribute_code="checkbox" present="false"/>
  *          <AttributeTemplateAttribute_Option attribute_code="test" attributetemplateattribute_code="radio" option_code="r2"/>
  *      </Options>
  *      <Parts>
  *          <Part product_code="part" quantity="2"/>
  *          <Part product_code="test" quantity="100"/>
  *      </Parts>
  *      <ProductVariantPricing>
  *          <Method>master</Method>
  *          <Price>5.43</Price>
  *          <Cost>4.31</Cost>
  *          <Weight>3.21</Weight>
  *      </ProductVariantPricing>
  * </ProductVariant_Add>
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<ProductVariant_Add />');
     $xmlObject->addAttribute('product_code', $this->getProductCode());
     if (count($this->getOptions())) {
         $optionsRootXml = $xmlObject->addChild('Options');
         foreach ($this->getOptions() as $option) {
             XmlHelper::appendToParent($optionsRootXml, $option->toXml());
         }
     }
     if (count($this->getParts())) {
         $partsRootXml = $xmlObject->addChild('Parts');
         foreach ($this->getParts() as $part) {
             XmlHelper::appendToParent($partsRootXml, $part->toXml());
         }
     }
     if ($this->getProductVariantPricing()) {
         XmlHelper::appendToParent($xmlObject, $this->getProductVariantPricing()->toXml());
     }
     return $xmlObject;
 }
Esempio n. 19
0
 /**
  * {@inheritDoc}
  * 
  * Format:
  * 
  * <Item>
  *      <Code>test</Code>
  *      <Name>Test Product #1</Name>
  *      <Price>1</Price>
  *      <Weight>0</Weight>
  *      <Quantity>1</Quantity>
  *      <Options>
  *          <Option>
  *              <AttributeCode>test</AttributeCode>
  *          </Option>
  *          <Option>
  *              <AttributeCode>template_attr</AttributeCode>
  *              <Price>1.00</Price>
  *              <OptionCode>v1</OptionCode>
  *          </Option>
  *      </Options>
  * </Item>
  *
  */
 public function toXml($version = Version::CURRENT, array $options = array())
 {
     $xmlObject = new SimpleXMLElement('<Item></Item>');
     $xmlObject->addChild('Code', $this->getCode());
     $xmlObject->addChild('Name', $this->getName());
     $xmlObject->addChild('Price', $this->getPrice());
     $xmlObject->addChild('Weight', $this->getWeight());
     $xmlObject->addChild('Quantity', $this->getQuantity());
     if (count($this->getOptions())) {
         $optionsXmlRoot = $xmlObject->addChild('Options');
         foreach ($this->getOptions() as $option) {
             XmlHelper::appendToParent($optionsXmlRoot, $option->toXml($version, $options));
         }
     }
     return $xmlObject;
 }
Esempio n. 20
0
 /**
  * addFragmentToDomain
  * 
  * @param DomainFragmentInterface $fragment
  * 
  * @return self
  * @throws Exception - When domain not found in root document
  */
 public function addFragmentToDomain(DomainFragmentInterface $fragment)
 {
     $domain = $this->getDomain();
     if (false === $domain) {
         throw new \Exception('Domain Fragment Not Found');
     }
     $fragmentXml = $fragment->toXml($this->getVersion(), array());
     XmlHelper::appendToParent($domain, $fragmentXml);
     return $this;
 }