|
|
@ -207,81 +207,82 @@ |
|
|
|
</form> |
|
|
|
</form> |
|
|
|
</section> |
|
|
|
</section> |
|
|
|
<section class="sale sale--calc section-inner container" id="calculator-container" style="display: none;"> |
|
|
|
<section class="sale sale--calc section-inner container" id="calculator-container" style="display: none;"> |
|
|
|
<h2 class="section-title">Подходящие септики в нашем каталоге</h2> |
|
|
|
<h2 class="section-title" style="display: none;">Подходящие септики в нашем каталоге</h2> |
|
|
|
<div class="sale__wrap"> |
|
|
|
<div class="sale__wrap"> |
|
|
|
<div class="sale__products" id="calculator-results"> |
|
|
|
<div class="sale__products" id="calculator-results"> |
|
|
|
<?php if (!empty($arResult['ITEMS'])): ?> |
|
|
|
<?php if (!empty($arResult['ITEMS'])): ?> |
|
|
|
<?php foreach ($arResult['ITEMS'] as $item): ?> |
|
|
|
<?php foreach ($arResult['ITEMS'] as $item): ?> |
|
|
|
<div class="product"> |
|
|
|
<div class="product"> |
|
|
|
<pre style="background: #f5f5f5; padding: 10px; overflow: auto; max-height: 300px;"> |
|
|
|
<pre style="background: #f5f5f5; padding: 10px; overflow: auto; max-height: 300px;"> |
|
|
|
<?php print_r($item); ?> |
|
|
|
<?php print_r($item); ?> |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
<a class="product__image" href="<?=$item['DETAIL_PAGE_URL']?>">
|
|
|
|
<a class="product__image" href="<?=$item['DETAIL_PAGE_URL']?>">
|
|
|
|
<img src="<?=$item['PREVIEW_PICTURE']?>" alt="<?=$item['NAME']?>">
|
|
|
|
<img src="<?=$item['PREVIEW_PICTURE']?>" alt="<?=$item['NAME']?>">
|
|
|
|
</a> |
|
|
|
</a> |
|
|
|
<div class="product__data"> |
|
|
|
<div class="product__data"> |
|
|
|
<?php if(isset($item['RATING'])): ?> |
|
|
|
<?php if(isset($item['RATING'])): ?> |
|
|
|
<div class="product__rating rating rating--<?=$item['RATING']?>"><?=$item['RATING']?>/5</div>
|
|
|
|
<div class="product__rating rating rating--<?=$item['RATING']?>"><?=$item['RATING']?>/5</div>
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
<div class="product__info"> |
|
|
|
<div class="product__info"> |
|
|
|
<a class="product__title" href="<?=$item['DETAIL_PAGE_URL']?>"><?=$item['NAME']?></a>
|
|
|
|
<a class="product__title" href="<?=$item['DETAIL_PAGE_URL']?>"><?=$item['NAME']?></a>
|
|
|
|
<?php if(!empty($item['PREVIEW_TEXT'])): ?> |
|
|
|
<?php if(!empty($item['PREVIEW_TEXT'])): ?> |
|
|
|
<p class="product__text"><?=$item['PREVIEW_TEXT']?></p>
|
|
|
|
<p class="product__text"><?=$item['PREVIEW_TEXT']?></p>
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="product__info"> |
|
|
|
<div class="product__info"> |
|
|
|
<?php if(!empty($item['PEOPLE_COUNT'])): ?> |
|
|
|
<?php if(!empty($item['PEOPLE_COUNT'])): ?> |
|
|
|
<p class="product__text">Пользователей: <span><?=$item['PEOPLE_COUNT']?></span></p>
|
|
|
|
<p class="product__text">Пользователей: <span><?=$item['PEOPLE_COUNT']?></span></p>
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
<?php if(!empty($item['PERFORMANCE'])): ?> |
|
|
|
<?php if(!empty($item['PERFORMANCE'])): ?> |
|
|
|
<p class="product__text">Производительность: <span><?=$item['PERFORMANCE']?> м³/сут</span></p>
|
|
|
|
<p class="product__text">Производительность: <span><?=$item['PERFORMANCE']?> м³/сут</span></p>
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
<?php if(!empty($item['RESET'])): ?> |
|
|
|
<?php if(!empty($item['RESET'])): ?> |
|
|
|
<p class="product__text">Залповый сброс: <span><?=$item['RESET']?> л</span></p>
|
|
|
|
<p class="product__text">Залповый сброс: <span><?=$item['RESET']?> л</span></p>
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
<?php if(!empty($item['POWER'])): ?> |
|
|
|
<?php if(!empty($item['POWER'])): ?> |
|
|
|
<p class="product__text">Питание: <span><?=$item['POWER']?></span></p>
|
|
|
|
<p class="product__text">Питание: <span><?=$item['POWER']?></span></p>
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<?php if(!empty($item['PRICE'])): ?> |
|
|
|
<?php if(!empty($item['PRICE'])): ?> |
|
|
|
<div class="product__price"><?=number_format($item['PRICE'], 0, '.', ' ')?> ₽</div>
|
|
|
|
<div class="product__price"><?=number_format($item['PRICE'], 0, '.', ' ')?> ₽</div>
|
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
<div class="product__btns"> |
|
|
|
<div class="product__btns"> |
|
|
|
<button class="button button--orange" onclick="addToCart(<?=$item['ID']?>)">Купить</button>
|
|
|
|
<button class="button button--orange" onclick="addToCart(<?=$item['ID']?>)">Купить</button>
|
|
|
|
<button class="button button--outline">Купить с установкой</button> |
|
|
|
<button class="button button--outline">Купить с установкой</button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<?php if(!empty($item['REVIEWS'])): ?> |
|
|
|
|
|
|
|
<div class="product__reviews"> |
|
|
|
|
|
|
|
<h3>Отзывы:</h3> |
|
|
|
|
|
|
|
<?php foreach($item['REVIEWS'] as $review): ?> |
|
|
|
|
|
|
|
<div class="review"> |
|
|
|
|
|
|
|
<div class="review__header"> |
|
|
|
|
|
|
|
<span class="review__author"><?=$review['NAME']?></span>
|
|
|
|
|
|
|
|
<span class="review__city"><?=$review['CITY']?></span>
|
|
|
|
|
|
|
|
<span class="review__date"><?=$review['DATE']?></span>
|
|
|
|
|
|
|
|
<span class="review__rating"><?=$review['RATING']?>/5</span>
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<?php if(!empty($item['REVIEWS'])): ?> |
|
|
|
<div class="review__content"> |
|
|
|
<div class="product__reviews"> |
|
|
|
<h4><?=$review['HEADER']?></h4>
|
|
|
|
<h3>Отзывы:</h3> |
|
|
|
<p><?=$review['TEXT']?></p>
|
|
|
|
<?php foreach($item['REVIEWS'] as $review): ?> |
|
|
|
|
|
|
|
<div class="review"> |
|
|
|
|
|
|
|
<div class="review__header"> |
|
|
|
|
|
|
|
<span class="review__author"><?=$review['NAME']?></span>
|
|
|
|
|
|
|
|
<span class="review__city"><?=$review['CITY']?></span>
|
|
|
|
|
|
|
|
<span class="review__date"><?=$review['DATE']?></span>
|
|
|
|
|
|
|
|
<span class="review__rating"><?=$review['RATING']?>/5</span>
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="review__content"> |
|
|
|
|
|
|
|
<h4><?=$review['HEADER']?></h4>
|
|
|
|
|
|
|
|
<p><?=$review['TEXT']?></p>
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<?php endforeach; ?> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<?php endforeach; ?> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<?php endforeach; ?> |
|
|
|
<?php endif; ?> |
|
|
|
<?php endif; ?> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<?php endforeach; ?> |
|
|
|
</section> |
|
|
|
<?php endif; ?> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</section> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
const form = document.getElementById('calculator-form'); |
|
|
|
const form = document.getElementById('calculator-form'); |
|
|
|
const resultsContainer = document.getElementById('calculator-results'); |
|
|
|
const resultsContainer = document.getElementById('calculator-results'); |
|
|
|
const calculatorContainer = document.getElementById('calculator-container'); |
|
|
|
const calculatorContainer = document.getElementById('calculator-container'); |
|
|
|
|
|
|
|
const calculatorTitle =document.querySelector('.section-title'); |
|
|
|
|
|
|
|
|
|
|
|
function validateForm() { |
|
|
|
function validateForm() { |
|
|
|
const selects = form.querySelectorAll('select'); |
|
|
|
const selects = form.querySelectorAll('select'); |
|
|
@ -313,15 +314,17 @@ document.addEventListener('DOMContentLoaded', function() { |
|
|
|
washer: 50, |
|
|
|
washer: 50, |
|
|
|
dishwasher: 50 |
|
|
|
dishwasher: 50 |
|
|
|
}; |
|
|
|
}; |
|
|
|
let totalVolume = 0; |
|
|
|
var totalVolume = 0; |
|
|
|
const devices = Object.keys(deviceVolumes); |
|
|
|
const devices = Object.keys(deviceVolumes); |
|
|
|
devices.forEach(device => { |
|
|
|
devices.forEach(device => { |
|
|
|
|
|
|
|
/* нужно добаваить множитель в radio-btn (1-3) */ |
|
|
|
const checkbox = document.getElementById(`calc-${device}`); |
|
|
|
const checkbox = document.getElementById(`calc-${device}`); |
|
|
|
if (checkbox && checkbox.checked) { |
|
|
|
if (checkbox && checkbox.checked) { |
|
|
|
totalVolume += deviceVolumes[device]; |
|
|
|
totalVolume += deviceVolumes[device]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Собираем только нужные поля |
|
|
|
// Собираем только нужные поля |
|
|
|
const formData = new FormData(); |
|
|
|
const formData = new FormData(); |
|
|
|
formData.append('ajax', 'Y'); |
|
|
|
formData.append('ajax', 'Y'); |
|
|
@ -347,9 +350,12 @@ document.addEventListener('DOMContentLoaded', function() { |
|
|
|
.then(response => response.json()) |
|
|
|
.then(response => response.json()) |
|
|
|
.then(data => { |
|
|
|
.then(data => { |
|
|
|
if (data.items) { |
|
|
|
if (data.items) { |
|
|
|
|
|
|
|
console.log(data.items) |
|
|
|
calculatorContainer.style.display = 'block'; |
|
|
|
calculatorContainer.style.display = 'block'; |
|
|
|
|
|
|
|
calculatorTitle.style.display = 'block'; |
|
|
|
resultsContainer.innerHTML = data.items; |
|
|
|
resultsContainer.innerHTML = data.items; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
calculatorTitle.style.display = 'none'; |
|
|
|
calculatorContainer.style.display = 'none'; |
|
|
|
calculatorContainer.style.display = 'none'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|