$('.add-to-cart-btn').click(function(){
var id = $(this).data('id');
var quantity = $('.quantity-value').val();
$(this).addClass('pending');
$.ajax({
type: 'POST',
url: '?action=ADD2BASKET&id='+id+'&quantity='+quantity,
data: '',
success: function(){
$('.add-to-cart-btn').removeClass('pending');
$.ajax({
type: 'POST',
url: '/ajax.handler.php',
data: 'PAGE=CART',
success: function(data){
$('.header__cart-num').hide().html(data).fadeIn();
}
});
var itemTitle = $('h1').text();
$('.order-notification__title').text(itemTitle+' добавлены в корзину!');
$('.order-notification').fadeIn().animate({'marginRight': '0'});
},
error:function(){
}
});
});
<? if ($arResult['DISPLAY_PROPERTIES']['COLOR_SKU']){?>
<div class="list-group add-to-cart">
<?if(is_array($arResult["OFFERS"]) && !empty($arResult["OFFERS"])):?>
<ul>
<?foreach($arResult["OFFERS"] as $arOffer):?>
<li>
<div>
<?if(!empty($arParams["OFFERS_FIELD_CODE"]) || !empty($arOffer["DISPLAY_PROPERTIES"])):?>
<?foreach($arParams["OFFERS_FIELD_CODE"] as $field_code):?>
<?
foreach ($arOffer['PROPERTIES']['COLOR_SKU']['VALUE'] as $value) {
echo $value;
}
?>
<?echo $arOffer[$field_code];?>
<?endforeach;?>
<?endif;?>
</div>
<?foreach($arOffer["PRICES"] as $code=>$arPrice):?>
<div>
<?if($arPrice["CAN_ACCESS"]):?>
<?=GetMessage("CATALOG_PRICE")?>
<?if($arPrice["DISCOUNT_VALUE"] < $arPrice["VALUE"]):?>
<span class="single-price" itemprop = "price" style="margin-right: 15px;"><?=$arPrice["PRINT_VALUE"]?></span>
<span itemprop = "price" class="single-price"><?=$arPrice["PRINT_DISCOUNT_VALUE"]?></span>
<?else:?>
<span class="single-price" itemprop = "price"><?=$arPrice["PRINT_VALUE"]?></span>
<?endif?>
<?endif;?>
<a href="<? echo $arOffer['ADD_URL']; ?>" class="product-icon2"></a>
</div>
<?endforeach;?>
</li>
<?endforeach;?>
</ul>
<?endif;?>
</div>
<?}?>
<?if(!empty($arParams["OFFERS_FIELD_CODE"]) || !empty($arOffer["DISPLAY_PROPERTIES"])):?>
<?foreach($arParams["OFFERS_FIELD_CODE"] as $field_code):?>
<?echo $arOffer['PROPERTIES']['COLOR_SKU']['VALUE'];?>
<?echo $arOffer[$field_code];?>
<?endforeach;?>
<?endif;?>