Cброс закупочной цены в icml при её отсутствии
This commit is contained in:
commit
0fec821438
@ -29,6 +29,7 @@ class RetailCrmICML
|
||||
protected $mainSection = 1000000;
|
||||
protected $pageSize = 500;
|
||||
protected $protocol;
|
||||
protected $purchasePriceNull;
|
||||
|
||||
protected $isLogged = false;
|
||||
protected $logFile = '/bitrix/catalog_export/i_crm_load_log.txt';
|
||||
@ -37,6 +38,7 @@ class RetailCrmICML
|
||||
protected $MODULE_ID = 'intaro.retailcrm';
|
||||
protected $CRM_CATALOG_BASE_PRICE = 'catalog_base_price';
|
||||
protected $PROTOCOL_OPTION = 'protocol';
|
||||
protected $CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
|
||||
|
||||
protected $measurement = array (
|
||||
'mm' => 1, // 1 mm = 1 mm
|
||||
@ -76,6 +78,7 @@ class RetailCrmICML
|
||||
$this->encodingDefault = $defaultSite["CHARSET"];
|
||||
|
||||
$this->protocol = COption::GetOptionString($this->MODULE_ID, $this->PROTOCOL_OPTION);
|
||||
$this->purchasePriceNull = COption::GetOptionString($this->MODULE_ID, $this->CRM_PURCHASE_PRICE_NULL);
|
||||
|
||||
$this->PrepareSettings();
|
||||
|
||||
@ -621,9 +624,15 @@ class RetailCrmICML
|
||||
$offer .= "<url>" . $this->protocol . $this->serverName . $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";
|
||||
|
||||
if ($this->loadPurchasePrice) {
|
||||
if ($arOffer['PURCHASE_PRICE']) {
|
||||
$offer .= "<purchasePrice>" . $this->PrepareValue($arOffer['PURCHASE_PRICE']) . "</purchasePrice>\n";
|
||||
} elseif ("Y" == $this->purchasePriceNull) {
|
||||
$offer .= "<purchasePrice>0</purchasePrice>\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$offer .= "<categoryId>" . $category['ID'] . "</categoryId>\n";
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ $CRM_DIMENSIONS = 'order_dimensions';
|
||||
$PROTOCOL = 'protocol';
|
||||
|
||||
$CRM_DISCOUNT_ROUND = 'discount_round';
|
||||
$CRM_PURCHASE_PRICE_NULL = 'purchasePrice_null';
|
||||
|
||||
if(!CModule::IncludeModule('intaro.retailcrm') || !CModule::IncludeModule('sale') || !CModule::IncludeModule('iblock') || !CModule::IncludeModule('catalog'))
|
||||
return;
|
||||
@ -451,6 +452,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmDc", "add");
|
||||
}
|
||||
|
||||
//purchasePrice_null
|
||||
if (htmlspecialchars(trim($_POST['purchasePrice_null'])) == 'Y') {
|
||||
$purchasePrice_null = 'Y';
|
||||
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmPricePrchase", "add");
|
||||
} else {
|
||||
$purchasePrice_null = 'N';
|
||||
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmPricePrchase", "add");
|
||||
}
|
||||
|
||||
//version
|
||||
|
||||
$version = COption::GetOptionString($mid, $CRM_API_VERSION);
|
||||
@ -526,6 +536,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
COption::SetOptionString($mid, $CRM_DIMENSIONS, $orderDimensions);
|
||||
|
||||
COption::SetOptionString($mid, $CRM_DISCOUNT_ROUND, $discount_round);
|
||||
COption::SetOptionString($mid, $CRM_PURCHASE_PRICE_NULL, $purchasePrice_null);
|
||||
|
||||
$request = \Bitrix\Main\Application::getInstance()->getContext()->getRequest();
|
||||
|
||||
@ -634,6 +645,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$optionUaKeys = unserialize(COption::GetOptionString($mid, $CRM_UA_KEYS));
|
||||
|
||||
$optionDiscRound = COption::GetOptionString($mid, $CRM_DISCOUNT_ROUND, 0);
|
||||
$optionPricePrchaseNull = COption::GetOptionString($mid, $CRM_PURCHASE_PRICE_NULL, 0);
|
||||
|
||||
$version = COption::GetOptionString($mid, $CRM_API_VERSION, 0);
|
||||
|
||||
@ -752,6 +764,17 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$('.r-purchaseprice-button label').change(function() {
|
||||
if($(this).find('input').is(':checked') === true) {
|
||||
$('tr.r-purchaseprice').show('slow');
|
||||
} else if($(this).find('input').is(':checked') === false) {
|
||||
$('tr.r-purchaseprice').hide('slow');
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('input[name="update-delivery-services"]').live('click', function() {
|
||||
@ -1303,6 +1326,23 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="heading r-purchaseprice-button">
|
||||
<td colspan="2" class="option-other-heading">
|
||||
<b>
|
||||
<label><input class="addr" type="checkbox" name="purchasePrice_null" value="Y"
|
||||
<?php if($optionPricePrchaseNull === 'Y')
|
||||
echo "checked"; ?>><?php
|
||||
echo "Сброс закупочной цены в icml" ?></label>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="r-purchaseprice" <?php if($optionPricePrchaseNull !== 'Y') echo 'style="display: none;"'; ?>>
|
||||
<td class="option-head" colspan="2">
|
||||
<b><?php echo "При включенной опции в генерации icml будет добавлен сброс закупочной цены на 0 если она не указана" ?></b>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="heading r-ua-button">
|
||||
<td colspan="2" class="option-other-heading">
|
||||
<b>
|
||||
|
Loading…
Reference in New Issue
Block a user