'
+''
+'
'
+'
- '+ old_price +' '+price+'
'
+'
'
// console.log($strHTML);
$countViewedItem = $countViewedItem + 1;
} //
} // endfor: arrProIndex
} // endif: jsonProIndex
return $strHTML;
}// get_vied_items_html
/*** add to cart ***/
// <<<<<< product BEGIN
function refreshProductSelections($tagSelectOption0, $option0, $tagSelectOption1 , $option1, $tagSelectOption2, $option2)
{
if($option0 != null && $option0 != '')
{
//change option 0
$($tagSelectOption0 + ' option[value="'+$option0+'"]').prop('selected', true); // option-0 => Shape... okok
$($tagSelectOption0).change();
}
if($option1 != null && $option1 != '')
{
//change option 1
$($tagSelectOption1 + ' option[value="'+$option1+'"]').prop('selected', true); // option-1 => Color... okok
$($tagSelectOption1).change();
}
if($option2 != null && $option2 != '')
{
//change option 2
$($tagSelectOption2 + ' option[value="'+$option2+'"]').prop('selected', true); // option-1 => Color... okok
$($tagSelectOption2).change();
}
}
function update_variant(variant, $tagPrice, $tagPriceCompare, $tagAddToCart, $tagProductSection)
{
//console.log(Bizweb.formatMoney(variant.price, "{{amount_no_decimals_with_comma_separator}}₫"));
var $unit_price = 0;
var $unit_price_compare = 0;
if(variant != null && variant.available==true )
{
$unit_price = variant.price;
//console.log(Bizweb.formatMoney(variant.price, "{{amount_no_decimals_with_comma_separator}}₫"));
if(variant.price < variant.compare_at_price){
$unit_price_compare = variant.compare_at_price;
//show onsale label
$($tagProductSection).find('.sticker-sale').removeClass('hidden');
} else{
//hide onsale label... nono: find matching ids: ('[id^="ProductDetails"]')
$($tagProductSection).find('.sticker-sale').addClass('hidden');
}
$($tagAddToCart).html('Thêm vào giỏ');
$($tagAddToCart).removeAttr('disabled');
}
else{
$($tagAddToCart).html('Hết hàng');
$($tagAddToCart).prop('disabled', true);
}
var $strUnitPrice = Bizweb.formatMoney($unit_price,"{{amount_no_decimals_with_comma_separator}}₫"); // '' shop.money_format
//console.log($strUnitPrice);
var $strUnitPriceCompare = Bizweb.formatMoney($unit_price_compare,"{{amount_no_decimals_with_comma_separator}}₫"); // '' shop.money_format
$($tagPrice).html($strUnitPrice);
if($unit_price_compare > 0)
{
$($tagPriceCompare).html($strUnitPriceCompare);
}
else
$($tagPriceCompare).html('');
$($tagProductSection).find('.unit_price_not_formated').val($unit_price);
// update_total();
}
//ajax: add to cart
function addItem(form_id, fly_img) {
$.ajax({
type: 'POST',
url: '/cart/add.js',
dataType: 'json',
async: false,
data: $('#'+form_id).serialize(),
success: onSuccess(fly_img, '#'+form_id),
error: onError,
cache: false
});
}
onSuccess = function(fly_img, form_id) {
flyToElement($(fly_img), $('.top-cart-block'));
//update top cart: qty, total price
var $product_page = $(form_id).parents('[class^="product-page"]');
var quantity = parseInt($product_page.find('[name="quantity"]').val(), 10) || 1;
var $item_qty_new = 0;
var $item_price_new = 0;
var $item_price_increase = 0;
var $boUpdated = false;
//insert "no_item" html
if($('.top-cart-block .top-cart-content .top-cart-item').size() <= 0)
{
$('.top-cart-block .top-cart-content').html(top_cart_no_item);
}
//update items
$('.top-cart-block .top-cart-content .top-cart-item').each(function(){
if($(this).find('.item_id').val() == $product_page.find('[name="variantId"]').val() ){
$item_qty_new = parseInt($(this).find('.item_qty').val()) + quantity ;
$item_price_single = parseFloat($(this).find('.item_unit_price_not_formated').val());
$item_price_new = $item_qty_new * $item_price_single;
$item_price_increase = quantity * parseFloat($(this).find('.item_unit_price_not_formated').val());
$(this).find('.item_qty').val($item_qty_new); // !!!
$(this).find('.top-cart-item-quantity').html('x ' + $item_qty_new);
$(this).find('.top-cart-item-price').html(Bizweb.formatMoney($item_price_new,"{{amount_no_decimals_with_comma_separator}}₫")); // '' shop.money_format
$boUpdated = true; // updated item
}
});
if($boUpdated == false){ // current item is not existed!!!
var $proURL = $product_page.find('.product_url').val();
var $proTitle = $product_page.find('.product_title_hd').val();
var $proUnitPrice = parseFloat($product_page.find('.unit_price_not_formated').val());
var $strNewItem = ''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
//+ '
x'+ quantity +''
+ '
' + $proTitle + ''
+ '
'+ Bizweb.formatMoney(($proUnitPrice * quantity),"{{amount_no_decimals_with_comma_separator}}₫") + ''
+ '
x '+ quantity +''
+ '
'
+ '
';
$('.top-cart-block .top-cart-content .top-cart-items').append($strNewItem);
$item_price_increase = $proUnitPrice * quantity;
}
//check is emptiness...
check_topcart_empty();
//update total
var $quantity_new = parseInt($('.top-cart-block #top-cart-trigger span').text()) + quantity;
var $price_new = parseFloat($('.top-cart-block .top_cart_total_price_not_format').val()) + $item_price_increase;
$('.top-cart-block .top_cart_total_price_not_format').val($price_new); // !!!
$('.top-cart-block #top-cart-trigger span').html($quantity_new);
$('.top-cart-block .top-checkout-price').html(Bizweb.formatMoney($price_new,"{{amount_no_decimals_with_comma_separator}}₫"));
$('.cart_total').html(Bizweb.formatMoney($price_new,"{{amount_no_decimals_with_comma_separator}}₫"));
};
var onError = function() {
}
var top_cart_empty = ' Chưa có sản phẩm trong giỏ!
';
var top_cart_no_item = '';
function check_topcart_empty(){
//Bạn chưa mua sản phẩm nào!
if($('.top-cart-block .top-cart-content .top-cart-item').size() <= 0)
{
top_cart_no_item = $('.top-cart-block .top-cart-content').html();
$('.top-cart-block .top-cart-content').html(top_cart_empty);
$('.top-cart-block .top-cart-content').css('width', '200px');
}
else{
//remove width, okok!!!
$('.top-cart-block .top-cart-content').css('width', '');
}
}
jQuery(document).ready(function($){
//select first size&color.
//second item: $($("#colorPicker option").get(1))...
$("#sizePicker option:first").attr('selected', 'selected');
$("#colorPicker option:first").attr('selected', 'selected');
// function: choose size
$('#option-0 select').change(function(){
var $size = $(this).val();
var $color = $('#option-1 select').val();
var $material = $('#option-2 select').val();
var $tagSelectOption0 = '#product-select-option-0';
var $tagSelectOption1 = '#product-select-option-1';
var $tagSelectOption2 = '#product-select-option-2';
refreshProductSelections($tagSelectOption0, $size, $tagSelectOption1 , $color,$tagSelectOption2 , $material);
});
// function: choose color
$('#option-1 select').change(function(){
var $size = $('#option-0 select').val();
var $color = $(this).val();
var $material = $('#option-2 select').val();
var $tagSelectOption0 = '#product-select-option-0';
var $tagSelectOption1 = '#product-select-option-1';
var $tagSelectOption2 = '#product-select-option-2';
refreshProductSelections($tagSelectOption0, $size, $tagSelectOption1 , $color,$tagSelectOption2 , $material);
});
// function: choose material
$('#option-2 select').change(function(){
var $size = $('#option-0 select').val();
var $color = $('#option-1 select').val();
var $material = $(this).val();
var $tagSelectOption0 = '#product-select-option-0';
var $tagSelectOption1 = '#product-select-option-1';
var $tagSelectOption2 = '#product-select-option-2';
refreshProductSelections($tagSelectOption0, $size, $tagSelectOption1 , $color,$tagSelectOption2 , $material);
});
//second item: $($("#colorPicker option").get(1))...
$("#option-0 select option:first").attr('selected', 'selected');
$("#option-1 select option:first").attr('selected', 'selected');
$("#option-2 select option:first").attr('selected', 'selected');
var $size = $("#option-0 select option:first").val();
var $color = $("#option-1 select option:first").val();
var $material = $("#option-2 select option:first").val();
var $tagSelectOption0 = '#product-select-option-0';
var $tagSelectOption1 = '#product-select-option-1';
var $tagSelectOption2 = '#product-select-option-2';
refreshProductSelections($tagSelectOption0, $size, $tagSelectOption1 , $color,$tagSelectOption2 , $material);
//add to cart
$("#addtocart").on('click', function(e) { //.click(function(e){ //
e.preventDefault();
addItem('ProductDetailsForm', '.product-main-image .slider-wrap img');
});
//add to cart for QuickView
$("#addtocartQV").on('click', function(e) { //.click(function(e){ //
e.preventDefault();
addItem('ProductDetailsFormQV', '#product-pop-up .product-main-image img');
});
//check empty for top-cart...
check_topcart_empty();
//change qty...
$('.product-quantity input.quantity').on('change', function(){
var $qty = parseInt($(this).val());
if($qty <= 0){
$(this).parents('[class^="product-page"]').find('[id^="addtocart"]').addClass('disabled');
}
else{
$(this).parents('[class^="product-page"]').find('[id^="addtocart"]').removeClass('disabled');
}
});
});
// >>>>>> product END
\n
\n
\n
","summary":null,"template_layout":null,"available":true,"tags":["giày nữ","giày thể thao","năng động","thời trang","đi chơi"],"price":199000.0000,"price_min":199000.0000,"price_max":199000.0000,"price_varies":false,"compare_at_price":0,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":21684361,"barcode":null,"sku":"GiayNuX15Den081118","title":"Default Title","options":["Default Title"],"option1":"Default Title","option2":null,"option3":null,"available":true,"taxable":false,"price":199000.0000,"compare_at_price":null,"inventory_management":"","inventory_policy":"deny","inventory_quantity":0,"weight_unit":"kg","weight":700,"requires_shipping":true,"image":null}],"featured_image":{"src":"https://bizweb.dktcdn.net/100/060/498/products/x15-s35-1.jpg?v=1541734257727"},"images":[{"src":"https://bizweb.dktcdn.net/100/060/498/products/x15-s35-1.jpg?v=1541734257727"},{"src":"https://bizweb.dktcdn.net/100/060/498/products/x15-s35-2.jpg?v=1541734258710"}],"options":["Title"],"created_on":"2018-11-09T10:30:09","modified_on":"2018-11-09T11:13:30","published_on":"2018-11-09T10:21:00"};
\n
\n
\n
","summary":null,"template_layout":null,"available":true,"tags":["giày nữ","giày thể thao","năng động","thời trang","đi chơi"],"price":199000.0000,"price_min":199000.0000,"price_max":199000.0000,"price_varies":false,"compare_at_price":0,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":21684361,"barcode":null,"sku":"GiayNuX15Den081118","title":"Default Title","options":["Default Title"],"option1":"Default Title","option2":null,"option3":null,"available":true,"taxable":false,"price":199000.0000,"compare_at_price":null,"inventory_management":"","inventory_policy":"deny","inventory_quantity":0,"weight_unit":"kg","weight":700,"requires_shipping":true,"image":null}],"featured_image":{"src":"https://bizweb.dktcdn.net/100/060/498/products/x15-s35-1.jpg?v=1541734257727"},"images":[{"src":"https://bizweb.dktcdn.net/100/060/498/products/x15-s35-1.jpg?v=1541734257727"},{"src":"https://bizweb.dktcdn.net/100/060/498/products/x15-s35-2.jpg?v=1541734258710"}],"options":["Title"],"created_on":"2018-11-09T10:30:09","modified_on":"2018-11-09T11:13:30","published_on":"2018-11-09T10:21:00"};
var strHTML = get_viewed_items_html(current_product);
//console.log(current_product);
});
- Trang chủ
- Giày thể thao nữ mã X15 đen đế trắng
$39.99 $24.99
Libero velit id eaque ex quae laboriosam nulla optio doloribus! Perspiciatis, libero, neque, perferendis at nisi optio dolor!