/** * {@inheritDoc} * * Format: * * <AttributeTemplate_Add code="spikes-armor" prompt="Armor Spikes" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<AttributeTemplate_Add />'); $xmlObject->addAttribute('code', $this->getCode()); $xmlObject->addAttribute('prompt', $this->getPrompt()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <ImageType_Add> * <Code>type_1</Code> * <Description>this is the description for type_1</Description> * </ImageType_Add> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ImageType_Add></ImageType_Add>'); $xmlObject->addChild('Code', $this->getCode()); $xmlObject->addChild('Description', $this->getDescription()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Order_Delete_Item order_id="1000" line_id="1000" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Order_Delete_Item />'); $xmlObject->addAttribute('order_id', $this->getOrderId()); $xmlObject->addAttribute('line_id', $this->getLineId()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <ProductAttribute_Delete product_code="chest" attribute_code="bar" /> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ProductAttribute_Delete />'); $xmlObject->addAttribute('product_code', $this->getProductCode()); $xmlObject->addAttribute('attribute_code', $this->getAttributeCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Attribute_Boolean attribute_code="text" present="true"/> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Attribute_Boolean />'); $xmlObject->addAttribute('attribute_code', $this->getAttributeCode()); $xmlObject->addAttribute('present', $this->getPresent() ? 'true' : 'false'); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <ShippingMethod module_code="upsxml" method_code="02" /> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ShippingMethod />'); $xmlObject->addAttribute('module_code', $this->getModuleCode()); $xmlObject->addAttribute('method_code', $this->getMethodCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <CouponCustomer_Assign coupon_code="xxx" customer_login="******" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<CouponCustomer_Assign />'); $xmlObject->addAttribute('coupon_code', $this->getCouponCode()); $xmlObject->addAttribute('customer_login', $this->getCustomerLogin()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <CategoryProduct_Assign category_code="Food" product_code="ale-gallon" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<CategoryProduct_Assign />'); $xmlObject->addAttribute('category_code', $this->getCategoryCode()); $xmlObject->addAttribute('product_code', $this->getProductCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Attribute_Option attribute_code="select" option_code="s1" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Attribute_Option />'); $xmlObject->addAttribute('attribute_code', $this->getAttributeCode()); $xmlObject->addAttribute('option_code', $this->getOptionCode()); return $xmlObject; }
/** * {@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: * * <ProductKit_Generate_Variants product_code="test" pricing_method="master"/> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ProductKit_Generate_Variants />'); $xmlObject->addAttribute('product_code', $this->getProductCode()); $xmlObject->addAttribute('pricing_method', $this->getPricingMethod()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <MivaMailerSettings_Update> * <Account/> * <Server/> * </MivaMailerSettings_Update> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<MivaMailerSettings_Update></MivaMailerSettings_Update>'); $xmlObject->addChild('Account', $this->getAccount()); $xmlObject->addChild('Server', $this->getServer()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <UpsellSettings_Update> * <ProductsToShow>3</ProductsToShow> * <MaxProductsToSelect>3</MaxProductsToSelect> * </UpsellSettings_Update> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<UpsellSettings_Update />'); $xmlObject->addChild('ProductsToShow', $this->getProductsToShow()); $xmlObject->addChild('MaxProductsToSelect', $this->getMaxProductsToSelect()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <AvailabilityGroupProduct_Assign group_name="Thief" product_code="kit-disguise" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<AvailabilityGroupCustomer_Assign />'); $xmlObject->addAttribute('group_name', $this->getGroupName()); $xmlObject->addAttribute('product_code', $this->getProductCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <ProductRelatedProduct_Unassign product_code="bolts" relatedproduct_code="bolts-silver" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ProductRelatedProduct_Unassign />'); $xmlObject->addAttribute('product_code', $this->getProductCode()); $xmlObject->addAttribute('relatedproduct_code', $this->getRelatedProductCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <ProductImage_Delete product_code="test" filepath="graphics/00000001/s2k_silver_front.jpg" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ProductImage_Add></ProductImage_Add>'); $xmlObject->addAttribute('product_code', $this->getProductCode()); $xmlObject->addAttribute('filepath', $this->getFilePath()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <CouponPriceGroup_Assign coupon_code="xxx" group_name="yyy" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<CouponPriceGroup_Assign />'); $xmlObject->addAttribute('coupon_code', $this->getCouponCode()); $xmlObject->addAttribute('group_name', $this->getGroupName()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Coupon_Delete code="xxx" /> */ public function toXml($version = Version::CURRENT, array $options = array()) { if ($version < Version::NINE) { return; } $xmlObject = new SimpleXMLElement('<Coupon_Delete />'); $xmlObject->addAttribute('code', $this->getCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Module code="customfields" feature="fields_prod"> * <ProductField_Delete code="code" /> * </Module> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Module />'); $xmlObject->addAttribute('code', 'customfields'); $xmlObject->addAttribute('feature', 'fields_prod'); $mainTag = $xmlObject->addChild('ProductField_Delete'); $mainTag->addAttribute('Code', $this->getCode()); return $xmlObject; }
/** * {@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; }
/** * {@inheritDoc} * * Format: * * <Module code="customfields" feature="util"> * <Group_Add> * <Code>group_code</Code> * <Name>Group Name</Name> * </Group_Add> * </Module> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Module />'); $xmlObject->addAttribute('code', 'customfields'); $xmlObject->addAttribute('feature', 'util'); $mainTag = $xmlObject->addChild('Group_Add'); $mainTag->addChild('Code', $this->getCode()); $mainTag->addChild('Name', $this->getName())->addAttribute('method-call', 'addCDATA'); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Module code="customfields" feature="fields_cust"> * <CustomerField_Value customer="login" field="code">No</CustomerField_Value> * </Module> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Module />'); $xmlObject->addAttribute('code', 'customfields'); $xmlObject->addAttribute('feature', 'fields_cust'); $mainTag = $xmlObject->addChild('CustomerField_Value', $this->getValue()); $mainTag->addAttribute('customer', $this->getCustomerLogin()); $mainTag->addAttribute('field', $this->getFieldCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Encryption_Add> * <Prompt</Prompt> * <Passphrase></Passphrase> * <Current>Yes|No</Current> * </Encryption_Add> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Encryption_Add />'); $xmlObject->addChild('Prompt', $this->getPrompt()); $xmlObject->addChild('Passphrase', $this->getPassphrase()); $xmlObject->addChild('Current', $this->getCurrent() ? 'Yes' : 'No'); return $xmlObject; }
/** * toXml * * Outputs current builder to a XML string * * @return string */ public function toXml($formatted = false) { if (true === $formatted) { $xml = $this->root->saveXml(); $dom = new \DOMDocument('1.0'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($xml); return $dom->saveXML(); } return $this->root->saveXml(); }
/** * {@inheritDoc} * * Format: * * <AttributeTemplateAttribute_Update template_code="spikes-armor" attribute_code="armor"> * <Code>spikes</Code> * <Type>checkbox</Type> * <Prompt><![CDATA[Would you like to add spikes to the armor? (+500 sp)]]></Prompt> * <Image></Image> * <Price>500.00</Price> * <Cost>375.00</Cost> * <Weight>0.00</Weight> * <Required>No</Required> * <Inventory>No</Inventory> * </AttributeTemplateAttribute_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<AttributeTemplateAttribute_Update />'); $xmlObject->addAttribute('template_code', $this->getTemplateCode()); $xmlObject->addAttribute('attribute_code', $this->getAttributeCode()); if ($this->getCode()) { $xmlObject->addChild('Code', $this->getCode()); } if ($this->getType()) { $xmlObject->addChild('Type', $this->getType()); } if ($this->getPrompt()) { $xmlObject->addChild('Prompt', $this->getPrompt())->addAttribute('method-call', 'addCDATA'); } if ($this->getImage()) { $xmlObject->addChild('Image', $this->getImage()); } if ($this->getPrice()) { $xmlObject->addChild('Price', $this->getPrice()); } if ($this->getCost()) { $xmlObject->addChild('Cost', $this->getCost()); } if ($this->getWeight()) { $xmlObject->addChild('Weight', $this->getWeight()); } $xmlObject->addChild('Required', $this->getRequired() ? 'Yes' : 'No'); $xmlObject->addChild('Inventory', $this->getInventory() ? 'Yes' : 'No'); return $xmlObject; }
/** * {@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; }
/** * {@inheritDoc} * * Format: * * <ImageType_Delete code="type_a"/> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ImageType_Delete></ImageType_Delete>'); $xmlObject->addAttribute('code', $this->getCode()); 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: * * <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: * * <Charge> * <Type>SHIPPING|TAX|etc</Type> * <Description>TEST</Description> * <Amount>x.xx</Amount> * <DisplayAmount>x.xx</DisplayAmount> * <TaxExempt>Yes|No</Code> * </Charge> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Charge />'); $xmlObject->addChild('Type', $this->getType()); $xmlObject->addChild('Description', $this->getDescription()); $xmlObject->addChild('Amount', number_format($this->getAmount(), 2, '.', '')); $xmlObject->addChild('DisplayAmount', number_format($this->getDisplayAmount(), 2, '.', '')); $xmlObject->addChild('TaxExempt', $this->getTaxExempt() ? 'Yes' : 'No'); $xmlObject->addChild('Module', $this->getModule()); return $xmlObject; }