Здравствуйте!
Есть js фильтр по цене в обычном HTML шаблоне.
Этот js код ищет в HTML вот эту строчку " <div class="product-price">$19.95</div> " и берет цену от сюда.
Сейчас цена идет не пишется как раньше в HTML, а берется из базы данных и вместо
" <div class="product-price">$19.95</div> "
сейчас выглядит так
<div class="product-price"><span class='sym-btn' data-pid='2' data-name='show' data-price='show' data-qty='show' ></span></div>
Этот запрос идет в БД и уже в загруженной странице цена отображается так <div class="col-md-6">Р100.00</div>
Мне нужно что бы js код понимал цену которая идет из базы данных...
Вот сам js код
---------
<script>
jQuery(document).ready( function($){
$('#shop').isotope({
transitionDuration: '0.65s',
getSortData: {
name: '.product-title',
price_lh: function( itemElem ) {
if( $(itemElem).find('.product-price').find( 'ins').length > 0 ) {
var price = $(itemElem).find('.product-price ins').text();
} else {
var price = $(itemElem).find('.product-price').text( );
}
priceNum = price.split("$");
return parseFloat( priceNum[1] );
},
price_hl: function( itemElem ) {
if( $(itemElem).find('.product-price').find( 'ins').length > 0 ) {
var price = $(itemElem).find('.product-price ins').text();
} else {
var price = $(itemElem).find('.product-price').text( );
}
priceNum = price.split("$");
return parseFloat( priceNum[1] );
}
},
sortAscending: {
name: true,
price_lh: true,
price_hl: false
}
});
$('.custom-filter:not(.no-count)').child ren('li:not(.widget-filter-reset)').each ( function(){
var element = $(this),
elementFilter = element.children('a').attr('data-fi lter'),
elementFilterContainer = element.parents('.custom-filter').attr(' data-container');
elementFilterCount = Number( jQuery(elementFilterContainer).find( elementFilter ).length );
element.append('<span>'+ elementFilterCount +'</span>');
});
$('.shop-sorting li').click( function() {
$('.shop-sorting').find('li'). removeClass( 'active-filter' );
$(this).addClass( 'active-filter' );
var sortByValue = $(this).find('a').attr('data-sort-b y');
$('#shop').isotope({ sortBy: sortByValue });
return false;
});
});
</script>
--------------
Опубликован 15.12.2016 в 00:24
Заказ находится в архиве