Пример #1
1
function catalog_offer_mutator_1c(&$arLoadOffer, &$xOfferNode)
{
    global $arProperties;
    $sQuantity = $arLoadOffer['QUANTITY'];
    $newQuanity = 0;
    $priceTypeId = '';
    if ($obPrice = $xOfferNode->SelectNodes('/Цены/Цена/ИдТипаЦены')) {
        $priceTypeId = $obPrice->textContent();
        if ($priceTypeId != '') {
            $Store = new CCatalogStore();
            $storeProd = new CCatalogStoreProduct();
            $rsStore = $Store->GetList(array(), array('XML_ID' => $priceTypeId), false, false, array('*'));
            if ($arStore = $rsStore->Fetch()) {
                $storeId = $arStore['ID'];
            } else {
                $arFields = array("TITLE" => 'Store_' . $priceTypeId, "ACTIVE" => 'Y', "ADDRESS" => '-', "XML_ID" => $priceTypeId);
                $storeId = CCatalogStore::Add($arFields);
            }
            $storeProd->Add(array("PRODUCT_ID" => $arLoadOffer['ID'], "STORE_ID" => $storeId, "AMOUNT" => $sQuantity));
            $rsStoreProd = $storeProd->GetList(array(), array('PRODUCT_ID' => $arLoadOffer['ID']), false, false, array('AMOUNT'));
            while ($arStore = $rsStoreProd->Fetch()) {
                $newQuanity = $newQuanity + $arStore['AMOUNT'];
            }
            if ($newQuanity > 0) {
                $arLoadOffer['QUANTITY'] = $newQuanity;
            }
        }
    }
    return $arLoadOffer;
}
Пример #2
0
 /** Add new store in table b_catalog_store,
  * @static
  * @param $arFields
  * @return bool|int
  */
 static function Add($arFields)
 {
     /** @global CDataBase $DB */
     global $DB;
     if (!CBXFeatures::IsFeatureEnabled('CatMultiStore')) {
         $dbResultList = CCatalogStore::GetList(array());
         if ($arResult = $dbResultList->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("CS_ALREADY_HAVE_STORE"));
             return false;
         }
     }
     if (array_key_exists('DATE_CREATE', $arFields)) {
         unset($arFields['DATE_CREATE']);
     }
     if (array_key_exists('DATE_MODIFY', $arFields)) {
         unset($arFields['DATE_MODIFY']);
     }
     $arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
     $arFields['~DATE_CREATE'] = $DB->GetNowFunction();
     if (!self::CheckFields('ADD', $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_catalog_store", $arFields);
     $strSql = "INSERT INTO b_catalog_store (" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
     $res = $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (!$res) {
         return false;
     }
     $lastId = intval($DB->LastID());
     return $lastId;
 }
Пример #3
0
 /**
  * Loads values from database.
  * Returns true on success.
  *
  * @return boolean
  */
 protected function loadFromDatabase()
 {
     if (!isset($this->fields) && $this->id > 0) {
         $storeList = \CCatalogStore::getList(array(), array("ID" => $this->id), false, false, array("ID", "TITLE"));
         $this->fields = $storeList->fetch();
     }
     return is_array($this->fields);
 }
Пример #4
0
 protected function load()
 {
     $storeList = \CCatalogStore::getList(array(), array("ACTIVE" => "Y"), false, false, array("ID", "TITLE", "ACTIVE"));
     $result = array();
     while ($ar = $storeList->fetch()) {
         $result[] = $ar["TITLE"];
     }
     return $result;
 }
Пример #5
0
 static function Update($id, $arFields)
 {
     global $DB;
     $id = intval($id);
     if (0 >= $id) {
         return false;
     }
     foreach (GetModuleEvents("catalog", "OnBeforeCatalogStoreUpdate", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($id, &$arFields)) === false) {
             return false;
         }
     }
     $bNeedConversion = false;
     if (array_key_exists('DATE_CREATE', $arFields)) {
         unset($arFields['DATE_CREATE']);
     }
     if (array_key_exists('DATE_MODIFY', $arFields)) {
         unset($arFields['DATE_MODIFY']);
     }
     if (array_key_exists('DATE_STATUS', $arFields)) {
         unset($arFields['DATE_STATUS']);
     }
     if (array_key_exists('CREATED_BY', $arFields)) {
         unset($arFields['CREATED_BY']);
     }
     $arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
     $dbStore = CCatalogStore::GetList(array(), array("ID" => $id), false, false, array("ACTIVE"));
     if ($arStore = $dbStore->Fetch()) {
         if ($arStore["ACTIVE"] != $arFields["ACTIVE"]) {
             $bNeedConversion = true;
         }
     }
     if ($id <= 0 || !self::CheckFields('UPDATE', $arFields)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_store", $arFields);
     if (!empty($strUpdate)) {
         $strSql = "update b_catalog_store set " . $strUpdate . " where ID = " . $id;
         if (!$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
             return false;
         }
         CCatalogStoreControlUtil::clearStoreName($id);
     }
     if ($bNeedConversion) {
         self::recalculateStoreBalances($id);
     }
     foreach (GetModuleEvents("catalog", "OnCatalogStoreUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($id, $arFields));
     }
     return $id;
 }
Пример #6
0
 protected static function getStoresList($nameOnly = true, $siteId = "")
 {
     if (!\Bitrix\Main\Loader::includeModule('catalog')) {
         return array();
     }
     $filter = array("ACTIVE" => "Y", "ISSUING_CENTER" => "Y");
     if (strlen($siteId) > 0) {
         $filter["+SITE_ID"] = $siteId;
     }
     $result = array();
     $dbList = \CCatalogStore::GetList(array("SORT" => "ASC", "TITLE" => "ASC"), $filter, false, false, array("ID", "SITE_ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "LOCATION_ID", "GPS_N", "GPS_S"));
     while ($store = $dbList->Fetch()) {
         if ($nameOnly) {
             $result[$store["ID"]] = $store["TITLE"] . (strlen($store["SITE_ID"]) > 0 ? " [" . $store["SITE_ID"] . "]" : "");
         } else {
             $result[$store["ID"]] = $store;
         }
     }
     return $result;
 }
Пример #7
0
 static function Update($id, $arFields)
 {
     global $DB;
     $id = intval($id);
     $bNeedConversion = false;
     if (array_key_exists('DATE_CREATE', $arFields)) {
         unset($arFields['DATE_CREATE']);
     }
     if (array_key_exists('DATE_MODIFY', $arFields)) {
         unset($arFields['DATE_MODIFY']);
     }
     if (array_key_exists('DATE_STATUS', $arFields)) {
         unset($arFields['DATE_STATUS']);
     }
     if (array_key_exists('CREATED_BY', $arFields)) {
         unset($arFields['CREATED_BY']);
     }
     $arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
     $dbStore = CCatalogStore::GetList(array(), array("ID" => $id), false, false, array("ACTIVE"));
     if ($arStore = $dbStore->Fetch()) {
         if ($arStore["ACTIVE"] != $arFields["ACTIVE"]) {
             $bNeedConversion = true;
         }
     }
     if ($id <= 0 || !self::CheckFields('UPDATE', $arFields)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_catalog_store", $arFields);
     if (!empty($strUpdate)) {
         $strSql = "UPDATE b_catalog_store SET " . $strUpdate . " WHERE ID = " . $id . " ";
         if (!$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
             return false;
         }
     }
     if ($bNeedConversion) {
         self::recalculateStoreBalances($id);
     }
     return $id;
 }
Пример #8
0
 /** Add new store in table b_catalog_store,
  * @static
  * @param $arFields
  * @return bool|int
  */
 static function Add($arFields)
 {
     /** @global CDataBase $DB */
     global $DB;
     if (!CBXFeatures::IsFeatureEnabled('CatMultiStore')) {
         $dbResultList = CCatalogStore::GetList(array(), array(), false, array('NAV_PARAMS' => array("nTopCount" => "1")), array("ID"));
         if ($arResult = $dbResultList->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("CS_ALREADY_HAVE_STORE"));
             return false;
         }
     }
     foreach (GetModuleEvents("catalog", "OnBeforeCatalogStoreAdd", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
             return false;
         }
     }
     if (array_key_exists('DATE_CREATE', $arFields)) {
         unset($arFields['DATE_CREATE']);
     }
     if (array_key_exists('DATE_MODIFY', $arFields)) {
         unset($arFields['DATE_MODIFY']);
     }
     $arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
     $arFields['~DATE_CREATE'] = $DB->GetNowFunction();
     if (!self::CheckFields('ADD', $arFields)) {
         return false;
     }
     $arInsert = $DB->PrepareInsert("b_catalog_store", $arFields);
     $strSql = "INSERT INTO b_catalog_store (" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
     $res = $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (!$res) {
         return false;
     }
     $lastId = intval($DB->LastID());
     foreach (GetModuleEvents("catalog", "OnCatalogStoreAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($lastId, $arFields));
     }
     return $lastId;
 }
Пример #9
0
 private static function getCatalogStores()
 {
     if (!isset(self::$catalogStoreCache)) {
         self::$catalogStoreCache = array();
         if (self::$catalogIncluded === null) {
             self::$catalogIncluded = Loader::includeModule('catalog');
         }
         if (self::$catalogIncluded) {
             $storeCount = 0;
             $maxStores = (int) COption::GetOptionString("iblock", "seo_max_stores");
             $rsStore = CCatalogStore::GetList(array('SORT' => 'ASC'), array(), false, false, array('ID', 'TITLE', 'ADDRESS'));
             while ($store = $rsStore->Fetch()) {
                 self::$catalogStoreCache[$storeCount] = $store;
                 $storeCount++;
                 if ($maxStores > 0 && $storeCount >= $maxStores) {
                     break;
                 }
             }
         }
     }
     return self::$catalogStoreCache;
 }
Пример #10
0
 /** By store ID, returns its title and\or address.
  * @param $storeId
  * @return string
  */
 public static function getStoreName($storeId)
 {
     static $dbStore = '';
     static $arStores = array();
     if ($storeId <= 0) {
         return '';
     }
     $storeName = '';
     if ($dbStore == '') {
         $dbStore = CCatalogStore::GetList(array(), array("ACTIVE" => "Y"));
     }
     if (empty($arStores)) {
         while ($arStore = $dbStore->Fetch()) {
             $arStores[] = $arStore;
         }
     }
     foreach ($arStores as $arStore) {
         if ($arStore["ID"] == $storeId) {
             $storeName = $arStore["ADDRESS"];
             $storeName = $arStore["TITLE"] !== '' ? $arStore["TITLE"] . " (" . $storeName . ") " : $storeName;
         }
     }
     return $storeName;
 }
Пример #11
0
					}

					endif;
				$tabControl->EndCustomField("ORDER_DELIVERY", '');

				$tabControl->BeginCustomField("STORE_DELIVERY", GetMessage("SOD_STORE_SEND"));
				if (intval($arOrder["STORE_ID"]) > 0):
				?>
					<tr>
						<td width="40%"><?echo $tabControl->GetCustomLabelHTML()?>:</td>
						<td>
							<?
							$dbList = CCatalogStore::GetList(
								array("SORT" => "DESC", "ID" => "DESC"),
								array("ACTIVE" => "Y", "ID" => $arOrder["STORE_ID"]),
								false,
								false,
								array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "LOCATION_ID", "GPS_N", "GPS_S")
							);
							if ($arList = $dbList->Fetch()):
							?>
								<div><?php 
echo htmlspecialcharsbx($arList["TITLE"]);
?>
</div>
							<?else:?>
								<div<?php 
echo GetMessage('SOD_STORE_SEND_NULL');
?>
></div>
							<?endif;?>
Пример #12
0
 function ImportStoresAmount($arElement, $elementID, &$counter)
 {
     $arFields = array();
     $arFields['PRODUCT_ID'] = $elementID;
     static $arStoreResult = false;
     if ($arStoreResult === false) {
         $arStoreResult = array();
         $resStore = CCatalogStore::GetList(array(), array(), false, false, array("ID", "XML_ID"));
         while ($arStore = $resStore->Fetch()) {
             $arStoreResult[$arStore["XML_ID"]] = $arStore["ID"];
         }
     }
     foreach ($arElement as $xmlID => $amount) {
         if (isset($arStoreResult[$xmlID])) {
             $arFields['STORE_ID'] = $arStoreResult[$xmlID];
             $arFields['AMOUNT'] = $amount;
             $res = CCatalogStoreProduct::UpdateFromForm($arFields);
             if (!$res) {
                 $counter["ERR"]++;
             }
         }
     }
     return true;
 }
Пример #13
0
     $arDelivery["DESCRIPTION"] = htmlspecialcharsbx($arDeliveryDescription["DESCRIPTION"]);
     $arDeliveryAll[] = $arDelivery;
     if (!empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false) {
         if (IntVal($arUserResult["DELIVERY_ID"]) == IntVal($arDelivery["ID"])) {
             $bFound = true;
         }
     }
     if (IntVal($arUserResult["DELIVERY_ID"]) == IntVal($arDelivery["ID"])) {
         $arResult["DELIVERY_PRICE"] = roundEx(CCurrencyRates::ConvertCurrency($arDelivery["PRICE"], $arDelivery["CURRENCY"], $arResult["BASE_LANG_CURRENCY"]), SALE_VALUE_PRECISION);
     }
 }
 if (!$bFound && !empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false) {
     $arUserResult["DELIVERY_ID"] = "";
 }
 $arStore = array();
 $dbList = CCatalogStore::GetList(array("SORT" => "DESC", "ID" => "DESC"), array("ACTIVE" => "Y", "ID" => $arStoreId, "ISSUING_CENTER" => "Y", "+SITE_ID" => SITE_ID), false, false, array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "GPS_N", "GPS_S", "ISSUING_CENTER", "SITE_ID"));
 while ($arStoreTmp = $dbList->Fetch()) {
     if ($arStoreTmp["IMAGE_ID"] > 0) {
         $arStoreTmp["IMAGE_ID"] = CFile::GetFileArray($arStoreTmp["IMAGE_ID"]);
     }
     $arStore[$arStoreTmp["ID"]] = $arStoreTmp;
 }
 $arResult["STORE_LIST"] = $arStore;
 if (!$bFound && !empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false) {
     $arUserResult["DELIVERY_ID"] = "";
 }
 foreach ($arDeliveryAll as $arDelivery) {
     if (count($arP2D[$arUserResult["PAY_SYSTEM_ID"]]) <= 0 || in_array($arDelivery["ID"], $arP2D[$arUserResult["PAY_SYSTEM_ID"]])) {
         $arDelivery["FIELD_NAME"] = "DELIVERY_ID";
         if (IntVal($arUserResult["DELIVERY_ID"]) == IntVal($arDelivery["ID"])) {
             $arDelivery["CHECKED"] = "Y";
Пример #14
0
	public static function GetInheritedPropertyTemplateElementMenuItems($iblock_id, $action_function, $menuID, $inputID = "")
	{
		$result = array();
		$result["this"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT"),
			"MENU" => array(
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_NAME"),
					"ONCLICK" => "$action_function('{=this.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_LOWER_NAME"),
					"ONCLICK" => "$action_function('{=lower this.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_CODE"),
					"ONCLICK" => "$action_function('{=this.Code}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_PREVIEW_TEXT"),
					"ONCLICK" => "$action_function('{=this.PreviewText}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_DETAIL_TEXT"),
					"ONCLICK" => "$action_function('{=this.DetailText}', '$menuID', '$inputID')",
				),
			),
		);
		if ($iblock_id > 0)
		{
			$result["properties"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_PROPERTIES"),
				"MENU" => array(
				),
			);
			$rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $iblock_id));
			while($property = $rsProperty->fetch())
			{
				if ($property["PROPERTY_TYPE"] != "F")
				{
					$result["properties"]["MENU"][] = array(
						"TEXT" => $property["NAME"],
						"ONCLICK" => "$action_function('{=this.property.".($property["CODE"]!=""? $property["CODE"]: $property["ID"])."}', '$menuID', '$inputID')",
					);
				}
			}
		}
		$result["parent"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT"),
			"MENU" => array(
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_NAME"),
					"ONCLICK" => "$action_function('{=parent.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_CODE"),
					"ONCLICK" => "$action_function('{=parent.Code}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_TEXT"),
					"ONCLICK" => "$action_function('{=parent.PreviewText}', '$menuID', '$inputID')",
				),
			),
		);
		$result["iblock"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK"),
			"MENU" => array(
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_NAME"),
					"ONCLICK" => "$action_function('{=iblock.Name}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_CODE"),
					"ONCLICK" => "$action_function('{=iblock.Code}', '$menuID', '$inputID')",
				),
				array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_TEXT"),
					"ONCLICK" => "$action_function('{=iblock.PreviewText}', '$menuID', '$inputID')",
				),
			),
		);
		if (\Freetrix\Main\Loader::includeModule('catalog'))
		{
			$arCatalog = \CCatalogSKU::GetInfoByProductIBlock($iblock_id);
			if (is_array($arCatalog))
			{
				$result["sku_properties"] = array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_SKU_PROPERTIES"),
					"MENU" => array(
					),
				);
				$rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $arCatalog["IBLOCK_ID"]));
				while($property = $rsProperty->fetch())
				{
					if ($property["PROPERTY_TYPE"] != "F")
					{
						$result["sku_properties"]["MENU"][] = array(
							"TEXT" => $property["NAME"],
							"ONCLICK" => "$action_function('{=concat {=distinct this.catalog.sku.property.".($property["CODE"]!=""? $property["CODE"]: $property["ID"])." \", \"}}', '$menuID', '$inputID')",
						);
					}
				}
				$result["sku_price"] = array(
					"TEXT" => GetMessage("IB_COMPLIB_POPUP_SKU_PRICE"),
					"MENU" => array(),
				);
				$rsPrice = CCatalogGroup::GetListEx(array("SORT"=>"ASC"), array(), false, false, array("ID", "NAME"));
				while ($price = $rsPrice->Fetch())
				{
					if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"]))
					{
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MIN_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=min this.catalog.sku.price.".$price["NAME"]."}', '$menuID', '$inputID')",
						);
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MAX_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=max this.catalog.sku.price.".$price["NAME"]."}', '$menuID', '$inputID')",
						);
					}
					else
					{
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MIN_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=min this.catalog.sku.price.".$price["ID"]."}', '$menuID', '$inputID')",
						);
						$result["sku_price"]["MENU"][] = array(
							"TEXT" => GetMessage("IB_COMPLIB_POPUP_MAX_PRICE")." ".$price["NAME"],
							"ONCLICK" => "$action_function('{=max this.catalog.sku.price.".$price["ID"]."}', '$menuID', '$inputID')",
						);
					}
				}
			}

			$result["catalog"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG"),
				"MENU" => array(
					array(
						"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG_WEIGHT"),
						"ONCLICK" => "$action_function('{=this.catalog.weight}', '$menuID', '$inputID')",
					),
					array(
						"TEXT" => GetMessage("IB_COMPLIB_POPUP_CATALOG_MEASURE"),
						"ONCLICK" => "$action_function('{=this.catalog.measure}', '$menuID', '$inputID')",
					),
				),
			);
			$result["price"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_PRICE"),
				"MENU" => array(),
			);
			$rsPrice = CCatalogGroup::GetListEx(array("SORT"=>"ASC"), array(), false, false, array("ID", "NAME"));
			while ($price = $rsPrice->Fetch())
			{
				if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"]))
					$result["price"]["MENU"][] = array(
						"TEXT" => $price["NAME"],
						"ONCLICK" => "$action_function('{=this.catalog.price.".$price["NAME"]."}', '$menuID', '$inputID')",
					);
				else
					$result["price"]["MENU"][] = array(
						"TEXT" => $price["NAME"],
						"ONCLICK" => "$action_function('{=this.catalog.price.".$price["ID"]."}', '$menuID', '$inputID')",
					);
			}
			$result["store"] = array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_STORE"),
				"MENU" => array(),
			);
			$rsStore = CCatalogStore::GetList();
			while ($store = $rsStore->Fetch())
			{
				$result["store"]["MENU"][] = array(
					"TEXT" => $store["TITLE"],
					"ONCLICK" => "$action_function('{=catalog.store.".$store["ID"].".name}', '$menuID', '$inputID')",
				);
			}
		}
		$result["misc"] = array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_MISC"),
			"MENU" => array(),
		);
		$result["misc"]["MENU"][] =  array(
			"TEXT" => GetMessage("IB_COMPLIB_POPUP_SECTIONS_PATH"),
			"ONCLICK" => "$action_function('{=concat this.sections.name \" / \"}', '$menuID', '$inputID')",
		);
		if (\Freetrix\Main\Loader::includeModule('catalog'))
		{
			$result["misc"]["MENU"][] =  array(
				"TEXT" => GetMessage("IB_COMPLIB_POPUP_STORE_LIST"),
				"ONCLICK" => "$action_function('{=concat catalog.store \", \"}', '$menuID', '$inputID')",
			);
		}
		$r = array();
		foreach($result as $category)
		{
			if (!empty($category) && !empty($category["MENU"]))
			{
				$r[] = $category;
			}
		}
		return $r;
	}
