1
0
mirror of synced 2024-11-22 05:16:09 +03:00

bug fix ICMLLoader.php

This commit is contained in:
m.korolev 2013-08-19 15:14:36 +04:00
parent 6bb71edd15
commit 2a66f0a67b

View File

@ -9,43 +9,13 @@ class ICMLLoader {
public $encoding = 'utf-8';
protected $fp;
public static function AgentLoad3( $filename)
{
echo $filename;
$arFilename = "'" . $filename . "'";
return "ICMLLoader::AgentLoad( " . $arFilename . ");";
}
public static function AgentLoad($iblocks, $filename)
{
if (!CModule::IncludeModule("iblock")) {
//handle err
self::eventLog('ICMLLoader::AgentLoad', 'iblock', 'module not found');
return true;
}
if (!CModule::IncludeModule("catalog")) {
//handle err
self::eventLog('ICMLLoader::AgentLoad', 'catalog', 'module not found');
return true;
}
global $APPLICATION, $USER;
if(!isset($USER)) {
$USER = new CUser;
}
$loader = new ICMLLoader();
$loader->iblocks = json_decode($iblocks, true);
$loader->filename = $filename;
$loader->application = $APPLICATION;
$loader->Load();
$arIblocks = "'" . $iblocks . "'";
$arFilename = "'" . $filename . "'";
return "ICMLLoader::AgentLoad(" . $arIblocks . ", " . $arFilename . ");";
}
public function Load()
{
global $USER;
if(!isset($USER))
$USER = new CUser;
$categories = $this->GetCategories();
$offers = $this->GetOffers();
@ -297,8 +267,6 @@ class ICMLLoader {
}
$offer .= "<name>" . $this->PrepareValue($arOffer["NAME"]) . "</name>\n";
$offer .= "<description>" . (strip_tags( html_entity_decode(str_replace("&nbsp;", ' ', $this->PrepareValue($arOffer["DETAIL_TEXT"]))))) ."</description>\n";
$offer .= "<xmlId>" . $this->PrepareValue($arOffer["EXTERNAL_ID"]) . "</xmlId>\n";
$offer .= "<productName>" . $this->PrepareValue($arOffer["PRODUCT_NAME"]) . "</productName>\n";