0){
data['usedAttributes'] = usedAttributes.toString();
}
$.ajax({
url: "/index.php?route=module/filter/getdata",
type: "POST",
dataType: "json",
data: data
}).done(function(data) {
if (data.products) {
$(".products-content").empty();
$(".total .results").empty();
$(".product-total").empty();
if (view == "cell"){
$("#productTemplateCell").tmpl(data.products).appendTo(".products-content");
}
if (view == 'list') {
$("#productTemplateList").tmpl(data.products).appendTo(".products-content");
}
if (view == 'list-2') {
$("#productTemplateList2").tmpl(data.products).appendTo(".products-content");
}
}
if (data.attributes) {
$("a.attributes").each(function() {
// var value = parseInt($(this).attr('value'));
var value = parseInt(this.id.split('_')[1]);
if (data.attributes[value]) {
$("#attribute_qty_" + value).text(data.attributes[value]);
$(this).removeClass("empty");
} else {
$("#attribute_qty_" + value).text("0");
$(this).addClass("empty");
}
});
}
if (typeof(data.navigation.pages) == 'object') {
$(".total .results").html("Показано " + data.navigation.range + " из " + data.navigation.total + " (всего " + data.navigation.last + " страниц)");
$(".product-total").html(data.navigation.total);
}
$(".pagination").html('');
if (typeof(data.navigation.pages) == 'object' && data.navigation.pages.length > 1) {
$("
").appendTo(".pagination");
if (data.navigation.pages[0] > 1) {
link = "- 1
";
$(link).appendTo(".pagination ul");
}
if (data.navigation.previous != "" && data.navigation.page != 1) {
link = "- <";
$(link).appendTo(".pagination ul");
}
for (var key in data.navigation.pages) {
if (data.navigation.pages[key] == data.navigation.page)
// link = "
- " + data.navigation.pages[key] + "
";
link = "- " + data.navigation.pages[key] + "
";
else
link = "- " + data.navigation.pages[key] + "
";
$(link).appendTo(".pagination ul");
}
if (data.navigation.next != "" && data.navigation.page != data.navigation.last) {
link = "- >
";
$(link).appendTo(".pagination ul");
}
if (data.navigation.pages[data.navigation.pages.length - 1] < data.navigation.last) {
link = "- " + data.navigation.last + "
";
$(link).appendTo(".pagination ul");
}
$("
").appendTo(".pagination");
}
}).fail(function(){
alert('Произошла ошибка во время загрузки данных.');
});
}
$(document).ready(function() {
$.address.init();
if ($.address.parameter("usedAttributes") != undefined) {
var arr = String($.address.parameter("usedAttributes")).split(",");
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
var value = String(arr[i]).split(":");
usedAttributes.push(arr[i]);
$("#attribute_" + value[1]).addClass("selected");
}
}
}
if ($.address.parameter("page") != undefined) {
page = $.address.parameter("page");
}
if ($.address.parameter("qpp") != undefined) {
qpp = $.address.parameter("qpp");
}
if ($.address.parameter("sortType") != undefined) {
sortType = $.address.parameter("sortType");
}
if ($.address.parameter("view") != undefined) {
view = $.address.parameter("view");
if(view == 'cell') {
$(".product-filter .cell").removeClass("disabled").addClass("enabled");
$(".product-filter .list").removeClass("enabled").addClass("disabled");
$(".product-filter .list-2").removeClass("enabled").addClass("disabled");
}
if(view == 'list') {
$(".product-filter .cell").removeClass("enabled").addClass("disabled");
$(".product-filter .list").removeClass("disabled").addClass("enabled");
$(".product-filter .list-2").removeClass("enabled").addClass("disabled");
}
if(view == 'list-2') {
$(".product-filter .cell").removeClass("enabled").addClass("disabled");
$(".product-filter .list").removeClass("enabled").addClass("disabled");
$(".product-filter .list-2").removeClass("disabled").addClass("enabled");
}
}
if (usedAttributes.length > 0 || page != 1 || qpp != 20 || sortType != 0) {
callGetData(false);
}
});
function addToCart(product_id, href){
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: 'product_id=' + product_id,
dataType: 'json',
success: function(json) {
if (json['error']) {
location = json['redirect'];
}
if (json['success']) {
location = "/index.php?route=checkout/cart";
}
}
});
}
Товаров на странице
из 7 Сортировка
Показано с 1 по 7 из 7 (всего 1 страниц)
© 2009-2013 Прицел.ру - поставка из США Все права защищены