/** * {@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: * * <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: * * <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: * * <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="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: * * <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: * * <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; }
/** * {@inheritDoc} * * Format: * * <Customer_Update login="******"> * <Login>c1</Login> * <LostPasswordEmail>noreply@miva.com</LostPasswordEmail> * <Password>c1</Password> * <ShipFirstName>Testy</ShipFirstName> * <ShipLastName>Testerman</ShipLastName> * <ShipEmail>noreply@miva.com</ShipEmail> * <ShipPhone>555-555-5555</ShipPhone> * <ShipFax>555-555-1212</ShipFax> * <ShipCompany>MivaCorp</ShipCompany> * <ShipAddress>5060 Santa Fe St</ShipAddress> * <ShipCity>San Diego</ShipCity> * <ShipStateCode>CA</ShipStateCode> * <ShipZip>92109</ShipZip> * <ShipCountryCode>US</ShipCountryCode> * <BillFirstName>Testy</BillFirstName> * <BillLastName>Testerman</BillLastName> * <BillEmail>noreply@miva.com</BillEmail> * <BillPhone>555-555-5555</BillPhone> * <BillFax>555-555-1212</BillFax> * <BillCompany>MivaCorp</BillCompany> * <BillAddress>5060 Santa Fe St</BillAddress> * <BillCity>San Diego</BillCity> * <BillStateCode>CA</BillStateCode> * <BillZip>92109</BillZip> * <BillCountryCode>US</BillCountryCode> * </Customer_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Customer_Update />'); $xmlObject->addAttribute('login', $this->getLogin()); if ($this->getNewLogin()) { $xmlObject->addChild('Login', $this->getNewLogin()); } if ($this->getLostPasswordEmail()) { $xmlObject->addChild('LostPasswordEmail', $this->getLostPasswordEmail()); } if ($this->getPassword()) { $xmlObject->addChild('Password', $this->getPassword()); } 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->getShipPhone()) { $xmlObject->addChild('ShipPhone', $this->getShipPhone()); } if ($this->getShipFax()) { $xmlObject->addChild('ShipFax', $this->getShipFax()); } if ($this->getShipCompany()) { $xmlObject->addChild('ShipCompany', $this->getShipCompany()); } if ($this->getShipAddress()) { $xmlObject->addChild('ShipAddress', $this->getShipAddress()); } if ($this->getShipCity()) { $xmlObject->addChild('ShipCity', $this->getShipCity()); } if ($this->getShipStateCode()) { $xmlObject->addChild('ShipStateCode', $this->getShipStateCode()); } if ($this->getShipZip()) { $xmlObject->addChild('ShipZip', $this->getShipZip()); } if ($this->getShipCountryCode()) { $xmlObject->addChild('ShipCountryCode', $this->getShipCountryCode()); } 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->getBillPhone()) { $xmlObject->addChild('BillPhone', $this->getBillPhone()); } if ($this->getBillFax()) { $xmlObject->addChild('BillFax', $this->getBillFax()); } if ($this->getBillCompany()) { $xmlObject->addChild('BillCompany', $this->getBillCompany()); } if ($this->getBillAddress()) { $xmlObject->addChild('BillAddress', $this->getBillAddress()); } if ($this->getBillCity()) { $xmlObject->addChild('BillCity', $this->getBillCity()); } if ($this->getBillStateCode()) { $xmlObject->addChild('BillStateCode', $this->getBillStateCode()); } if ($this->getBillZip()) { $xmlObject->addChild('BillZip', $this->getBillZip()); } if ($this->getBillCountryCode()) { $xmlObject->addChild('BillCountryCode', $this->getBillCountryCode()); } return $xmlObject; }
/** * {@inheritDoc} * * Format (Pre MM9): * * <PriceGroup_Add> * <Name>Warrior</Name> * <Pricing>Discount</Pricing> * <Amount>10.00</Amount> * </PriceGroup_Add> * * * Format (MM9): * * <PriceGroup_Add> * <Name>Warrior</Name> * <Eligibility>Coupon,All,Customer,LoggedIn</Eligibility> * <NotValidBefore> * <Day>01</Day> (required) * <Month>01</Month> (required) * <Year>1970</Year> (required) * <Minute>30</Minute> (optional) * <Hour>12</Hour> (optional) * </NotValidBefore> * <NotValidAfter> * <Day>01</Day> (required) * <Month>01</Month> (required) * <Year>1970</Year> (required) * <Minute>30</Minute> (optional) * <Hour>12</Hour> (optional) * </NotValidAfter> * <Priority>100</Priority> * * <!-- One of the following --> * * <Pricing>Retail,Cost,Discount,Markup</Pricing> * <Amount>10.00</Amount> * * <!-- or --> * * <Module>discount_addon|discount_addon|discount_basket|discount_buyxgety|discount_product|discount_shipping_product|discount_shipping_basket| discount_saleprice|discount_volume</Module> * <Description>Textual Description</Description> * <DisplayInBasket>No</DisplayInBasket> * <QualifyingMinimumSubtotal>0.00</QualifyingMinimumSubtotal> * <QualifyingMaximumSubtotal>0.00</QualifyingMaximumSubtotal> * <QualifyingMinimumQuantity>0</QualifyingMinimumQuantity> * <QualifyingMaximumQuantity>0</QualifyingMaximumQuantity> * <QualifyingMinimumWeight>0.00</QualifyingMinimumWeight> * <QualifyingMaximumWeight>0.00</QualifyingMaximumWeight> * <BasketMinimumSubtotal>0.00</BasketMinimumSubtotal> * <BasketMaximumSubtotal>0.00</BasketMaximumSubtotal> * <BasketMinimumQuantity>0</BasketMinimumQuantity> * <BasketMaximumQuantity>0</BasketMaximumQuantity> * <BasketMinimumWeight>0.00</BasketMinimumWeight> * <BasketMaximumWeight>0.00</BasketMaximumWeight> * * <Settings> * <!-- Module-specific settings --> * </Settings> * <Exclusions> * <Exclusion group_name="xxx" type="basket|group|item" /> * </Exclusions> * </PriceGroup_Add> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<PriceGroup_Add />'); if ($version < Version::NINE) { $xmlObject->addChild('Name', $this->getName()); $xmlObject->addChild('Pricing', $this->getPricing()); $xmlObject->addChild('Amount', $this->getAmount()); return $xmlObject; } $xmlObject->addChild('Name', $this->getName()); $xmlObject->addChild('Eligibility', $this->getEligibility()); if ($this->getNotValidBefore() instanceof \DateTime) { $date = $this->getNotValidBefore(); $notValidBefore = $xmlObject->addChild('NotValidBefore'); $notValidBefore->addChild('Day', $date->format('d')); $notValidBefore->addChild('Month', $date->format('m')); $notValidBefore->addChild('Year', $date->format('Y')); $notValidBefore->addChild('Minute', $date->format('i')); $notValidBefore->addChild('Hour', $date->format('h')); } if ($this->getNotValidAfter() instanceof \DateTime) { $date = $this->getNotValidAfter(); $notValidAfter = $xmlObject->addChild('NotValidAfter'); $notValidAfter->addChild('Day', $date->format('d')); $notValidAfter->addChild('Month', $date->format('m')); $notValidAfter->addChild('Year', $date->format('Y')); $notValidAfter->addChild('Minute', $date->format('i')); $notValidAfter->addChild('Hour', $date->format('h')); } if ($this->getPriority()) { $xmlObject->addChild('Priority', $this->getPriority()); } if (!$this->getModule()) { $xmlObject->addChild('Pricing', $this->getPricing()); $xmlObject->addChild('Amount', $this->getAmount()); return $xmlObject; } $xmlObject->addChild('Module', $this->getModule()); $xmlObject->addChild('Description', $this->getDescription()); $xmlObject->addChild('DisplayInBasket', $this->getDisplayInBasket() ? 'Yes' : 'No'); $xmlObject->addChild('QualifyingMinimumSubtotal', $this->getQualifyingMinimumSubtotal()); $xmlObject->addChild('QualifyingMaximumSubtotal', $this->getQualifyingMaximumSubtotal()); $xmlObject->addChild('QualifyingMinimumQuantity', $this->getQualifyingMinimumQuantity()); $xmlObject->addChild('QualifyingMaximumQuantity', $this->getQualifyingMaximumQuantity()); $xmlObject->addChild('QualifyingMinimumWeight', $this->getQualifyingMinimumWeight()); $xmlObject->addChild('QualifyingMaximumWeight', $this->getQualifyingMaximumWeight()); $xmlObject->addChild('BasketMinimumSubtotal', $this->getBasketMinimumSubtotal()); $xmlObject->addChild('BasketMaximumSubtotal', $this->getBasketMaximumSubtotal()); $xmlObject->addChild('BasketMinimumQuantity', $this->getBasketMinimumQuantity()); $xmlObject->addChild('BasketMaximumQuantity', $this->getBasketMaximumQuantity()); $xmlObject->addChild('BasketMinimumWeight', $this->getBasketMinimumWeight()); $settings = $xmlObject->addChild('Settings'); foreach ($this->getSettings() as $key => $value) { $settings->addChild($key, $value); } if (count($this->getExclusions())) { $settings = $xmlObject->addChild('Exclusions'); foreach ($this->getExclusions() as $group => $type) { $exclusion = $settings->addChild('Exclusion'); $exclusion->addAttribute('group', $group); $exclusion->addAttribute('type', $type); } } return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <AffiliateOptions_Update> * <Active>Active</Active> * <ApplicationStatus>ApplicationStatus</ApplicationStatus> * <DefaultCommissionHit>1.0000</DefaultCommissionHit> * <DefaultCommissionPercentOfOrder>1.0000</DefaultCommissionPercentOfOrder> * <DefaultCommissionOrderFlatFee>1.0000</DefaultCommissionOrderFlatFee> * <PayoutThreshold>1.0000</PayoutThreshold> * <LinkImage>LinkImage</LinkImage> * <LinkText>LinkText</LinkText> * <Terms>Terms</Terms> * </AffiliateOptions_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<AffiliateOptions_Update />'); $xmlObject->addChild('Active', $this->getActive()); $xmlObject->addChild('ApplicationStatus', $this->getApplicationStatus()); $xmlObject->addChild('DefaultCommissionHit', $this->getDefaultCommissionHit()); $xmlObject->addChild('DefaultCommissionPercentOfOrder', $this->getDefaultCommissionPercentOfOrder()); $xmlObject->addChild('DefaultCommissionOrderFlatFee', $this->getDefaultCommissionOrderFlatFee()); $xmlObject->addChild('PayoutThreshold', $this->getPayoutThreshold()); $xmlObject->addChild('LinkImage', $this->getLinkImage()); $xmlObject->addChild('LinkText', $this->getLinkText()); $xmlObject->addChild('Terms', $this->getTerms()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <UltimateGiftCertificates_AddKey certcode="TEST_ADD"> * <Certkey>TEST2</Certkey> * <Balance>5000</Balance> * <Expires>11</Expires> * <Issued>TIMESTAMP</Issued> * <Expires>TIMESTAMP</Expires> * <Balance>FLOAT</Balance> * <Lastused>TIMESTAMP</Lastused> * <Order>INTEGER</Order> * <Status>INTEGER</Status> * <RecipientEmail>STRING</RecipientEmail> * <RecipientName>STRING</RecipientName> * <RecipientMessage>STRING</RecipientMessage> * <SenderFirstName>STRING</SenderFirstName> * <SenderLastName>STRING</SenderLastName> * <SenderEmail>STRING</SenderEmail> * </UltimateGiftCertificates_AddKey> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<UltimateGiftCertificates_AddKey />'); $xmlObject->addAttribute('certcode', $this->getCertCode()); $xmlObject->addChild('Certkey', $this->getCertKey()); $xmlObject->addChild('Balance', $this->getBalance()); if ($this->getExpires() instanceof \DateTime) { $xmlObject->addChild('Expires', $this->getExpires()->getTimestamp()); } else { $xmlObject->addChild('Expires', $this->getExpires()); } if ($this->getIssued() instanceof \DateTime) { $xmlObject->addChild('Issued', $this->getIssued()->getTimestamp()); } else { $xmlObject->addChild('Issued', $this->getIssued()); } if ($this->getLastUsed() && $this->getLastUsed() instanceof \DateTime) { $xmlObject->addChild('Issued', $this->getLastUsed()->getTimestamp()); } else { if ($this->getLastUsed()) { $xmlObject->addChild('Issued', $this->getLastUsed()); } } if ($this->getOrder()) { $xmlObject->addChild('Order', $this->getOrder()); } if ($this->getStatus()) { $xmlObject->addChild('Status', $this->getStatus() ? 'Yes' : 'No'); } if ($this->getRecipientEmail()) { $xmlObject->addChild('RecipientEmail', $this->getRecipientEmail()); } if ($this->getRecipientName()) { $xmlObject->addChild('RecipientName', $this->getRecipientName()); } if ($this->getRecipientMessage()) { $xmlObject->addChild('RecipientMessage', $this->getRecipientMessage()); } if ($this->getSenderFirstName()) { $xmlObject->addChild('SenderFirstName', $this->getSenderFirstName()); } if ($this->getSenderLastName()) { $xmlObject->addChild('SenderLastName', $this->getSenderLastName()); } if ($this->getSenderEmail()) { $xmlObject->addChild('SenderEmail', $this->getSenderEmail()); } return $xmlObject; }
/** * {@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; }
/** * {@inheritDoc} * * Format: * * <Country_Add> * <Name>Burchtopia</Name> * <Code>BR</Code> * <ISO_Code>123</ISO_Code> * </Country_Add> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Country_Add></Country_Add>'); $xmlObject->addChild('Name', $this->getName()); $xmlObject->addChild('Code', $this->getCode()); $xmlObject->addChild('ISO_Code', $this->getIsoCode()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <UpsoldProduct_Add> * <ProductCode>backpack</ProductCode> * <Display>Total</Display> * <RequiredAmount>50.00</RequiredAmount> * <Pricing>AbsolutePrice</Pricing> * <Price>17.00</Price> * </UpsoldProduct_Add> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<UpsoldProduct_Add />'); $xmlObject->addChild('ProductCode', $this->getProductCode()); $xmlObject->addChild('Display', $this->getDisplay()); $xmlObject->addChild('RequiredAmount', $this->getRequiredAmount()); $xmlObject->addChild('Pricing', $this->getPricing()); $xmlObject->addChild('Price', $this->getPrice()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Settings_Update> * <ForcePasswordAfterDays>10</ForcePasswordAfterDays> * <PasswordReuse>5</PasswordReuse> * <MinimumPasswordLength>3</MinimumPasswordLength> * <PasswordComplexity>none</PasswordComplexity> * <ImageJPEGQuality>12</ImageJPEGQuality> * </Settings_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Settings_Update />'); $xmlObject->addChild('ForcePasswordAfterDays', $this->getForcePasswordAfterDays()); $xmlObject->addChild('PasswordReuse', $this->getPasswordReuse()); $xmlObject->addChild('MinimumPasswordLength', $this->getMinimumPasswordLength()); $xmlObject->addChild('PasswordComplexity', $this->getImageJPEGQuality()); return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <InventoryEmailNotification_Update> * <SendEmailOnLowStock>No</SendEmailOnLowStock> * <SendEmailOnNoStock>Yes</SendEmailOnNoStock> * <EmailFrom>noreply@miva.com</EmailFrom> * <EmailTo>noreply@miva.com</EmailTo> * <EmailCC></EmailCC> * <Subject>Inventory tracking message</Subject> * <Message>Product- %product_name% (%product_code%) is out of stock (Currently at %inv_available%)</Message> * </InventoryEmailNotification_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<InventoryEmailNotification_Update></InventoryEmailNotification_Update>'); $xmlObject->addChild('SendEmailOnLowStock', $this->getSendEmailOnLowStock()); $xmlObject->addChild('SendEmailOnNoStock', $this->getSendEmailOnNoStock()); $xmlObject->addChild('EmailFrom', $this->getEmailFrom()); $xmlObject->addChild('EmailTo', $this->getEmailTo()); $xmlObject->addChild('EmailCC', $this->getEmailCC()); $xmlObject->addChild('Subject', $this->getSubject()); $xmlObject->addChild('Message', $this->getMessage()); 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; }
/** * {@inheritDoc} * * Format: * * <HandlingCharge_Update> * <TriggerType>Disabled|Always|SubTotal|Quantity|Weight</TriggerType> * <TriggerMinimumValue>0.00</TriggerMinimumValue> * <TriggerMaximumValue>10.00</TriggerMaximumValue> * <AmountType>Fixed|PercentOfShipping|PercentOfSubTotal</AmountType> * <Amount>5.55</Amount> * <SeparateLineItem>Yes</SeparateLineItem> * <Description>Handling Charge</Description> * <TaxExempt>No</TaxExempt> * </HandlingCharge_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<HandlingCharge_Update></HandlingCharge_Update>'); $xmlObject->addChild('TriggerType', $this->getTriggerType()); $xmlObject->addChild('TriggerMinimumValue', $this->getTriggerMinimumValue()); $xmlObject->addChild('TriggerMaximumValue', $this->getTriggerMaximumValue()); $xmlObject->addChild('AmountType', $this->getAmountType()); $xmlObject->addChild('Amount', $this->getAmount()); $xmlObject->addChild('SeparateLineItem', $this->getSeparateLineItem()); $xmlObject->addChild('Description', $this->getDescription()); $xmlObject->addChild('TaxExempt', $this->getTaxExempt()); 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: * * <ProductPricingTable group_name="Volume Pricing Product Provisioning Test 01" product_code="discount_volume_provisioning_product"> * <Entry quantity="99" type="absolute" amount="99.98" /> * <Entry quantity="10" type="percent" amount="10" /> * <Entry quantity="5" type="fixed" amount="5" /> * <Entry quantity="101" type="fixed" amount="0" /> * </ProductPricingTable> */ public function toXml($version = Version::CURRENT, array $options = array()) { if ($version < Version::NINE) { return; } $xmlObject = new SimpleXMLElement('<ProductPricingTable />'); $xmlObject->addAttribute('group_name', $this->getGroupName()); $xmlObject->addAttribute('product_code', $this->getProductCode()); if (count($this->getEntries())) { $entriesXml = $xmlObject->addChild('Entries'); foreach ($this->getEntries() as $entry) { $entryXml = $entriesXml->addChild('Entry'); $entryXml->addAttribute('quantity', $entry['quantity']); $entryXml->addAttribute('type', $entry['type']); $entryXml->addAttribute('amount', $entry['amount']); } } return $xmlObject; }
/** * {@inheritDoc} * * Format: * * <Category_Update code="Food"> * <Name>Name</Name> * <Active>True</Active> * <ParentCategoryCode>Goods</ParentCategoryCode> * </Category_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<Category_Update />'); $xmlObject->addAttribute('code', $this->getCode()); if ($this->getName()) { $xmlObject->addChild('Name', $this->getName()); } if ($this->getNewCode()) { $xmlObject->addChild('Code', $this->getNewCode()); } if ($this->getParentCategoryCode()) { $xmlObject->addChild('ParentCategoryCode', $this->getParentCategoryCode()); } if ($this->getAlternateDisplayPage()) { $xmlObject->addChild('AlternateDisplayPage', $this->getAlternateDisplayPage()); } $xmlObject->addChild('Active', $this->getActive() ? 'Yes' : 'No'); 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; }
/** * {@inheritDoc} * * Format: * * <ShippingRules_Update> * <RequiredShippingRedirectPageCode>OCST</RequiredShippingRedirectPageCode> * <FallbackShippingMethod> * <Description>Estimated Shipping</Description> * <Type>Fixed|PercentOfSubTotal</Type> * <Amount>1.23</Amount> * </FallbackShippingMethod> * </ShippingRules_Update> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ShippingRules_Update />'); $xmlObject->addChild('RequiredShippingRedirectPageCode', $this->getRequiredShippingRedirectPageCode()); $fallbackShipping = $this->getFallbackShippingMethod(); $fallbackShippingXml = $xmlObject->addChild('FallbackShippingMethod'); foreach (array('Description', 'Type', 'Amount') as $field) { $value = isset($fallbackShipping[$field]) && !empty($fallbackShipping[$field]) ? $fallbackShipping[$field] : null; $fallbackShippingXml->addChild($field, $value); } 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_Update code="type_1"> * <Code>type_a</Code> * </ImageType_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ImageType_Update></ImageType_Update>'); $xmlObject->addAttribute('code', $this->getCode()); $xmlObject->addChild('Description', $this->getDescription()); if ($this->getNewCode()) { $xmlObject->addChild('Code', $this->getNewCode()); } 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; }
/** * {@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: * * <Coupon_Update code="xxx"> * <Code>xxx</Code> * <Description></Description> * <Eligibility>Customer,LoggedIn,All</Eligibility> * <NotValidBefore></NotValidBefore> * <NotValidAfter></NotValidAfter> * <MaxUse></MaxUse> * <MaxPerShopper></MaxPerShopper> * <Active>No</Active> * </Coupon_Update> */ public function toXml($version = Version::CURRENT, array $options = array()) { if ($version < Version::NINE) { return; } $xmlObject = new SimpleXMLElement('<Coupon_Update />'); $xmlObject->addAttribute('code', $this->getCode()); $xmlObject->addChild('Description', $this->getDescription()); if ($this->getNewCode()) { $xmlObject->addChild('Code', $this->getNewCode()); } else { $xmlObject->addChild('Code', $this->getCode()); } $xmlObject->addChild('Eligibility', $this->getEligibility()); $xmlObject->addChild('MaxUse', $this->getMaxUse()); $xmlObject->addChild('MaxPerShopper', $this->getMaxPerShopper()); $xmlObject->addChild('Active', $this->getActive() ? 'Yes' : 'No'); if ($this->getNotValidBefore() instanceof \DateTime) { $date = $this->getNotValidBefore(); $notValidBefore = $xmlObject->addChild('NotValidBefore'); $notValidBefore->addChild('Day', $date->format('d')); $notValidBefore->addChild('Month', $date->format('m')); $notValidBefore->addChild('Year', $date->format('Y')); $notValidBefore->addChild('Minute', $date->format('i')); $notValidBefore->addChild('Hour', $date->format('h')); } if ($this->getNotValidAfter() instanceof \DateTime) { $date = $this->getNotValidAfter(); $notValidAfter = $xmlObject->addChild('NotValidAfter'); $notValidAfter->addChild('Day', $date->format('d')); $notValidAfter->addChild('Month', $date->format('m')); $notValidAfter->addChild('Year', $date->format('Y')); $notValidAfter->addChild('Minute', $date->format('i')); $notValidAfter->addChild('Hour', $date->format('h')); } return $xmlObject; }
/** * {@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: * * <ProductAttributeOption_Update product_code="chest" attribute_code="lock" option_code="bar"> * <Code>simple</Code> <!-- Required --> * <Prompt><![CDATA[Simple (+200 sp)]]></Prompt> <!-- Required --> * <Image/> <!-- Optional --> * <Price>200.00</Price> <!-- Optional --> * <Cost>100.00</Cost> <!-- Optional --> * <Weight>0.00</Weight> <!-- Optional --> * <DefaultOption>Yes|No</DefaultOption> <!-- Optional --> * </ProductAttributeOption_Add> * */ public function toXml($version = Version::CURRENT, array $options = array()) { $xmlObject = new SimpleXMLElement('<ProductAttributeOption_Update />'); $xmlObject->addAttribute('product_code', $this->getProductCode()); $xmlObject->addAttribute('attribute_code', $this->getAttributeCode()); $xmlObject->addAttribute('option_code', $this->getOptionCode()); if ($this->getCode()) { $xmlObject->addChild('Code', $this->getCode()); } if ($this->getPrompt()) { $xmlObject->addChild('Prompt', $this->getPrompt()); } if ($this->getPrice()) { $xmlObject->addChild('Price', $this->getPrice()); } if ($this->getCost()) { $xmlObject->addChild('Cost', $this->getCost()); } if ($this->getWeight()) { $xmlObject->addChild('Weight', $this->getWeight()); } if ($this->getImage()) { $xmlObject->addChild('Image', $this->getImage()); } $xmlObject->addChild('DefaultOption', $this->getDefaultOption() ? 'Yes' : 'No'); return $xmlObject; }