/**
     * Render the attribute.
     *
     * @return string
     */
    public function render()
    {
        if ($this->isEmpty()) {
            return '';
        }
        $name = Xml::escape($this->name);
        $value = Xml::escape($this->value);
        $isVariant = Xml::escape($this->isVariant);
        $rank = Xml::escape($this->rank);
        return <<<XML
<NameValueAttribute>
    <name>{$name}</name>
    <type>{$this->type}</type>
    <isVariant>{$isVariant}</isVariant>
    <variantResourceType>{$this->variantResourceType}</variantResourceType>
    <value>
        <value>{$value}</value>
        <rank>{$rank}</rank>
        <isVariant>{$isVariant}</isVariant>
    </value>
</NameValueAttribute>
XML;
    }
示例#2
0
    /**
     * Render the XML.
     *
     * @return string
     */
    public function render()
    {
        $unitCostAmount = Xml::escape($this->unitCost['amount']);
        $unitCostCurrency = Xml::escape($this->unitCost['currency']);
        $legacyDistributorId = Xml::escape($this->legacyDistributorId);
        $mdsfamId = Xml::escape($this->shipNodeSupply['mdsfamId']);
        $vendorStockId = Xml::escape($this->shipNodeSupply['vendorStockId']);
        $assumeInfiniteInventory = Xml::escape($this->assumeInfiniteInventory);
        $onHandSafetyFactorQuantityValue = Xml::escape($this->onHandSafetyFactorQuantity['value']);
        $onHandSafetyFactorQuantityUnit = Xml::escape($this->onHandSafetyFactorQuantity['unit']);
        $inventoryAvailabilityThresholdXml = $this->renderInventoryAvailabilityThreshold();
        $preferredDistributorsXml = $this->renderPreferredDistributors();
        return <<<XML
<itemLogistics>
    <!-- START: Required Dummy Values -->
    <reportingHierarchy>
        <reportingHierarchyLevel>
            <levelId>1</levelId>
            <nodeId>str1234</nodeId>
        </reportingHierarchyLevel>
    </reportingHierarchy>
    <marketAttributes></marketAttributes>
    <preorderInfo>
        <isPreOrder>false</isPreOrder>
        <streetDate>2015-03-30T00:00:00</streetDate>
        <streetDateType>DELIVER_BY</streetDateType>
    </preorderInfo>
    <programEligibilities></programEligibilities>
    <packages></packages>
    <isPerishable>false</isPerishable>
    <isHazmat>false</isHazmat>
    <!-- END: Required Dummy Values -->
    <!-- START: Dummy LIMO Values -->
    {$inventoryAvailabilityThresholdXml}
    <onHandSafetyFactorQuantity>
        <value>{$onHandSafetyFactorQuantityValue}</value>
        <unit>{$onHandSafetyFactorQuantityUnit}</unit>
    </onHandSafetyFactorQuantity>
    <assumeInfiniteInventory>{$assumeInfiniteInventory}</assumeInfiniteInventory>
    <unitCost>
        <currency>{$unitCostCurrency}</currency>
        <amount>{$unitCostAmount}</amount>
    </unitCost>
    <primarySupplyItemId>2947757</primarySupplyItemId>
    <alternateSupplyItemId>str1234</alternateSupplyItemId>
    {$preferredDistributorsXml}
    <!-- END: Dummy LIMO Values -->
    <!-- START: Required Dummy Values -->
    <fulfillmentOptions></fulfillmentOptions>
    <shipAsIs>true</shipAsIs>
    <signatureOnDelivery>NEVER</signatureOnDelivery>
    <isConveyable>false</isConveyable>
    <bundleFulfillmentMode>SHIP_ALONE</bundleFulfillmentMode>
    <storageType>AMBIENT</storageType>
    <!-- END: Required Dummy Values -->
    <shipNodes>
        <shipNode>
            <legacyDistributorId>{$legacyDistributorId}</legacyDistributorId>
            <!-- START: Required Dummy Values -->
            <shipNodeStatus>ACTIVE</shipNodeStatus>
            <preOrderMaxQty>
                <value>1</value>
                <unit>EA</unit>
            </preOrderMaxQty>
            <handlingCost>
                <currency>GBP</currency>
                <amount>123.45</amount>
            </handlingCost>
            <unitCost>
                <currency>GBP</currency>
                <amount>4.00</amount>
            </unitCost>
            <shipNodeItemId>str1234</shipNodeItemId>
            <initialAvailabilityCode>AA</initialAvailabilityCode>
            <availabilityThreshold>
                <low>123</low>
                <mid>123</mid>
                <high>123</high>
            </availabilityThreshold>
            <inventoryOwnerId>EEB3A0D4-309A-4DAA-9296-77BE4AEFB2CE</inventoryOwnerId>
            <programEligibilities></programEligibilities>
            <!-- END: Required Dummy Values -->
            <shipNodeSupplies>
                <shipNodeSupply>
                    <mdsfamId>{$mdsfamId}</mdsfamId>
                    <vendorStockId>{$vendorStockId}</vendorStockId>
                </shipNodeSupply>
            </shipNodeSupplies>
        </shipNode>
    </shipNodes>
</itemLogistics>
XML;
    }
示例#3
0
    /**
     * Only urls need passing, the type is automatically set to PRIMARY for the first url, SECONDARY for others
     * If all urls share the same prefix, can pass that in as an optional parameter (so only need to pass unique ids)
     *
     * @param array $urls
     * @param string $urlPrefix
     */
    public function setAssets(array $urls, $urlPrefix = '')
    {
        $urls = array_filter($urls);
        foreach ($urls as $index => $asset) {
            $asset = Xml::escape($urlPrefix . $asset);
            $type = $index > 0 ? 'SECONDARY' : 'PRIMARY';
            $attribute = new NameValueAttribute('provider_name', 'asda.scene7.com');
            $this->assets .= <<<XML
<Asset>
    <assetURL>{$asset}</assetURL>
    <usageType>{$type}</usageType>
    <rank>1</rank>
    <AssetAttributes>{$attribute->render()}</AssetAttributes>
</Asset>
XML;
        }
    }
示例#4
0
 /**
  * @expectedException       \Pangaea\PangaeaException
  * @expectedExceptionRegExp /xmlParseEntityRef: no name/
  */
 public function testValidateInvalidXml()
 {
     $xmlPath = __DIR__ . '/fixtures/invalid_items.xml';
     $schemaPath = __DIR__ . '/../xsd/feed/Feed.xsd';
     $this->assertFalse(Xml::validate($xmlPath, $schemaPath));
 }
    /**
     * Render the attribute.
     *
     * @return string
     */
    public function render()
    {
        if ($this->isEmpty()) {
            return '';
        }
        $name = Xml::escape($this->name);
        $valuesXml = '';
        foreach ($this->value as $value) {
            $valuesXml .= '<value><value>' . Xml::escape($value) . '</value></value>';
        }
        return <<<XML
<NameValueAttribute>
    <name>{$name}</name>
    <type>{$this->type}</type>
    {$valuesXml}
</NameValueAttribute>
XML;
    }
示例#6
0
 /**
  * Validates the document and saves to the specified path
  *
  * @param $path
  * @return boolean
  * @throws \PangaeaException
  */
 public function save($path)
 {
     $result = file_put_contents($path, $this->render());
     Xml::validate($path, __DIR__ . '/../xsd/feed/Feed.xsd');
     return $result > 0;
 }