504 lines
31 KiB
PHP
504 lines
31 KiB
PHP
|
|
<?php
|
|||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
|||
|
|
|
|||
|
|
//ini_set('display_errors', 1);
|
|||
|
|
//error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);
|
|||
|
|
|
|||
|
|
if ($_SESSION['id'] && $_GET['dealTypeId'] && is_numeric($_GET['dealTypeId']) && $_GET['objectTypeId'] && is_numeric($_GET['objectTypeId']) && $_GET['numDays'] && is_numeric($_GET['numDays'])) {
|
|||
|
|
|
|||
|
|
$get = clearInputData($_GET);
|
|||
|
|
|
|||
|
|
$curUser = new User();
|
|||
|
|
$curUser->get($_SESSION['id']);
|
|||
|
|
|
|||
|
|
$requestToSend = [];
|
|||
|
|
|
|||
|
|
$login = $curUser->zipal_login;
|
|||
|
|
$password = $curUser->zipal_password;
|
|||
|
|
|
|||
|
|
if (empty($login) || empty($password)) {
|
|||
|
|
$login = $curUser->agencyZipalLogin;
|
|||
|
|
$password = $curUser->agencyZipalPassword;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$requestToSend['login'] = $login;
|
|||
|
|
$requestToSend['password'] = $password;
|
|||
|
|
$requestToSend['method'] = 'GetPrices';
|
|||
|
|
$requestToSend['request'] = [];
|
|||
|
|
$requestToSend['request']['requestType'] = 'GetPricesByParamsRequestType';
|
|||
|
|
|
|||
|
|
$requestToSend['request']['days'] = $get['numDays'];
|
|||
|
|
$requestToSend['request']['hasPhotos'] = $get['hasPhoto'];
|
|||
|
|
|
|||
|
|
$packageId = isset($get['packageId']) ? $get['packageId'] : null;
|
|||
|
|
$package = null;
|
|||
|
|
$packageDestinations = [];
|
|||
|
|
|
|||
|
|
$sqlRegion = "SELECT code FROM rf_regions WHERE id = $get[region]";
|
|||
|
|
$rez = mysql_query($sqlRegion);
|
|||
|
|
$requestToSend['request']['region'] = mysql_fetch_assoc($rez)['code'];
|
|||
|
|
|
|||
|
|
|
|||
|
|
if ($packageId) {
|
|||
|
|
$sqlPackage = "SELECT * FROM advertising_package WHERE id=$packageId";
|
|||
|
|
$rezPackage = mysql_query($sqlPackage);
|
|||
|
|
$package = mysql_fetch_assoc($rezPackage);
|
|||
|
|
|
|||
|
|
$sqlPackageDestinations = "SELECT * FROM advertising_package_destinations WHERE deleted=0 AND advertising_package_id=$packageId";
|
|||
|
|
$rezPackageDestinations = mysql_query($sqlPackageDestinations);
|
|||
|
|
|
|||
|
|
while ($dest = mysql_fetch_assoc($rezPackageDestinations)) {
|
|||
|
|
array_push($packageDestinations, $dest);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$dealTypeId = $get['dealTypeId'];
|
|||
|
|
$objectTypeId = $get['objectTypeId'];
|
|||
|
|
$priceTypeId = $get['priceTypeId'];
|
|||
|
|
|
|||
|
|
$priceType = null;
|
|||
|
|
|
|||
|
|
$sqlDealType = "SELECT * FROM advertising_package_deal_type WHERE id=$dealTypeId";
|
|||
|
|
$rezDealType = mysql_query($sqlDealType);
|
|||
|
|
$dealType = mysql_fetch_assoc($rezDealType);
|
|||
|
|
|
|||
|
|
$sqlObjectType = "SELECT * FROM advertising_package_object_type WHERE id=$objectTypeId";
|
|||
|
|
$rezObjectType = mysql_query($sqlObjectType);
|
|||
|
|
$objectType = mysql_fetch_assoc($rezObjectType);
|
|||
|
|
|
|||
|
|
if ($dealType['code'] == 'RENT') {
|
|||
|
|
if (!$priceTypeId || $priceTypeId == -1) {
|
|||
|
|
echo "<p style='color: red;'>Необходимо указать Тип цены для типа сделки Аренда</p>";
|
|||
|
|
exit();
|
|||
|
|
} else {
|
|||
|
|
$sqlPriceType = "SELECT * FROM advertising_package_price_type WHERE id=$priceTypeId";
|
|||
|
|
$rezPriceType = mysql_query($sqlPriceType);
|
|||
|
|
$priceType = mysql_fetch_assoc($rezPriceType);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$requestToSend['request']['room'] = $objectType['is_room'] == 1 ? true : false;
|
|||
|
|
$requestToSend['request']['dealType'] = $dealType['code'];
|
|||
|
|
if ($priceType != null) {
|
|||
|
|
$requestToSend['request']['priceType'] = $priceType['code'];
|
|||
|
|
}
|
|||
|
|
$requestToSend['request']['objectType'] = $objectType['code'];
|
|||
|
|
|
|||
|
|
$user_agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; HTC_Touch_Diamond2_T5353; Windows Phone 6.5)';
|
|||
|
|
|
|||
|
|
//делаем запрос к zipal
|
|||
|
|
$result = curl_request_zipal_json("https://zipal.ru/ws/json", $_SESSION['id'], $user_agent, json_encode($requestToSend));
|
|||
|
|
|
|||
|
|
/*if ($_SESSION['id'] == 93) {
|
|||
|
|
echo json_encode($requestToSend);
|
|||
|
|
}*/
|
|||
|
|
|
|||
|
|
$jsonResult = json_decode($result, true);
|
|||
|
|
|
|||
|
|
if ($jsonResult['resultCode'] == "FAIL") {
|
|||
|
|
//ошибка
|
|||
|
|
$res = strpos($jsonResult['result'], "at [Source:");
|
|||
|
|
if ($res) {
|
|||
|
|
echo substr($jsonResult['result'], $res);
|
|||
|
|
} else {
|
|||
|
|
echo $jsonResult['result'];
|
|||
|
|
}
|
|||
|
|
echo $jsonResult['result'];
|
|||
|
|
} else {
|
|||
|
|
if ($jsonResult['resultCode'] == "OK") {
|
|||
|
|
|
|||
|
|
if (!isset($get['asScript'])) {
|
|||
|
|
//print_r($jsonResult['result']);
|
|||
|
|
?>
|
|||
|
|
<input type="hidden" name="adv_pack_formed" id="adv_pack_formed" value="1"/>
|
|||
|
|
<div class="form-block">
|
|||
|
|
<div class="label">Базовая цена</div>
|
|||
|
|
<div class="label" style="color: black;">
|
|||
|
|
<span id="adv-zipal-base-price"><?php echo ($jsonResult['result']['basePrice'] / 100) * $ZIPAL_MULTIPLY; ?></span>
|
|||
|
|
<span class="rub">p</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="clear"></div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-block">
|
|||
|
|
<div class="label">Итого</div>
|
|||
|
|
<div class="label" style="color: black;">
|
|||
|
|
<span id="adv-zipal-total-price"><?php echo $package ? $package['price'] : ($jsonResult['result']['basePrice'] / 100) * $ZIPAL_MULTIPLY; ?></span>
|
|||
|
|
<span class="rub">p</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="clear"></div>
|
|||
|
|
</div>
|
|||
|
|
<div style="max-height: 600px; overflow-y: auto;">
|
|||
|
|
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
|
|||
|
|
<?php
|
|||
|
|
|
|||
|
|
foreach ($jsonResult['result']['destination'] as $dest) {
|
|||
|
|
|
|||
|
|
if (!isset($dest['destination'])) {
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$targetName = $ZIPAL_TARGETS[$dest['destination']];
|
|||
|
|
|
|||
|
|
if (!$targetName) {
|
|||
|
|
$targetName = $dest['destination'];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$dbDestFound = null;
|
|||
|
|
|
|||
|
|
if ($packageDestinations) {
|
|||
|
|
foreach ($packageDestinations as $dbDest) {
|
|||
|
|
if ($dest['destination'] === $dbDest['destination']) {
|
|||
|
|
$dbDestFound = $dbDest;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// у нас должны быть показаны те, кто не в фиде
|
|||
|
|
$onlyFeed = true;
|
|||
|
|
foreach ($dest['price'] as $price) {
|
|||
|
|
if (!$price['feedOnly']) {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'YANDEX') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'CIAN') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'EMLS') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'AVITO') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$checked = false;
|
|||
|
|
|
|||
|
|
if ($dbDestFound != null) {
|
|||
|
|
$checked = true;
|
|||
|
|
} else {
|
|||
|
|
if ($package == null) {
|
|||
|
|
foreach ($dest['price'] as $price) {
|
|||
|
|
if (($price['price'] == 0 && !$price['feedOnly']) || $dest['destination'] === 'YANDEX' || $dest['destination'] === 'CIAN' || $dest['destination'] === 'EMLS' || $dest['destination'] === 'AVITO') {
|
|||
|
|
$checked = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!$onlyFeed) {
|
|||
|
|
?>
|
|||
|
|
<tr style="border-top: 1px solid gray;" class="<?php echo $dest['destination']; ?>_row <?php if (!$checked) { echo 'gryed-row';}?>">
|
|||
|
|
<td style="width:50%;">
|
|||
|
|
<div class="form-block" style="padding-top: 10px;">
|
|||
|
|
<div class="inputs" style="width: 90%;">
|
|||
|
|
<div class="checkbox" style="height: 60px;">
|
|||
|
|
<input name="adv_<?php echo $dest['destination']; ?>_check"
|
|||
|
|
id="adv_<?php echo $dest['destination']; ?>_check"
|
|||
|
|
data-destination="<?php echo $dest['destination']; ?>"
|
|||
|
|
type="checkbox" class="destination-box" <?php if ($checked) { echo 'checked = "true"';}?>>
|
|||
|
|
<label style="font-weight: bold;"
|
|||
|
|
for="adv_<?php echo $dest['destination']; ?>_check"><?php echo $targetName; ?></label>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="clear"></div>
|
|||
|
|
</div>
|
|||
|
|
<?php if ($dest['destination'] === 'AVITO') {?>
|
|||
|
|
<div class="form-block">
|
|||
|
|
<div class="label" style="width: 135px;">Цена за размещение</div>
|
|||
|
|
<div class="inputs" style="width: 170px;">
|
|||
|
|
<input data-destination="<?php echo $dest['destination']; ?>" <?php if (!$checked) { echo "disabled";}?> class="text adv-price-manual-field" value="<?php echo $dbDestFound != null ? $dbDestFound['manual_price'] : ''; ?>" type="number" min="0" name="adv_<?php echo $dest['destination']; ?>_price_manual" id="adv_<?php echo $dest['destination']; ?>_price_manual"/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<?php }?>
|
|||
|
|
<?php if ($dest['destination'] === 'YANDEX' || $dest['destination'] === 'CIAN' || $dest['destination'] === 'EMLS') {?>
|
|||
|
|
<div class="form-block">
|
|||
|
|
<div class="label" style="width: 135px;">Цена за 1 день</div>
|
|||
|
|
<div class="inputs" style="width: 170px;">
|
|||
|
|
<input data-destination="<?php echo $dest['destination']; ?>" <?php if (!$checked) { echo "disabled";}?> class="text adv-price-manual-field" value="<?php echo $dbDestFound != null ? $dbDestFound['manual_price'] : ''; ?>" type="number" min="0" name="adv_<?php echo $dest['destination']; ?>_price_manual" id="adv_<?php echo $dest['destination']; ?>_price_manual"/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<?php }?>
|
|||
|
|
</td>
|
|||
|
|
<td style="padding: 10px 0;">
|
|||
|
|
<?php
|
|||
|
|
foreach ($dest['price'] as $price) {
|
|||
|
|
$oneSelected = false;
|
|||
|
|
|
|||
|
|
$priceType = $ZIPAL_PRICE_TYPES[$price['type']];
|
|||
|
|
|
|||
|
|
if (!$priceType) {
|
|||
|
|
$priceType = $price['type'];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'YANDEX' || $dest['destination'] === 'CIAN' || $dest['destination'] === 'EMLS' || $dest['destination'] === 'AVITO') {
|
|||
|
|
if ($price['feedOnly']) {
|
|||
|
|
?>
|
|||
|
|
<label style="display: block; cursor: pointer;position: relative;">
|
|||
|
|
<span id="adv_feed_<?php echo $dest['destination'] . "_" .$price['type']; ?>_value" style="width:60px;position: absolute;top: 0;text-align: right;right: 100%;">
|
|||
|
|
<?php if ($price['price'] > 0) { ?>
|
|||
|
|
<?php echo $price['price'] / 100; ?><span class="rub">p</span>
|
|||
|
|
<?php } ?>
|
|||
|
|
</span>
|
|||
|
|
<input name="adv_<?php echo $dest['destination']; ?>_radio" type="radio"
|
|||
|
|
class="zipal-radio-price"
|
|||
|
|
data-price="<?php echo $price['price'] / 100; ?>"
|
|||
|
|
data-feed="true" data-type="<?php echo $price['type']; ?>"
|
|||
|
|
<?php
|
|||
|
|
if ($checked && $dbDestFound != null) {
|
|||
|
|
if ($dbDestFound['placement_type'] === $price['type']) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if ($package == null) {
|
|||
|
|
if ($price['price'] == 0 && !$oneSelected) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
id="adv_feed_<?php echo $dest['destination'] . "_" .$price['type']; ?>_radio"
|
|||
|
|
value="feed_<?php echo $price['type']; ?>"> Фид
|
|||
|
|
- <?php echo $priceType; ?></label>
|
|||
|
|
<?php
|
|||
|
|
} else {
|
|||
|
|
?>
|
|||
|
|
<label style="display: block; cursor: pointer;position: relative;">
|
|||
|
|
<span id="adv_<?php echo $dest['destination'] . "_" .$price['type']; ?>_value" style="width:60px;position: absolute;top: 0;text-align: right;right: 100%;">
|
|||
|
|
<?php if ($price['price'] > 0) { ?>
|
|||
|
|
<?php echo $price['price'] / 100; ?><span class="rub">p</span>
|
|||
|
|
<?php } ?>
|
|||
|
|
</span>
|
|||
|
|
<input name="adv_<?php echo $dest['destination']; ?>_radio" type="radio"
|
|||
|
|
class="zipal-radio-price"
|
|||
|
|
data-price="<?php echo $price['price'] / 100; ?>"
|
|||
|
|
data-feed="false" data-type="<?php echo $price['type']; ?>"
|
|||
|
|
<?php
|
|||
|
|
if ($checked && $dbDestFound != null) {
|
|||
|
|
if ($dbDestFound['placement_type'] === $price['type']) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if ($package == null) {
|
|||
|
|
if ($price['price'] == 0 && !$oneSelected) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
id="adv_<?php echo $dest['destination'] . "_" .$price['type']; ?>_radio"
|
|||
|
|
value="<?php echo $price['type']; ?>"> <?php echo $priceType; ?>
|
|||
|
|
</label>
|
|||
|
|
<label style="display: block; cursor: pointer;position: relative;">
|
|||
|
|
<span id="adv_feed_<?php echo $dest['destination'] . "_" .$price['type']; ?>_value" style="width:60px;position: absolute;top: 0;text-align: right;right: 100%;">
|
|||
|
|
<?php if ($price['price'] > 0) { ?>
|
|||
|
|
<?php echo $price['price'] / 100; ?><span class="rub">p</span>
|
|||
|
|
<?php } ?>
|
|||
|
|
</span>
|
|||
|
|
<input name="adv_<?php echo $dest['destination']; ?>_radio" type="radio"
|
|||
|
|
class="zipal-radio-price"
|
|||
|
|
data-price="<?php echo $price['price'] / 100; ?>"
|
|||
|
|
data-feed="true" data-type="<?php echo $price['type']; ?>"
|
|||
|
|
<?php
|
|||
|
|
if ($checked && $dbDestFound != null) {
|
|||
|
|
if ($dbDestFound['placement_type'] === $price['type']) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if ($package == null) {
|
|||
|
|
if ($price['price'] == 0 && !$oneSelected) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
id="adv_feed_<?php echo $dest['destination'] . "_" .$price['type']; ?>_radio"
|
|||
|
|
value="feed_<?php echo $price['type']; ?>"> Фид
|
|||
|
|
- <?php echo $priceType; ?></label>
|
|||
|
|
<?php
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (!$price['feedOnly']) {
|
|||
|
|
?>
|
|||
|
|
<label style="display: block; cursor: pointer;position: relative;">
|
|||
|
|
<span id="adv_<?php echo $dest['destination'] . "_" .$price['type']; ?>_value" style="width:60px;position: absolute;top: 0;text-align: right;right: 100%;">
|
|||
|
|
<?php if ($price['price'] > 0) { ?>
|
|||
|
|
<?php echo $price['price'] / 100; ?><span class="rub">p</span>
|
|||
|
|
<?php } ?>
|
|||
|
|
</span>
|
|||
|
|
<input name="adv_<?php echo $dest['destination']; ?>_radio"
|
|||
|
|
class="zipal-radio-price"
|
|||
|
|
data-price="<?php echo $price['price'] / 100; ?>"
|
|||
|
|
type="radio" data-type="<?php echo $price['type']; ?>"
|
|||
|
|
data-feed="false"
|
|||
|
|
<?php
|
|||
|
|
if ($checked && $dbDestFound != null) {
|
|||
|
|
if ($dbDestFound['placement_type'] === $price['type']) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if ($package == null) {
|
|||
|
|
if ($price['price'] == 0 && !$oneSelected) {
|
|||
|
|
$oneSelected = true;
|
|||
|
|
echo 'checked = "true"';
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (!$checked) {
|
|||
|
|
echo " disabled ";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
id="adv_<?php echo $dest['destination'] . "_" .$price['type']; ?>_radio"
|
|||
|
|
value="<?php echo $price['type']; ?>"> <?php echo $priceType; ?>
|
|||
|
|
</label>
|
|||
|
|
<?php }
|
|||
|
|
}
|
|||
|
|
} ?>
|
|||
|
|
</td>
|
|||
|
|
<?php } ?>
|
|||
|
|
</tr>
|
|||
|
|
<?php } ?>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
<?php
|
|||
|
|
} else {
|
|||
|
|
echo '[{';
|
|||
|
|
echo '"id": "adv-zipal-base-price",';
|
|||
|
|
echo '"value" : "';
|
|||
|
|
echo ($jsonResult['result']['basePrice'] / 100) * $ZIPAL_MULTIPLY;
|
|||
|
|
echo '"}';
|
|||
|
|
|
|||
|
|
foreach ($jsonResult['result']['destination'] as $dest) {
|
|||
|
|
|
|||
|
|
// у нас должны быть показаны те, кто не в фиде
|
|||
|
|
$onlyFeed = true;
|
|||
|
|
foreach ($dest['price'] as $price) {
|
|||
|
|
if (!$price['feedOnly']) {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!isset($dest['destination'])) {
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'YANDEX') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'CIAN') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'EMLS') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($dest['destination'] === 'AVITO') {
|
|||
|
|
$onlyFeed = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!$onlyFeed) {
|
|||
|
|
foreach ($dest['price'] as $price) {
|
|||
|
|
if ($dest['destination'] === 'YANDEX' || $dest['destination'] === 'CIAN' || $dest['destination'] === 'EMLS' || $dest['destination'] === 'AVITO') {
|
|||
|
|
echo ",";
|
|||
|
|
if ($price['feedOnly']) {
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_feed_' . $dest['destination'] . "_" .$price['type'] .'_value",';
|
|||
|
|
echo '"value" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 . '<span class=\'rub\'>p</span>' : "";
|
|||
|
|
echo '"},';
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_feed_' . $dest['destination'] . "_" .$price['type'] .'_radio",';
|
|||
|
|
echo '"price" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 : "";
|
|||
|
|
echo '"}';
|
|||
|
|
} else {
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_' . $dest['destination'] . "_" .$price['type'] .'_value",';
|
|||
|
|
echo '"value" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 . '<span class=\'rub\'>p</span>' : "";
|
|||
|
|
echo '"},';
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_' . $dest['destination'] . "_" .$price['type'] .'_radio",';
|
|||
|
|
echo '"price" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 : "";
|
|||
|
|
echo '"},';
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_feed_' . $dest['destination'] . "_" .$price['type'] .'_value",';
|
|||
|
|
echo '"value" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 . '<span class=\'rub\'>p</span>' : "";
|
|||
|
|
echo '"},';
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_feed_' . $dest['destination'] . "_" .$price['type'] .'_radio",';
|
|||
|
|
echo '"price" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 : "";
|
|||
|
|
echo '"}';
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (!$price['feedOnly']) {
|
|||
|
|
echo ",";
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_' . $dest['destination'] . "_" .$price['type'] .'_value",';
|
|||
|
|
echo '"value" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 . '<span class=\'rub\'>p</span>' : "";
|
|||
|
|
echo '"},';
|
|||
|
|
echo '{';
|
|||
|
|
echo '"id": "adv_' . $dest['destination'] . "_" .$price['type'] .'_radio",';
|
|||
|
|
echo '"price" : "';
|
|||
|
|
echo $price['price'] > 0 ? $price['price'] / 100 : "";
|
|||
|
|
echo '"}';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
echo ']';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|