Example #1
0
    /**
     * @inheritdoc
     */
    public function xml()
    {
        $template = $this->product->getTemplate();
        $company = $this->getCompany($template->company_id);
        $location = fn_get_country_name($company['company_country']);
        $secondary_category = $this->product->getExternalSecondCategoryId();
        $secondary_category_xml = "";
        if (!empty($secondary_category)) {
            $secondary_category_xml = <<<XML
            <SecondaryCategory>
                <CategoryID>{$secondary_category}</CategoryID>
            </SecondaryCategory>
XML;
        }
        return <<<XML
        <Item>
            {$this->getItemIdXml()}
            <Site>{$template->site}</Site>
            <ListingType>FixedPriceItem</ListingType>
            <Currency>{$this->getCurrency()}</Currency>
            <PrimaryCategory>
                <CategoryID>{$this->product->getExternalCategoryId()}</CategoryID>
            </PrimaryCategory>
            {$secondary_category_xml}
            <ConditionID>{$template->condition_id}</ConditionID>
            <CategoryMappingAllowed>true</CategoryMappingAllowed>
            <Country>{$company['company_country']}</Country>
            <PostalCode>{$company['company_zipcode']}</PostalCode>
            <Location><![CDATA[{$location}]]></Location>
            <Title><![CDATA[{$this->product->title}]]></Title>
            <Description><![CDATA[{$this->product->description}]]></Description>
            <ListingDuration><![CDATA[{$template->ebay_duration}]]></ListingDuration>
            <DispatchTimeMax><![CDATA[{$template->dispatch_days}]]></DispatchTimeMax>
            <ReturnPolicy>
                <ReturnsAcceptedOption><![CDATA[{$template->return_policy}]]></ReturnsAcceptedOption>
                <RefundOption><![CDATA[{$template->refund_method}]]></RefundOption>
                <ReturnsWithinOption><![CDATA[{$template->contact_time}]]></ReturnsWithinOption>
                <Description><![CDATA[{$template->return_policy_descr}]]></Description>
                <ShippingCostPaidByOption><![CDATA[{$template->cost_paid_by}]]></ShippingCostPaidByOption>
            </ReturnPolicy>
            {$this->getPaymentXml()}
            {$this->getShippingXml()}
            {$this->getPictureDetailsXml()}
            {$this->getFeaturesXml()}
            {$this->getProductOptionsXml()}
            {$this->getAdditionalXml()}
        </Item>
XML;
    }