Пример #15
0
                            if (isset(${"CAT_USER_GROUP_ID_" . $arGroup["ID"]}) && ${"CAT_USER_GROUP_ID_" . $arGroup["ID"]} == "Y") {
                                if (IntVal(${"CAT_ACCESS_LENGTH_" . $arGroup["ID"]}) != IntVal($arCurProductGroups[$arGroup["ID"]]["ACCESS_LENGTH"]) || ${"CAT_ACCESS_LENGTH_TYPE_" . $arGroup["ID"]} != $arCurProductGroups[$arGroup["ID"]]["ACCESS_LENGTH_TYPE"]) {
                                    $arCatalogFields = array("ACCESS_LENGTH" => IntVal(${"CAT_ACCESS_LENGTH_" . $arGroup["ID"]}), "ACCESS_LENGTH_TYPE" => ${"CAT_ACCESS_LENGTH_TYPE_" . $arGroup["ID"]});
                                    CCatalogProductGroups::Update($arCurProductGroups[$arGroup["ID"]]["ID"], $arCatalogFields);
                                }
                            } else {
                                CCatalogProductGroups::Delete($arCurProductGroups[$arGroup["ID"]]["ID"]);
                            }
                        } else {
                            if (isset(${"CAT_USER_GROUP_ID_" . $arGroup["ID"]}) && ${"CAT_USER_GROUP_ID_" . $arGroup["ID"]} == "Y") {
                                $arCatalogFields = array("PRODUCT_ID" => $ID, "GROUP_ID" => $arGroup["ID"], "ACCESS_LENGTH" => IntVal(${"CAT_ACCESS_LENGTH_" . $arGroup["ID"]}), "ACCESS_LENGTH_TYPE" => ${"CAT_ACCESS_LENGTH_TYPE_" . $arGroup["ID"]});
                                CCatalogProductGroups::Add($arCatalogFields);
                            }
                        }
                    }
                }
                if ($USER->CanDoOperation('catalog_store')) {
                    $rsStores = CCatalogStore::GetList(array(), array('ACTIVE' => 'Y'), false, false, array('ID'));
                    while ($arStore = $rsStores->Fetch()) {
                        if (isset($_POST['AR_AMOUNT'][$arStore['ID']])) {
                            $arStoreProductFields = array("PRODUCT_ID" => $ID, "STORE_ID" => $arStore['ID'], "AMOUNT" => $_POST['AR_AMOUNT'][$arStore['ID']]);
                            if (!CCatalogStoreProduct::UpdateFromForm($arStoreProductFields)) {
                                $bVarsFromForm = true;
                            }
                        }
                    }
                }
            }
        }
    }
}
Пример #16
0
			while($arAllSkuElements = $dbAllSkuElements->fetch())
			{
				$arSkuElements[] = $arAllSkuElements;
			}
		}
		foreach($arSkuElements as $skuId)
		{
			if(isset($skuId["ID"]))
				$arResultSkuId[] = $skuId["ID"];
		}
		if(!empty($arResultSkuId))
			$arParams["ELEMENT_ID"] = $arResultSkuId;
		$arResult["IS_SKU"] = true;


		$rsProps = CCatalogStore::GetList(array('TITLE' => 'ASC', 'ID' => 'ASC'), array('ACTIVE' => 'Y', "PRODUCT_ID" => $arParams["ELEMENT_ID"], "+SITE_ID" => SITE_ID, "ISSUING_CENTER" => 'Y'), false, false, $arSelect);
		while($arProp = $rsProps->GetNext())
		{
			$amount = (is_null($arProp["PRODUCT_AMOUNT"])) ? 0 : $arProp["PRODUCT_AMOUNT"];
			$storeURL = CComponentEngine::MakePathFromTemplate($arParams["STORE_PATH"], array("store_id" => $arProp["ID"]));

			if($arProp["TITLE"] == '' && $arProp["ADDRESS"] != '')
				$storeName = $arProp["ADDRESS"];
			elseif($arProp["ADDRESS"] == '' && $arProp["TITLE"] != '')
				$storeName = $arProp["TITLE"];
			else
				$storeName = $arProp["TITLE"]." (".$arProp["ADDRESS"].")";

			if($arParams["USE_STORE_PHONE"] == 'Y' && $arProp["PHONE"] != '')
				$storePhone = $arProp["PHONE"];
			else
Пример #17
0
				$arDelivery["DESCRIPTION"] = htmlspecialcharsbx($arDeliveryDescription["DESCRIPTION"]);

				$arDeliveryAll[] = $arDelivery;

				if(!empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false)
				{
					if(IntVal($arUserResult["DELIVERY_ID"]) == IntVal($arDelivery["ID"]))
						$bFound = true;
				}
			}

			$arStore = array();
			$dbList = CCatalogStore::GetList(
					array("ID" => "DESC"),
					array("ACTIVE" => "Y", "ID" => $arStoreId),
					false,
					false,
					array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "GPS_N", "GPS_S")
				);
			while ($arStoreTmp = $dbList->Fetch())
			{
				if ($arStoreTmp["IMAGE_ID"] > 0)
					$arStoreTmp["IMAGE_ID"] = CFile::GetFileArray($arStoreTmp["IMAGE_ID"]);

				$arStore[$arStoreTmp["ID"]] = $arStoreTmp;
			}

			$arResult["STORE_LIST"] = $arStore;

			if(!$bFound && !empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") === false)
				$arUserResult["DELIVERY_ID"] = "";
Пример #18
0
                    } else {
                        $lAdmin->AddGroupError(GetMessage("ERROR_DELETING_TYPE"), $ID);
                    }
                }
                $DB->Commit();
                break;
        }
    }
}
$arSelect = array("ID", "ACTIVE", "TITLE", "ADDRESS", "DESCRIPTION", "GPS_N", "GPS_S", "IMAGE_ID", "PHONE", "SCHEDULE", "XML_ID", "DATE_MODIFY", "DATE_CREATE", "USER_ID", "MODIFIED_BY");
if (array_key_exists("mode", $_REQUEST) && $_REQUEST["mode"] == "excel") {
    $arNavParams = false;
} else {
    $arNavParams = array("nPageSize" => CAdminResult::GetNavSize($sTableID));
}
$dbResultList = CCatalogStore::GetList(array($_REQUEST["by"] => $_REQUEST["order"]), array(), false, $arNavParams, $arSelect);
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("group_admin_nav")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "TITLE", "content" => GetMessage("TITLE"), "sort" => "TITLE", "default" => true), array("id" => "ACTIVE", "content" => GetMessage("STORE_ACTIVE"), "sort" => "ACTIVE_FLAG", "default" => true), array("id" => "ADDRESS", "content" => GetMessage("ADDRESS"), "sort" => "ADDRESS", "default" => true), array("id" => "IMAGE_ID", "content" => GetMessage("STORE_IMAGE"), "sort" => "IMAGE_ID", "default" => false), array("id" => "DESCRIPTION", "content" => GetMessage("DESCRIPTION"), "sort" => "DESCRIPTION", "default" => true), array("id" => "GPS_N", "content" => GetMessage("GPS_N"), "sort" => "GPS_N", "default" => false), array("id" => "GPS_S", "content" => GetMessage("GPS_S"), "sort" => "GPS_S", "default" => false), array("id" => "PHONE", "content" => GetMessage("PHONE"), "sort" => "PHONE", "default" => true), array("id" => "SCHEDULE", "content" => GetMessage("SCHEDULE"), "sort" => "SCHEDULE", "default" => true), array("id" => "DATE_MODIFY", "content" => GetMessage("DATE_MODIFY"), "sort" => "DATE_MODIFY", "default" => true), array("id" => "MODIFIED_BY", "content" => GetMessage("MODIFIED_BY"), "sort" => "MODIFIED_BY", "default" => true), array("id" => "DATE_CREATE", "content" => GetMessage("DATE_CREATE"), "sort" => "DATE_CREATE", "default" => false), array("id" => "USER_ID", "content" => GetMessage("USER_ID"), "sort" => "USER_ID", "default" => false)));
$arSelectFields = $lAdmin->GetVisibleHeaderColumns();
if (!in_array('ID', $arSelectFields)) {
    $arSelectFields[] = 'ID';
}
$arSelectFieldsMap = array_fill_keys($arSelectFields, true);
$arUserList = array();
$arUserID = array();
$strNameFormat = CSite::GetNameFormat(true);
$arRows = array();
while ($arSTORE = $dbResultList->Fetch()) {
    $arSTORE['ID'] = intval($arSTORE['ID']);
Пример #19
0
    $arReminder = unserialize($reminder);
    $arSubscribeProd = array();
    $subscribeProd = COption::GetOptionString("sale", "subscribe_prod", "");
    if (strlen($subscribeProd) > 0) {
        $arSubscribeProd = unserialize($subscribeProd);
    }
    $aTabs2 = array();
    foreach ($siteList as $val) {
        $aTabs2[] = array("DIV" => "reminder" . $val["ID"], "TAB" => "[" . $val["ID"] . "] " . $val["NAME"], "TITLE" => "[" . $val["ID"] . "] " . $val["NAME"]);
    }
    $tabControl2 = new CAdminViewTabControl("tabControl2", $aTabs2);
    $tabControl2->Begin();
    foreach ($siteList as $val) {
        $arStores = array();
        if (CModule::IncludeModule("catalog")) {
            $dbStore = CCatalogStore::GetList(array("SORT" => "DESC", "ID" => "ASC"), array("ACTIVE" => "Y", "SHIPPING_CENTER" => "Y", "+SITE_ID" => $val["ID"]));
            while ($arStore = $dbStore->GetNext()) {
                $arStores[] = $arStore;
            }
        }
        $tabControl2->BeginNextTab();
        ?>
				<table cellspacing="5" cellpadding="0" border="0" width="100%" align="center">

					<!-- default store -->
					<?php 
        $deductStore = COption::GetOptionString("sale", "deduct_store_id", "", $val["ID"]);
        $display = count($arStores) > 1 && $valDeductOnDelivery == "Y" ? "table-row" : "none";
        ?>
					<tr class="default_deduct_store_control" style="display:<?php 
        echo $display;
Пример #20
0
     $arResult["IS_SKU"] = false;
 } else {
     if (in_array('COORDINATES', $arParams['FIELDS'])) {
         $arParams['FIELDS'] = array_merge($arParams['FIELDS'], array('GPS_N', 'GPS_S'));
     }
     $select = array_merge(array("ID", "ACTIVE", "PRODUCT_AMOUNT", "TITLE", "TYPE"), $arParams["FIELDS"], $arParams["USER_FIELDS"]);
     foreach ($select as $key => $value) {
         if (empty($value) || $value == 'COORDINATES') {
             unset($select[$key]);
         }
     }
     $filter = array("ACTIVE" => "Y", "PRODUCT_ID" => $arParams["ELEMENT_ID"], "+SITE_ID" => $siteId, "ISSUING_CENTER" => 'Y');
     if (!empty($arParams["STORES"])) {
         $filter["ID"] = $arParams["STORES"];
     }
     $rsProps = CCatalogStore::GetList(array('TITLE' => 'ASC', 'ID' => 'ASC'), $filter, false, false, $select);
     while ($prop = $rsProps->GetNext()) {
         $amount = is_null($prop["PRODUCT_AMOUNT"]) ? 0 : $prop["PRODUCT_AMOUNT"];
         if ($arParams["SHOW_GENERAL_STORE_INFORMATION"] == "Y") {
             $quantity += $amount;
             continue;
         }
         $storeURL = CComponentEngine::MakePathFromTemplate($arParams["STORE_PATH"], array("store_id" => $prop["ID"]));
         if ($prop["TITLE"] == '' && $prop["ADDRESS"] != '') {
             $storeName = $prop["ADDRESS"];
         } elseif ($prop["ADDRESS"] == '' && $prop["TITLE"] != '') {
             $storeName = $prop["TITLE"];
         } else {
             $storeName = $prop["TITLE"] . " (" . $prop["ADDRESS"] . ")";
         }
         if (isset($prop["PHONE"]) && $prop["PHONE"] != '') {
Пример #21
0
 /**
  * Function fetches information about stores in the system, depending on the delivery system.
  * This method should should be called only after obtainDataCachedStatic().
  * @param mixed[] $cached Cached data taken from obtainDataCachedStructure()
  * @return void
  */
 protected function obtainDeliveryStore(&$cached)
 {
     if (empty($this->dbResult["ID"])) {
         return;
     }
     if (!empty($this->dbResult["DELIVERY"]) && strlen($this->dbResult["DELIVERY"]["STORE"]) && $this->useCatalog) {
         $stores = unserialize($this->dbResult["DELIVERY"]["STORE"]);
         if (!empty($stores) && is_array($stores)) {
             $dbStores = CCatalogStore::GetList(array("SORT" => "DESC", "ID" => "DESC"), array("ACTIVE" => "Y", "ID" => $stores, "ISSUING_CENTER" => "Y", "+SITE_ID" => SITE_ID), false, false, array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "GPS_N", "GPS_S", "ISSUING_CENTER", "SITE_ID", "EMAIL"));
             while ($item = $dbStores->Fetch()) {
                 $cached["DELIVERY_STORE_LIST"][$item['ID']] = $item;
             }
         }
     }
 }
Пример #22
0
	function ExportOrders2Xml($arFilter = Array(), $nTopCount = 0, $currency = "", $crmMode = false, $time_limit = 0, $version = false, $arOptions = Array())
	{
		global $DB;
		$count = false;
		if(IntVal($nTopCount) > 0)
			$count = Array("nTopCount" => $nTopCount);
		$bNewVersion = (strlen($version) > 0);
		$bExportFromCrm = (isset($arOptions["EXPORT_FROM_CRM"]) && $arOptions["EXPORT_FROM_CRM"] === "Y");

		if(IntVal($time_limit) > 0)
		{
			//This is an optimization. We assume than no step can take more than one year.
			if($time_limit > 0)
				$end_time = time() + $time_limit;
			else
				$end_time = time() + 365*24*3600; // One year

			//$version
			$lastOrderPrefix = "LAST_ORDER_ID";
			if($crmMode)
			{
				$lastOrderPrefix = md5(serialize($arFilter));
				if(!empty($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && IntVal($nTopCount) > 0)
					$count["nTopCount"] = $count["nTopCount"]+count($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]);
			}
			else
			{
				if(IntVal($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) > 0)
				{
					$arFilter["<ID"] = $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix];
				}
			}
		}

		$arResultStat = array(
			"ORDERS" => 0,
			"CONTACTS" => 0,
			"COMPANIES" => 0,
		);

		$accountNumberPrefix = COption::GetOptionString("sale", "1C_SALE_ACCOUNT_NUMBER_SHOP_PREFIX", "");

		$dbPaySystem = CSalePaySystem::GetList(Array("ID" => "ASC"), Array("ACTIVE" => "Y"), false, false, Array("ID", "NAME", "ACTIVE"));
		while($arPaySystem = $dbPaySystem -> Fetch())
			$paySystems[$arPaySystem["ID"]] = $arPaySystem["NAME"];

		$dbDelivery = CSaleDelivery::GetList(Array("ID" => "ASC"), Array("ACTIVE" => "Y"), false, false, Array("ID", "NAME", "ACTIVE"));
		while($arDelivery = $dbDelivery -> Fetch())
			$delivery[$arDelivery["ID"]] = $arDelivery["NAME"];

		$rsDeliveryHandlers = CSaleDeliveryHandler::GetAdminList(array("SID" => "ASC"));
		while ($arHandler = $rsDeliveryHandlers->Fetch())
		{
			if(is_array($arHandler["PROFILES"]))
			{
				foreach($arHandler["PROFILES"] as $k => $v)
				{
					$delivery[$arHandler["SID"].":".$k] = $v["TITLE"]." (".$arHandler["NAME"].")";
				}
			}
		}

		$arStore = array();
		$arMeasures = array();
		if(CModule::IncludeModule("catalog"))
		{
			$dbList = CCatalogStore::GetList(
				array("SORT" => "DESC", "ID" => "ASC"),
				array("ACTIVE" => "Y", "ISSUING_CENTER" => "Y"),
				false,
				false,
				array("ID", "SORT", "TITLE", "ADDRESS", "DESCRIPTION", "PHONE", "EMAIL", "XML_ID")
			);
			while ($arStoreTmp = $dbList->Fetch())
			{
				if(strlen($arStoreTmp["XML_ID"]) <= 0)
					$arStoreTmp["XML_ID"] = $arStoreTmp["ID"];
				$arStore[$arStoreTmp["ID"]] = $arStoreTmp;
			}

			$dbList = CCatalogMeasure::getList(array(), array(), false, false, array("CODE", "MEASURE_TITLE"));
			while($arList = $dbList->Fetch())
			{
				$arMeasures[$arList["CODE"]] = $arList["MEASURE_TITLE"];
			}
		}
		if(empty($arMeasures))
			$arMeasures[796] = GetMessage("SALE_EXPORT_SHTUKA");

		$dbExport = CSaleExport::GetList();
		while($arExport = $dbExport->Fetch())
		{
			$arAgent[$arExport["PERSON_TYPE_ID"]] = unserialize($arExport["VARS"]);
		}

		$dateFormat = CSite::GetDateFormat("FULL");

		if ($crmMode)
		{
			echo "<"."?xml version=\"1.0\" encoding=\"UTF-8\"?".">\n";

			$arCharSets = array();
			$dbSitesList = CSite::GetList(($b=""), ($o=""));
			while ($arSite = $dbSitesList->Fetch())
				$arCharSets[$arSite["ID"]] = $arSite["CHARSET"];
		}
		else
			echo "<"."?xml version=\"1.0\" encoding=\"windows-1251\"?".">\n";
		?>
		<<?php 
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
 <?php 
echo GetMessage("SALE_EXPORT_SHEM_VERSION");
?>
="<?php 
echo $bNewVersion ? "2.08" : "2.05";
?>
" <?php 
echo GetMessage("SALE_EXPORT_SHEM_DATE_CREATE");
?>
="<?php 
echo date("Y-m-d");
?>
T<?php 
echo date("G:i:s");
?>
" <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
?>
=yyyy-MM-dd; <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
?>
=DT" <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DATETIME");
?>
="<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
?>
=<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_TIME");
?>
; <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
?>
=T" <?php 
echo GetMessage("SALE_EXPORT_DEL_DT");
?>
="T" <?php 
echo GetMessage("SALE_EXPORT_FORM_SUMM");
?>
="<?php 
echo GetMessage("SALE_EXPORT_FORM_CC");
?>
=18; <?php 
echo GetMessage("SALE_EXPORT_FORM_CDC");
?>
=2; <?php 
echo GetMessage("SALE_EXPORT_FORM_CRD");
?>
=." <?php 
echo GetMessage("SALE_EXPORT_FORM_QUANT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_FORM_CC");
?>
=18; <?php 
echo GetMessage("SALE_EXPORT_FORM_CDC");
?>
=2; <?php 
echo GetMessage("SALE_EXPORT_FORM_CRD");
?>
=.">
		<?
		$arOrder = array("ID" => "DESC");
		if ($crmMode)
			$arOrder = array("DATE_UPDATE" => "ASC");

		$arSelect = array(
			"ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "EMP_PAYED_ID", "CANCELED", "DATE_CANCELED",
			"EMP_CANCELED_ID", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "EMP_STATUS_ID",
			"PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "EMP_ALLOW_DELIVERY_ID", "PRICE", "CURRENCY", "DISCOUNT_VALUE",
			"SUM_PAID", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION",
			"ADDITIONAL_INFO", "PS_STATUS", "PS_STATUS_CODE", "PS_STATUS_DESCRIPTION", "PS_STATUS_MESSAGE", "PS_SUM", "PS_CURRENCY", "PS_RESPONSE_DATE",
			"COMMENTS", "TAX_VALUE", "STAT_GID", "RECURRING_ID", "ACCOUNT_NUMBER", "SUM_PAID", "DELIVERY_DOC_DATE", "DELIVERY_DOC_NUM", "TRACKING_NUMBER", "STORE_ID",
			"ID_1C", "VERSION",
		);

		$bCrmModuleIncluded = false;
		if ($bExportFromCrm)
		{
			$arSelect[] = "UF_COMPANY_ID";
			$arSelect[] = "UF_CONTACT_ID";
			if (IsModuleInstalled("crm") && CModule::IncludeModule("crm"))
				$bCrmModuleIncluded = true;
		}

		$dbOrderList = CSaleOrder::GetList($arOrder, $arFilter, false, $count, $arSelect);

		while($arOrder = $dbOrderList->Fetch())
		{
			if ($crmMode)
			{			
				if($bNewVersion && is_array($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && in_array($arOrder["ID"], $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && empty($arFilter["ID"]))
					continue;
				ob_start();
			}

			$arResultStat["ORDERS"]++;

			$agentParams = $arAgent[$arOrder["PERSON_TYPE_ID"]];
			$arProp = Array();
			$arProp["ORDER"] = $arOrder;

			if (IntVal($arOrder["USER_ID"]) > 0)
			{
				$dbUser = CUser::GetByID($arOrder["USER_ID"]);
				if ($arUser = $dbUser->Fetch())
					$arProp["USER"] = $arUser;
			}
			if ($bExportFromCrm)
			{
				$arProp["CRM"] = array();
				$companyID = isset($arOrder["UF_COMPANY_ID"]) ? intval($arOrder["UF_COMPANY_ID"]) : 0;
				$contactID = isset($arOrder["UF_CONTACT_ID"]) ? intval($arOrder["UF_CONTACT_ID"]) : 0;
				if ($companyID > 0)
				{
					$arProp["CRM"]["CLIENT_ID"] = "CRMCO".$companyID;
				}
				else
				{
					$arProp["CRM"]["CLIENT_ID"] = "CRMC".$contactID;
				}

				$clientInfo = array(
					"LOGIN" => "",
					"NAME" => "",
					"LAST_NAME" => "",
					"SECOND_NAME" => ""
				);

				if ($bCrmModuleIncluded)
				{
					if ($companyID > 0)
					{
						$arCompanyFilter = array('=ID' => $companyID);
						$dbCompany = CCrmCompany::GetListEx(
							array(), $arCompanyFilter, false, array("nTopCount" => 1),
							array("TITLE")
						);
						$arCompany = $dbCompany->Fetch();
						unset($dbCompany, $arCompanyFilter);
						if (is_array($arCompany))
						{
							if (isset($arCompany["TITLE"]))
								$clientInfo["NAME"] = $arCompany["TITLE"];
						}
						unset($arCompany);
					}
					else if ($contactID > 0)
					{
						$arContactFilter = array('=ID' => $contactID);
						$dbContact = CCrmContact::GetListEx(
							array(), $arContactFilter, false, array("nTopCount" => 1),
							array("NAME", "LAST_NAME", "SECOND_NAME")
						);
						$arContact = $dbContact->Fetch();
						unset($dbContact, $arContactFilter);
						if (is_array($arContact))
						{
							if (isset($arContact["NAME"]))
								$clientInfo["NAME"] = $arContact["NAME"];
							if (isset($arContact["LAST_NAME"]))
								$clientInfo["LAST_NAME"] = $arContact["LAST_NAME"];
							if (isset($arContact["SECOND_NAME"]))
								$clientInfo["SECOND_NAME"] = $arContact["SECOND_NAME"];
						}
						unset($arContact);
					}
				}

				$arProp["CRM"]["CLIENT"] = $clientInfo;
				unset($clientInfo);
			}
			if(IntVal($arOrder["PAY_SYSTEM_ID"]) > 0)
				$arProp["ORDER"]["PAY_SYSTEM_NAME"] = $paySystems[$arOrder["PAY_SYSTEM_ID"]];
			if(strlen($arOrder["DELIVERY_ID"]) > 0)
				$arProp["ORDER"]["DELIVERY_NAME"] = $delivery[$arOrder["DELIVERY_ID"]];

			$dbOrderPropVals = CSaleOrderPropsValue::GetList(
					array(),
					array("ORDER_ID" => $arOrder["ID"]),
					false,
					false,
					array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE")
				);
			while ($arOrderPropVals = $dbOrderPropVals->Fetch())
			{
				if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX")
				{
					if ($arOrderPropVals["VALUE"] == "Y")
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
					else
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA")
				{
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO")
				{
					$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT")
				{
					$curVal = explode(",", $arOrderPropVals["VALUE"]);
					foreach($curVal as $vm)
					{
						$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $vm);
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .=  ", ".$arVal["NAME"];
					}
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = substr($arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]], 2);
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "LOCATION")
				{
					$arVal = CSaleLocation::GetByID($arOrderPropVals["VALUE"], LANGUAGE_ID);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] =  ($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["REGION_NAME"])<=0) ? "" : " - ").$arVal["REGION_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_CITY"] = $arVal["CITY_NAME"];
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_COUNTRY"] = $arVal["COUNTRY_NAME"];
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_REGION"] = $arVal["REGION_NAME"];
				}
				else
				{
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
				}
			}

			foreach($agentParams as $k => $v)
			{
				if(strpos($k, "REKV_") !== false)
				{
					if(!is_array($v))
					{
						$agent["REKV"][$k] = $v;
					}
					else
					{
						if(strlen($v["TYPE"])<=0)
							$agent["REKV"][$k] = $v["VALUE"];
						else
							$agent["REKV"][$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
					}
				}
				else
				{
					if(!is_array($v))
					{
						$agent[$k] = $v;
					}
					else
					{
						if(strlen($v["TYPE"])<=0)
							$agent[$k] = $v["VALUE"];
						else
							$agent[$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
					}
				}
			}
			?>
			<<?php 
echo GetMessage("SALE_EXPORT_DOCUMENT");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo $arOrder["ID"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_NUMBER");
?>
><?php 
echo $accountNumberPrefix . $arOrder["ACCOUNT_NUMBER"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_NUMBER");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_DATE");
?>
><?php 
echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "YYYY-MM-DD");
?>
</<?php 
echo GetMessage("SALE_EXPORT_DATE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM_ORDER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SELLER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_CURRENCY");
?>
><?php 
echo htmlspecialcharsbx(strlen($currency) > 0 ? substr($currency, 0, 3) : substr($arOrder["CURRENCY"], 0, 3));
?>
</<?php 
echo GetMessage("SALE_EXPORT_CURRENCY");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
				<?
				if($bNewVersion)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_VERSION");
?>
><?php 
echo IntVal($arOrder["VERSION"]) > 0 ? $arOrder["VERSION"] : 0;
?>
</<?php 
echo GetMessage("SALE_EXPORT_VERSION");
?>
>
					<?
					if(strlen($arOrder["ID_1C"]) > 0)
					{
						?><<?php 
echo GetMessage("SALE_EXPORT_ID_1C");
?>
><?php 
echo htmlspecialcharsbx($arOrder["ID_1C"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID_1C");
?>
><?
					}
				}
				if ($crmMode)
				{
					?><DateUpdate><?php 
echo $DB->FormatDate($arOrder["DATE_UPDATE"], $dateFormat, "YYYY-MM-DD HH:MI:SS");
?>
</DateUpdate><?
				}

				$deliveryAdr = CSaleExport::ExportContragents(
					$arOrder, $arProp, $agent, $arResultStat, $bNewVersion,
					$bExportFromCrm ? array("EXPORT_FROM_CRM" => "Y") : array()
				);
				?>
				<<?php 
echo GetMessage("SALE_EXPORT_TIME");
?>
><?php 
echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "HH:MI:SS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TIME");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_COMMENTS");
?>
><?php 
echo htmlspecialcharsbx($arOrder["COMMENTS"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_COMMENTS");
?>
>
				<?
				$dbOrderTax = CSaleOrderTax::GetList(
					array(),
					array("ORDER_ID" => $arOrder["ID"]),
					false,
					false,
					array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE")
				);
				$i=-1;
				$orderTax = 0;
				while ($arOrderTax = $dbOrderTax->Fetch())
				{
					$arOrderTax["VALUE_MONEY"] = roundEx($arOrderTax["VALUE_MONEY"], 2);
					$orderTax += $arOrderTax["VALUE_MONEY"];
					$i++;
					if($i == 0)
						echo "<".GetMessage("SALE_EXPORT_TAXES").">";
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arOrderTax["TAX_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
><?php 
echo $arOrderTax["IS_IN_PRICE"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrderTax["VALUE_MONEY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
					<?
				}
				if($i != -1)
					echo "</".GetMessage("SALE_EXPORT_TAXES").">";
				?>
				<?if(DoubleVal($arOrder["DISCOUNT_VALUE"]) > 0)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_DISCOUNT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["DISCOUNT_VALUE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>false</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
					<?
				}

				$storeBasket = "";
				if(IntVal($arOrder["STORE_ID"]) > 0 && !empty($arStore[$arOrder["STORE_ID"]]))
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_STORIES");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_STORY");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo $arStore[$arOrder["STORE_ID"]]["XML_ID"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["TITLE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["ADDRESS"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_STREET");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["ADDRESS"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_CONTACTS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo $bNewVersion ? GetMessage("SALE_EXPORT_WORK_PHONE_NEW") : GetMessage("SALE_EXPORT_WORK_PHONE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["PHONE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_CONTACTS");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_STORY");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_STORIES");
?>
>
					<?
					/*
					$storeBasket = "				
						<".GetMessage("SALE_EXPORT_STORIES").">
							<".GetMessage("SALE_EXPORT_STORY").">
								<".GetMessage("SALE_EXPORT_ID").">".$arStore[$arOrder["STORE_ID"]]["XML_ID"]."</".GetMessage("SALE_EXPORT_ID").">
								<".GetMessage("SALE_EXPORT_ITEM_NAME").">".htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["TITLE"])."</".GetMessage("SALE_EXPORT_ITEM_NAME").">
							</".GetMessage("SALE_EXPORT_STORY").">
						</".GetMessage("SALE_EXPORT_STORIES").">
						";
					*/
				}
				?>
				<<?php 
echo GetMessage("SALE_EXPORT_ITEMS");
?>
>
				<?
				$dbBasket = CSaleBasket::GetList(
						array("NAME" => "ASC"),
						array("ORDER_ID" => $arOrder["ID"]),
						false,
						false,
						array("ID", "NOTES", "PRODUCT_XML_ID", "CATALOG_XML_ID", "NAME", "PRICE", "QUANTITY", "DISCOUNT_PRICE", "VAT_RATE", "MEASURE_CODE")
					);
				$basketSum = 0;
				$priceType = "";
				$bVat = false;
				$vatRate = 0;
				$vatSum = 0;
				while ($arBasket = $dbBasket->Fetch())
				{
					if(strlen($priceType) <= 0)
						$priceType = $arBasket["NOTES"];
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo htmlspecialcharsbx($arBasket["PRODUCT_XML_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_CATALOG_ID");
?>
><?php 
echo htmlspecialcharsbx($arBasket["CATALOG_XML_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_CATALOG_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arBasket["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<?
						if($bNewVersion)
						{
							if(IntVal($arBasket["MEASURE_CODE"]) <= 0)
								$arBasket["MEASURE_CODE"] = 796;
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
><?php 
echo $arBasket["MEASURE_CODE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
><?php 
echo htmlspecialcharsbx($arMeasures[$arBasket["MEASURE_CODE"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>
							<?
						}
						else
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
 <?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
="796" <?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_SHTUKA");
?>
" <?php 
echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
?>
="<?php 
echo GetMessage("SALE_EXPORT_RCE");
?>
"><?php 
echo GetMessage("SALE_EXPORT_SHT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
>
							<?
						}
						if(DoubleVal($arBasket["DISCOUNT_PRICE"]) > 0)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM_DISCOUNT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arBasket["DISCOUNT_PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
							<?
						}
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
><?php 
echo $arBasket["PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
><?php 
echo $arBasket["QUANTITY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arBasket["PRICE"] * $arBasket["QUANTITY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<?
							$dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "ID" => "ASC"), Array("BASKET_ID" => $arBasket["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")), false, false, array("NAME", "VALUE", "CODE"));
							while($arProp = $dbProp->Fetch())
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arProp["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arProp["VALUE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<?
							}
							?>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
						<?if(DoubleVal($arBasket["VAT_RATE"]) > 0)
						{
							$bVat = true;
							$vatRate = DoubleVal($arBasket["VAT_RATE"]);
							$basketVatSum = (($arBasket["PRICE"] / ($arBasket["VAT_RATE"]+1)) * $arBasket["VAT_RATE"]);
							$vatSum += roundEx($basketVatSum * $arBasket["QUANTITY"], 2);
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
><?php 
echo $arBasket["VAT_RATE"] * 100;
?>
</<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo roundEx($basketVatSum, 2);
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
							<?
						}
						?>
						<?php 
echo $storeBasket;
?>
					</<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
					<?
					$basketSum += $arBasket["PRICE"]*$arBasket["QUANTITY"];
				}

				if(IntVal($arOrder["PRICE_DELIVERY"]) > 0)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>ORDER_DELIVERY</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<?
						if($bNewVersion)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
>796</<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
><?php 
echo htmlspecialcharsbx($arMeasures[796]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>
						<?
						}
						else
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
 <?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
="796" <?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_SHTUKA");
?>
" <?php 
echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
?>
="<?php 
echo GetMessage("SALE_EXPORT_RCE");
?>
"><?php 
echo GetMessage("SALE_EXPORT_SHT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
>
						<?
						}
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
><?php 
echo $arOrder["PRICE_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["PRICE_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
						<?if($bVat)
						{
							$deliveryTax = roundEx((($arOrder["PRICE_DELIVERY"] / ($vatRate+1)) * $vatRate), 2);
							if($orderTax > $vatSum && $orderTax == roundEx($vatSum + $deliveryTax, 2))
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
><?php 
echo $vatRate * 100;
?>
</<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $deliveryTax;
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
								<?
							}
						}
						?>
					</<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
					<?
				}
				?>
				</<?php 
echo GetMessage("SALE_EXPORT_ITEMS");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
					<?if(strlen($arOrder["DATE_PAYED"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_PAID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_PAYED"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["PAY_VOUCHER_NUM"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_NUMBER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["PAY_VOUCHER_NUM"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(IntVal($arOrder["PAY_SYSTEM_ID"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_SYSTEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($paySystems[$arOrder["PAY_SYSTEM_ID"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_SYSTEM_ID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["PAY_SYSTEM_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DATE_ALLOW_DELIVERY"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_ALLOW_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_ALLOW_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DELIVERY_ID"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DELIVERY_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($delivery[$arOrder["DELIVERY_ID"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_PAID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["PAYED"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ALLOW_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["ALLOW_DELIVERY"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_CANCELED");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["CANCELED"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_FINAL_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["STATUS_ID"] == "F" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?$arStatus = CSaleStatus::GetLangByID($arOrder["STATUS_ID"]); echo htmlspecialcharsbx("[".$arOrder["STATUS_ID"]."] ".$arStatus["NAME"]);?></<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_STATUS_ID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["STATUS_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<?if(strlen($arOrder["DATE_CANCELED"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_CANCEL");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_CANCELED"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_CANCEL_REASON");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["REASON_CANCELED"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DATE_STATUS"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_STATUS"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["USER_DESCRIPTION"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_USER_DESCRIPTION");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["USER_DESCRIPTION"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					$dbSite = CSite::GetByID($arOrder["LID"]);
					$arSite = $dbSite->Fetch();
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_SITE_NAME");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>[<?php 
echo $arOrder["LID"];
?>
] <?php 
echo htmlspecialcharsbx($arSite["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<?
					if(!empty($agent["REKV"]))
					{
						foreach($agent["REKV"] as $k => $v)
						{
							if(strlen($agentParams[$k]["NAME"]) > 0 && strlen($v) > 0)
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($agentParams[$k]["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($v);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<?
							}
						}
					}

					if(strlen($deliveryAdr) > 0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DELIVERY_ADDRESS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($deliveryAdr);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>

						<?
					}
					?>
				</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
			</<?php 
echo GetMessage("SALE_EXPORT_DOCUMENT");
?>
>
			<?
			if ($crmMode)
			{
				$c = ob_get_clean();
				$c = CharsetConverter::ConvertCharset($c, $arCharSets[$arOrder["LID"]], "utf-8");
				echo $c;
				$_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix][] = $arOrder["ID"];
			}
			else
			{
				$_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix] = $arOrder["ID"];
			}

			if(IntVal($time_limit) > 0 && time() > $end_time)
			{
				break;
			}
		}
		?>
		</<?php 
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
>
		<?
		return $arResultStat;
	}
Пример #23
0
}
if (!\Bitrix\Main\Loader::includeModule("catalog")) {
    ShowError(GetMessage("CATALOG_MODULE_NOT_INSTALL"));
    return;
}
if (!isset($arParams["CACHE_TIME"])) {
    $arParams["CACHE_TIME"] = 360;
}
$arResult["TITLE"] = GetMessage("SCS_DEFAULT_TITLE");
$arResult["MAP"] = $arParams["MAP_TYPE"];
if (!isset($arParams["PATH_TO_ELEMENT"])) {
    $arParams["PATH_TO_ELEMENT"] = "store/#store_id#";
}
if ($this->StartResultCache()) {
    $arSelect = array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "GPS_N", "GPS_S", "IMAGE_ID", "PHONE", "SCHEDULE");
    $dbStoreProps = CCatalogStore::GetList(array('TITLE' => 'ASC', 'ID' => 'ASC'), array("ACTIVE" => "Y"), false, false, $arSelect);
    $arResult["PROFILES"] = array();
    $viewMap = false;
    while ($arProp = $dbStoreProps->GetNext()) {
        $url = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_ELEMENT"], array("store_id" => $arProp["ID"]));
        if ($arProp["TITLE"] == '' && $arProp["ADDRESS"] != '') {
            $storeName = $arProp["ADDRESS"];
        } elseif ($arProp["ADDRESS"] == '' && $arProp["TITLE"] != '') {
            $storeName = $arProp["TITLE"];
        } else {
            $storeName = $arProp["TITLE"] . " (" . $arProp["ADDRESS"] . ")";
        }
        if ($arParams["PHONE"] == 'Y' && $arProp["PHONE"] != '') {
            $storePhone = $arProp["PHONE"];
        } else {
            $storePhone = null;
Пример #24
0
 public static function GetProductStores($arParams)
 {
     $strUseStoreControl = COption::GetOptionString('catalog', 'default_use_store_control');
     //without store control stores are used for information purposes only and manual deduction won't work
     if ($strUseStoreControl == "N") {
         return false;
     }
     $arResult = array();
     $arStoreID = array();
     if (intval($arParams["PRODUCT_ID"] < 0)) {
         return false;
     }
     $arFilter = array("ACTIVE" => "Y", "SHIPPING_CENTER" => "Y");
     if (isset($arParams["SITE_ID"]) && strlen($arParams["SITE_ID"]) > 0) {
         $arFilter["+SITE_ID"] = $arParams["SITE_ID"];
     }
     $proxyStoresCountKey = md5(join('|', $arFilter));
     if (!($arStoreID = static::getHitCache('CATALOG_STORE', $proxyStoresCountKey))) {
         $dbStoreRes = CCatalogStore::GetList(array("SORT" => "DESC"), $arFilter, false, false, array("ID", "ACTIVE"));
         while ($arStoreRes = $dbStoreRes->Fetch()) {
             $arStoreID[] = $arStoreRes["ID"];
         }
         static::setHitCache('CATALOG_STORE', $proxyStoresCountKey, $arStoreID);
     }
     if (!($arResult = static::getHitCache('CATALOG_STORE_PRODUCT', $arParams["PRODUCT_ID"]))) {
         $dbRes = CCatalogStoreProduct::GetList(array(), array("PRODUCT_ID" => $arParams["PRODUCT_ID"]), false, false, array("STORE_NAME", "STORE_ID", "AMOUNT", "PRODUCT_ID"));
         while ($arRes = $dbRes->Fetch()) {
             if (in_array($arRes["STORE_ID"], $arStoreID)) {
                 if (isset($arParams["ENUM_BY_ID"]) && $arParams["ENUM_BY_ID"] == true) {
                     $arResult[$arRes["STORE_ID"]] = $arRes;
                 } else {
                     $arResult[] = $arRes;
                 }
             }
         }
         if (!empty($arResult) && is_array($arResult)) {
             static::setHitCache('CATALOG_STORE_PRODUCT', $arParams["PRODUCT_ID"], $arResult);
         }
     }
     return $arResult;
 }
Пример #25
0
    echo GetMessage("C2IT_STORE_ADDR");
    ?>
</td>
		<td><?php 
    echo GetMessage("C2IT_PROD_AMOUNT");
    ?>
</td>
		</tr>
	<?php 
    $numStore = 1;
    if ($bCopy) {
        $arSelect = array("ID", "TITLE", "ADDRESS");
        $rsProps = CCatalogStore::GetList(array('SORT' => 'ASC'), array('ACTIVE' => 'Y'), false, false, $arSelect);
    } else {
        $arSelect = array("ID", "TITLE", "ADDRESS", "PRODUCT_AMOUNT");
        $rsProps = CCatalogStore::GetList(array('SORT' => 'ASC'), array("PRODUCT_ID" => $PRODUCT_ID, 'ACTIVE' => 'Y'), false, false, $arSelect);
    }
    while ($arProp = $rsProps->GetNext()) {
        if ($bCopy) {
            $amount = 0;
        } else {
            $amount = is_null($arProp["PRODUCT_AMOUNT"]) ? 0 : $arProp["PRODUCT_AMOUNT"];
        }
        if ($bVarsFromForm && isset($_POST['AR_AMOUNT'][$arProp['ID']])) {
            $amount = $_POST['AR_AMOUNT'][$arProp['ID']];
        }
        $address = '';
        $strNum = $numStore;
        $storeID = '';
        if ($bStore) {
            $storeID = $arProp['ID'];
Пример #26
0
    $catalogView = "list";
}
COption::SetOptionString("eshop", "catalogView", $catalogView, false, WIZARD_SITE_ID);
$useStoreControl = $wizard->GetVar("useStoreControl");
$useStoreControl = $useStoreControl == "Y" ? "Y" : "N";
$curUseStoreControl = COption::GetOptionString("catalog", "default_use_store_control", "N");
COption::SetOptionString("catalog", "default_use_store_control", $useStoreControl);
$productReserveCondition = $wizard->GetVar("productReserveCondition");
$productReserveCondition = in_array($productReserveCondition, array("O", "P", "D", "S")) ? $productReserveCondition : "P";
COption::SetOptionString("sale", "product_reserve_condition", $productReserveCondition);
if (CModule::IncludeModule("catalog")) {
    if ($useStoreControl == "Y" && $curUseStoreControl == "N") {
        $dbStores = CCatalogStore::GetList(array(), array("ACTIVE" => 'Y'));
        if (!$dbStores->Fetch()) {
            $arStoreFields = array("TITLE" => GetMessage("CAT_STORE_NAME"), "ADDRESS" => GetMessage("STORE_ADR_1"), "DESCRIPTION" => GetMessage("STORE_DESCR_1"), "GPS_N" => GetMessage("STORE_GPS_N_1"), "GPS_S" => GetMessage("STORE_GPS_S_1"), "PHONE" => GetMessage("STORE_PHONE_1"), "SCHEDULE" => GetMessage("STORE_PHONE_SCHEDULE"));
            $newStoreId = CCatalogStore::Add($arStoreFields);
            if ($newStoreId) {
                CCatalogDocs::synchronizeStockQuantity($newStoreId);
            }
        }
    }
    /*$arStores = array();
    	$dbStore= CCatalogStore::GetList(array(), array("XML_ID" => "mebel"), false, false, array("ID"));
    	if (!$arStore = $dbStore->Fetch())
    	{
    		$arNewStore =  array(
    			"TITLE" => GetMessage("STORE_NAME_1"),
    			"ACTIVE" => "N",
    			"ADDRESS" => GetMessage("STORE_ADR_1"),
    			"DESCRIPTION" => GetMessage("STORE_DESCR_1"),
    			"USER_ID" => $USER->GetID(),
Пример #27
0
				$arUserList[$arOneUser['ID']] = '<a href="/bitrix/admin/user_edit.php?lang='.LANGUAGE_ID.'&ID='.$arOneUser['ID'].'">'.CUser::FormatName($strNameFormat, $arOneUser).'</a>';
			}
			if (isset($arUserList[$clearQuantityUser]))
				$strQuantityUser = $arUserList[$clearQuantityUser];
			if (isset($arUserList[$clearQuantityReservedUser]))
				$strQuantityReservedUser = $arUserList[$clearQuantityReservedUser];
			if (isset($arUserList[$clearStoreUser]))
				$strStoreUser = $arUserList[$clearStoreUser];
		}
		$boolStoreExists = false;
		$arStores = array();
		$arStores[] = array("ID" => -1, "ADDRESS" => Loc::getMessage("CAT_ALL_STORES"));
		$rsStores = CCatalogStore::GetList(
			array('SORT' => 'ASC', 'ID' => 'ASC'),
			array('ACTIVE' => 'Y'),
			false,
			false,
			array('ID', 'TITLE', 'ADDRESS')
		);
		while ($arStore = $rsStores->GetNext())
		{
			$boolStoreExists = true;
			$arStores[] = $arStore;
		}

		$systemTabControl->BeginNextTab();
	?>
	<tr>
		<td><?php 
echo Loc::getMessage("CAT_SELECT_CATALOG");
?>
Пример #28
0
if (!CModule::IncludeModule("catalog")) {
    ShowError(GetMessage("CATALOG_MODULE_NOT_INSTALL"));
    return;
}
if (!CBXFeatures::IsFeatureEnabled('CatMultiStore')) {
    return;
}
if (!isset($arParams["CACHE_TIME"])) {
    $arParams["CACHE_TIME"] = 360;
}
$prodID = $arParams["ELEMENT_ID"];
if ($prodID > 0) {
    if ($this->StartResultCache()) {
        $arResult["TITLE"] = $arParams["MAIN_TITLE"];
        $arSelect = array("ID", "TITLE", "ACTIVE", "ADDRESS", "DESCRIPTION", "PHONE", "SCHEDULE", "PRODUCT_AMOUNT");
        $rsProps = CCatalogStore::GetList(array('TITLE' => 'ASC', 'ID' => 'ASC'), array('ACTIVE' => 'Y', "PRODUCT_ID" => $prodID), false, false, $arSelect);
        while ($arProp = $rsProps->GetNext()) {
            $amount = is_null($arProp["PRODUCT_AMOUNT"]) ? 0 : $arProp["PRODUCT_AMOUNT"];
            $storeURL = CComponentEngine::MakePathFromTemplate($arParams["STORE_PATH"], array("store_id" => $arProp["ID"]));
            if ($arProp["TITLE"] == '' && $arProp["ADDRESS"] != '') {
                $storeName = $arProp["ADDRESS"];
            } elseif ($arProp["ADDRESS"] == '' && $arProp["TITLE"] != '') {
                $storeName = $arProp["TITLE"];
            } else {
                $storeName = $arProp["TITLE"] . " (" . $arProp["ADDRESS"] . ")";
            }
            if ($arParams["USE_STORE_PHONE"] == 'Y' && $arProp["PHONE"] != '') {
                $storePhone = $arProp["PHONE"];
            } else {
                $storePhone = null;
            }
Пример #29
0
 public static function loadAllStoreNames($active = true)
 {
     $active = $active === true;
     self::$storeNames = array();
     $filter = $active ? array('ACTIVE' => 'Y') : array();
     $storeIterator = CCatalogStore::GetList(array(), $filter, false, false, array('ID', 'ADDRESS', 'TITLE'));
     while ($store = $storeIterator->Fetch()) {
         $store['ID'] = (int) $store['ID'];
         $store['ADDRESS'] = (string) $store['ADDRESS'];
         $store['TITLE'] = (string) $store['TITLE'];
         self::$storeNames[$store['ID']] = $store['TITLE'] !== '' ? $store['TITLE'] . ' (' . $store['ADDRESS'] . ')' : $store['ADDRESS'];
     }
     unset($store, $storeIterator, $filter);
 }
Пример #30
0
        }
    } else {
        $bVarsFromForm = true;
        $DB->Rollback();
    }
}
if ($id > 0) {
    $APPLICATION->SetTitle(str_replace("#ID#", $id, GetMessage("STORE_TITLE_UPDATE")));
} else {
    $APPLICATION->SetTitle(GetMessage("STORE_TITLE_ADD"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$str_ACTIVE = "Y";
if ($id > 0) {
    $arSelect = array("ID", "ACTIVE", "TITLE", "ADDRESS", "DESCRIPTION", "GPS_N", "GPS_S", "IMAGE_ID", "LOCATION_ID", "PHONE", "SCHEDULE", "XML_ID", "SORT", "EMAIL", "ISSUING_CENTER", "SHIPPING_CENTER", "SITE_ID");
    $dbResult = CCatalogStore::GetList(array(), array('ID' => $id), false, false, $arSelect);
    if (!$dbResult->ExtractFields("str_")) {
        $id = 0;
    }
}
if ($bVarsFromForm) {
    $DB->InitTableVarsForEdit("b_catalog_store", "", "str_");
}
if (isset($str_ADDRESS)) {
    $str_ADDRESS = trim($str_ADDRESS) != '' ? $str_ADDRESS : '';
}
$aMenu = array(array("TEXT" => GetMessage("STORE_LIST"), "ICON" => "btn_list", "LINK" => "/bitrix/admin/cat_store_list.php?lang=" . LANG . "&" . GetFilterParams("filter_", false)));
if ($id > 0 && !$bReadOnly) {
    $aMenu[] = array("SEPARATOR" => "Y");
    $aMenu[] = array("TEXT" => GetMessage("STORE_NEW"), "ICON" => "btn_new", "LINK" => "/bitrix/admin/cat_store_edit.php?lang=" . LANG . "&" . GetFilterParams("filter_", false));
    $aMenu[] = array("TEXT" => GetMessage("STORE_DELETE"), "ICON" => "btn_delete", "LINK" => "javascript:if(confirm('" . GetMessage("STORE_DELETE_CONFIRM") . "')) window.location='/bitrix/admin/cat_store_list.php?action=delete&ID[]=" . $id . "&lang=" . LANG . "&" . bitrix_sessid_get() . "#tb';", "WARNING" => "Y");