1
0
mirror of synced 2024-11-24 22:36:07 +03:00

Purchase price loading

This commit is contained in:
Ilyas Salikhov 2014-04-15 20:31:11 +04:00
parent 92d559d822
commit 2406c71652
5 changed files with 80 additions and 54 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
.DS_Store
*~
/nbproject/*
/.idea/*
/*tags*
.idea
.idea/*
/.idea
/.idea/*
.travis.yml

View File

@ -14,6 +14,7 @@ class ICMLLoader {
public $application;
public $encoding = 'utf-8';
public $encodingDefault = 'utf-8';
public $loadPurchasePrice = false;
protected $fp;
protected $mainSection = 1000000;
@ -394,6 +395,7 @@ class ICMLLoader {
$offer['PRODUCT_NAME'] = $product["NAME"];
$offer['PRODUCT_ACTIVE'] = $product["ACTIVE"];
$offer['PRICE'] = $offer['CATALOG_PRICE_1'];
$offer['PURCHASE_PRICE'] = $offer['CATALOG_PURCHASING_PRICE'];
$offer['QUANTITY'] = $offer["CATALOG_QUANTITY"];
// Get properties of product
@ -432,6 +434,7 @@ class ICMLLoader {
$product['PRODUCT_NAME'] = $product["NAME"];
$product['PRODUCT_ACTIVE'] = $product["ACTIVE"];
$product['PRICE'] = $product['CATALOG_PRICE_1'];
$product['PURCHASE_PRICE'] = $product['CATALOG_PURCHASING_PRICE'];
$product['QUANTITY'] = $product["CATALOG_QUANTITY"];
foreach ($resPropertiesProduct as $key => $propProduct) {
@ -494,6 +497,9 @@ class ICMLLoader {
$offer .= "<url>" . ($_SERVER["HTTPS"] == 'on' ? "https://" : "http://") . $_SERVER['SERVER_NAME'] . $this->PrepareValue($arOffer['DETAIL_PAGE_URL']) . "</url>\n";
$offer .= "<price>" . $this->PrepareValue($arOffer['PRICE']) . "</price>\n";
if ($arOffer['PURCHASE_PRICE'] && $this->loadPurchasePrice) {
$offer .= "<purchasePrice>" . $this->PrepareValue($arOffer['PURCHASE_PRICE']) . "</purchasePrice>\n";
}
foreach ($categories as $category)
$offer .= "<categoryId>" . $category['ID'] . "</categoryId>\n";

View File

@ -70,4 +70,5 @@ $loader->propertiesProduct = $IBLOCK_PROPERTY_PRODUCT;
$loader->propertiesUnitProduct = $IBLOCK_PROPERTY_UNIT_PRODUCT;
$loader->filename = $SETUP_FILE_NAME;
$loader->application = $APPLICATION;
$loader->loadPurchasePrice = $LOAD_PURCHASE_PRICE == 'Y';
$loader->Load();

View File

@ -20,6 +20,8 @@ if (($ACTION == 'EXPORT' || $ACTION == 'EXPORT_EDIT' || $ACTION == 'EXPORT_COPY'
if (isset($arOldSetupVars['SETUP_FILE_NAME']))
$SETUP_FILE_NAME = $arOldSetupVars['SETUP_FILE_NAME'];
if (isset($arOldSetupVars['LOAD_PURCHASE_PRICE']))
$LOAD_PURCHASE_PRICE = $arOldSetupVars['LOAD_PURCHASE_PRICE'];
if (isset($arOldSetupVars['SETUP_PROFILE_NAME']))
$SETUP_PROFILE_NAME = $arOldSetupVars['SETUP_PROFILE_NAME'];
if (isset($arOldSetupVars['IBLOCK_EXPORT']))
@ -538,6 +540,11 @@ if ($STEP==1)
'/bitrix/catalog_export/'))
.'intarocrm'/* .mt_rand(0, 999999) */.'.xml'
); ?>" size="50">
<br>
<br>
<font class="text"><?=GetMessage("LOAD_PURCHASE_PRICE");?>&nbsp;</font>
<input type="checkbox" name="LOAD_PURCHASE_PRICE" value="Y" <?= $LOAD_PURCHASE_PRICE == 'Y' ? 'checked' : '' ?>>
<br>
<br>
@ -637,7 +644,7 @@ if ($STEP==1)
<?=bitrix_sessid_post();?>
<?
$vals = "SETUP_FILE_NAME,IBLOCK_EXPORT";
$vals = "LOAD_PURCHASE_PRICE,SETUP_FILE_NAME,IBLOCK_EXPORT";
foreach ($iblockProperties as $val) {
$vals .= ",IBLOCK_PROPERTY_SKU_" . $val;
$vals .= ",IBLOCK_PROPERTY_UNIT_SKU_" . $val;

View File

@ -5,6 +5,7 @@ $MESS["EXPORT_CATALOGS"] = "Выберите каталоги для выгру
$MESS["CATALOG"] = "Каталог";
$MESS["EXPORT2INTAROCML"] = "Выгрузить в ICML";
$MESS["FILENAME"] = "Укажите имя файла данных:";
$MESS["LOAD_PURCHASE_PRICE"] = "Выгружать закупочную цену";
$MESS["PROPERTY"] = "Свойство, содержащее артикул товара";
$MESS["ALL_CATALOG"] = "Все каталоги";
$MESS["CET_EXPORT"] = "Экспортировать";