Thông số kỹ thuật
“;
});
$(“.autocomplete-suggestions”).html(htmlResult);
$(“.autocomplete-suggestions”).show();
});
} else {
$(“.autocomplete-suggestions”).hide();
}
}
$(document).ready(function(){
var curr_text = “”;
var count_select = 0;
var curr_element=””;
getListStock();
var textarea = document.getElementById(“text_search”);
detectPaste(textarea, function(pasteInfo) {
inputString = pasteInfo.text;
search(inputString);
});
$(“#text_search”).bind(‘keyup’,function(b) {
inputString = $(this).val();
search(inputString);
});
$(‘body’).click(function(){
$(“.autocomplete-suggestions”).hide();
});
});
$.get(“/ajax/get_json.php?action=deal&action_type=list&type=started&show=10”, function(data, status){
var data = JSON.parse(data);
$(“#count-total-deal”).text(data.total);
});
function getListStock(){
var sku = “”;
$(“#skupro”).each(function(){
sku+=$(this).attr(“data-sku”);
});
var jsonUrl = “/upload/stockpa.php?function=getFeed&skupro=”+sku;
var storeList = “”;
$.getJSON( jsonUrl, function(data) {
Object.keys(data).forEach(function (key) {
var name = data[key][‘tencuahang’];
storeList+=”“;
console.log(name);
});
$(“#stock-list”).html(storeList);
});
}
function isOnScreen(elem) {
// if the element doesn’t exist, abort
if( elem.length == 0 ) {
return;
}
var $window = jQuery(window)
var viewport_top = $window.scrollTop()
var viewport_height = $window.height()
var viewport_bottom = viewport_top + viewport_height
var $elem = jQuery(elem)
var top = $elem.offset().top
var height = $elem.height()
var bottom = top + height
return (top >= viewport_top && top viewport_top && bottom viewport_height && top = viewport_bottom)
}
function getProductList(url, holder, limit, actionLoad, catId) {
//actionLoad = replace or append
$.getJSON(url, function(result) {
var data = result.list;
var html = “”;
Object.keys(data).forEach(function(key, keyIndex) {
if (keyIndex parseInt(price)) {
discount = Math.ceil(100 – price * 100 / marketPrice);
}
var specialOffer = “”;
if (data[key].specialOffer.length > 0) specialOffer = data[key].specialOffer[0].title;
if (typeof catId === ‘undefined’) catId = 0;
if (typeof actionLoad === ‘undefined’) {
actionLoad = ‘replace’;
}
var abc= “buyProduct(‘” + productId + “‘,0,1,’/cart’)”;
html += “
//html += ‘‘;
html += ‘
html += ‘‘;
html += ‘‘;
if (catId == 145 || catId == 228) html += ‘
‘ + productName + ‘
‘;
else html += ‘‘ + productName + ‘‘;
if (discount > 0) {
html += ‘-‘ + discount + ‘%‘;
html += ‘Giá niêm yết: ‘ + formatCurrency(marketPrice) + ‘ ₫‘;
giakm=”Giá bán: “;
} else {
html += ‘‘;
giakm=”Giá bán: “;
}
html += ‘‘+ giakm + priceFormat +’ ₫‘;
if (data[key].productType.isNew == 1) html += ‘
if (specialOffer != ”) html += ‘‘;
if (data[key].productType.tra_gop_0 == 1) html += ‘Trả góp 0%‘;
html += ‘‘;
if(data[key].condition == ‘A’ || data[key].condition == ‘a’)
{
html += ‘Giỏ hàng‘;
}
html+=’‘;
html += ‘
‘;
html += ‘
html += ‘‘ + productName + ‘‘;
if (data[key].brand.image != ”)
html += ‘‘;
html += ‘
‘;
html += ‘
Giá ưu đãi: | Giá bán: | ‘; html += ‘‘ + priceFormat + ‘‘; html += ‘‘; if (data[key].hasVAT == 1) html += ‘[Đã bao gồm VAT]’; if (data[key].hasVAT == 2) html += ‘[Chưa bao gồm VAT]’; html += ‘‘; html += ‘ |
Bảo hành: | ‘ + warranty + ‘ | |
Kho hàng: | ‘; if (data[key].condition == ‘A’ || data[key].condition == ‘a’) html += ‘Sở hữu hàng’; else if ((data[key].condition == ‘F’ || data[key].condition == ‘f’) && (data[key].quantity ‘; html += ‘ |
‘;
if (productSummary != ”) {
html += ‘
‘;
html += ‘
html += ‘Mô tả tóm tắt:
‘;
html += ‘
‘;
html += ‘
‘;
}
if (specialOffer != ”) {
html += ‘
‘;
html += ‘
html += ‘Khuyến mại:
‘;
html += ‘
‘;
html += ‘
‘;
}
html+=’
‘;
html += ‘
‘;
}
});
if (actionLoad == ‘replace’) $(holder).html(html);
else $(holder).append(html);
});
}
function getProductCollection(url,holder,limit,actionLoad,catId){
//actionLoad = replace or append
$.getJSON(url,function(result){
var data = result.list;
var html=””;
Object.keys(data).forEach(function(key,keyIndex){
if(keyIndex price) {
discount = Math.ceil(100 – price * 100 / marketPrice);
}
var specialOffer = “”;
if(data[key].specialOffer.length > 0) specialOffer=data[key].specialOffer[0].content;
if (typeof catId === ‘undefined’) catId = 0;
if (typeof actionLoad === ‘undefined’) { actionLoad = ‘replace’; }
html+=’
html+=’‘;
html+=’
html+=’‘+productName+’‘;
html+=’‘+priceFormat+’‘;
if(marketPrice > price && price > 0){
html+=’
html+=’ -‘+discount+’%
‘;
}
html+=’
‘;
html+=’
‘;
}
});
if(actionLoad==’replace’) $(holder).html(html);
else $(holder).append(html);
});
}
if($(“#collection-bestsale”).length > 0) getProductCollection(“/ajax/get_json.php?action=collection&action_type=list&id=49&show=5″,”#collection-bestsale”,5);
function showImagePrice(){
var arr_price;
$(“.img_price”).each(function(){
str_price = $(this).text().trim();
if(str_price !=’Liên hệ’ && str_price !=’Contact’ && $(this).find(“span”).length == 0){
arr_price = str_price.split(“”);
for(i=0;i”;
if(arr_price[i] == 1) arr_price[i] = ““;
if(arr_price[i] == 2) arr_price[i] = ““;
if(arr_price[i] == 3) arr_price[i] = ““;
if(arr_price[i] == 4) arr_price[i] = ““;
if(arr_price[i] == 5) arr_price[i] = ““;
if(arr_price[i] == 6) arr_price[i] = ““;
if(arr_price[i] == 7) arr_price[i] = ““;
if(arr_price[i] == 8) arr_price[i] = ““;
if(arr_price[i] == 9) arr_price[i] = ““;
if(arr_price[i] == ‘.’) arr_price[i] = ““;
if(i> arr_price.length – 4) arr_price[i]=””;
}
$(this).html(arr_price);
}
});
var arr_full_price;
$(“.img_price_full”).each(function(){
str_price = $(this).text().trim();
if(str_price !=’Liên hệ’ && str_price !=’Contact’ && $(this).find(“span”).length == 0){
arr_price = str_price.split(“”);
for(i=0;i”;
if(arr_price[i] == 1) arr_price[i] = ““;
if(arr_price[i] == 2) arr_price[i] = ““;
if(arr_price[i] == 3) arr_price[i] = ““;
if(arr_price[i] == 4) arr_price[i] = ““;
if(arr_price[i] == 5) arr_price[i] = ““;
if(arr_price[i] == 6) arr_price[i] = ““;
if(arr_price[i] == 7) arr_price[i] = ““;
if(arr_price[i] == 8) arr_price[i] = ““;
if(arr_price[i] == 9) arr_price[i] = ““;
if(arr_price[i] == ‘.’) arr_price[i] = ““;
if(arr_price[i] == “VNĐ”) arr_price[i] = “”;
}
$(this).html(arr_price);
}
});
}
$(document).ready(function(){
showImagePrice();
});
$(document).ajaxStop(function(){
showImagePrice();
});
//TOOLTIP
function tooltip(){
var w_tooltip = $(“#tooltip”).width();;
var h_tooltip = 0;
var pad = 10;
var x_mouse = 0; var y_mouse = 0;
var wrap_left = 0;
var wrap_right = 0;
var wrap_top = 0;
var wrap_bottom = 0;
$(“.product-list .p-img”).mousemove(function(e){
if($(this).parents(“li”).find(“.hover-content-pro”).length == 0) return false;
content_tooltip = $(this).parents(“li”).find(“.hover-content-pro”);
$(“#tooltip”).html(content_tooltip.html());
wrap_left = 0;
wrap_top = $(window).scrollTop();
wrap_bottom = $(window).height();
wrap_right = $(window).width();
x_mouse = e.pageX;
y_mouse = e.pageY;
h_tooltip = $(“#tooltip”).height();
if(x_mouse + w_tooltip > wrap_right) $(“#tooltip”).css(“left”,x_mouse – w_tooltip – pad);
else $(“#tooltip”).css(“left”,x_mouse + pad);
if(y_mouse – h_tooltip
‘;
html+=’
| Thích nhất