Beispiel #1
0
 public function __construct($params)
 {
     $this->ebay = \Bitrix\Sale\TradingPlatform\Ebay\Ebay::getInstance();
     if (!$this->ebay->isActive()) {
         throw new SystemException("Ebay is not active!" . __METHOD__);
     }
     if (!isset($params["SITE_ID"]) || strlen($params["SITE_ID"]) <= 0) {
         throw new ArgumentNullException("SITE_ID");
     }
     $this->siteId = $params["SITE_ID"];
     if (!\Bitrix\Main\Loader::includeModule('catalog')) {
         throw new SystemException("Can't include module \"Catalog\"! " . __METHOD__);
     }
     $iBlockIds = $this->getIblockIds();
     if (empty($iBlockIds)) {
         throw new SystemException("Can't find iblocks ids! " . __METHOD__);
     }
     foreach ($iBlockIds as $iblockId) {
         $this->productFeeds[] = \Bitrix\Catalog\ExportOfferCreator::getOfferObject(array("IBLOCK_ID" => $iblockId, "PRODUCT_GROUPS" => $this->getMappedGroups($iblockId), "XML_DATA" => $this->getXmlData(), "SETUP_SERVER_NAME" => $this->getDomainName()));
     }
 }
Beispiel #2
0
if (empty($arRunErrors)) {
    CheckDirPath($_SERVER["DOCUMENT_ROOT"] . $SETUP_FILE_NAME);
    if (!($fp = @fopen($_SERVER["DOCUMENT_ROOT"] . $SETUP_FILE_NAME, "wb"))) {
        $arRunErrors[] = str_replace('#FILE#', $_SERVER["DOCUMENT_ROOT"] . $SETUP_FILE_NAME, GetMessage('EBAY_ERR_FILE_OPEN_WRITING'));
    } else {
        if (!@fwrite($fp, '<?xml version="1.0" encoding="utf-8"?>')) {
            $arRunErrors[] = str_replace('#FILE#', $_SERVER["DOCUMENT_ROOT"] . $SETUP_FILE_NAME, GetMessage('EBAY_ERR_SETUP_FILE_WRITE'));
            @fclose($fp);
        } else {
            @fwrite($fp, "\n<ListingArray>\n");
        }
    }
}
if (empty($arRunErrors)) {
    try {
        $offers = \Bitrix\Catalog\ExportOfferCreator::getOfferObject(array("IBLOCK_ID" => $IBLOCK_ID, "PRODUCT_GROUPS" => $V, "XML_DATA" => $XML_DATA, "SETUP_SERVER_NAME" => $SETUP_SERVER_NAME));
    } catch (SystemException $e) {
        $arRunErrors[] = $e->getMessage();
    }
    foreach ($offers as $offerId => $offer) {
        $strXmlProduct = "\t<Listing>\n";
        $strXmlProduct .= "\t\t<Product>\n";
        $strXmlProduct .= "\t\t\t<SKU>" . $offer["PROPERTIES"]["ARTNUMBER"]["VALUE"] . "</SKU>\n";
        $strXmlProduct .= "\t\t\t<ProductInformation>\n";
        $strXmlProduct .= "\t\t\t\t<Title>" . $offer["NAME"] . "</Title>\n";
        $strXmlProduct .= "\t\t\t\t<Description>\n";
        $strXmlProduct .= "\t\t\t\t\t<ProductDescription><![CDATA[" . $offer["DESCRIPTION"] . "!]]</ProductDescription>\n";
        $strXmlProduct .= "\t\t\t\t</Description>\n";
        $strXmlProduct .= "\t\t\t\t<PictureUrls>\n";
        $strXmlProduct .= "\t\t\t\t<PictureUrl>" . (strlen($offer["DETAIL_PICTURE"]) > 0 ? $offer["DETAIL_PICTURE"] : $offer["PREVIEW_PICTURE"]) . "</PictureUrl>\n";
        $strXmlProduct .= "\t\t\t\t\t</PictureUrls>\n";