test

{% assign is_active = false %}
{% assign item_info = item | split:'_' %} 
{% assign flsaleid = item_info[0] %}
{% assign is_active = item_info[1] %}
{% assign _handle = item_info[2] %}
{% assign quantity = item_info[3] %}
{% assign sl_sold = item_info[4] %}
{% assign discount_f = item_info[5] %}
{% assign progress = quantity | minus: sl_sold | times: 100 | divided_by: quantity %}		
{% assign product = collections.all.products[_handle] %}
{% assign list_tag = collections.all.products[_handle].tags %}
{% assign product_price = product.variants.first.price %}
{% assign on_sale = true %}
{% if product.variants.first.compare_at_price > 0 and product.variants.first.compare_at_price > product.variants.first.price%}
{% assign product_price = product.variants.first.compare_at_price %}
{% endif %}

{% assign price_sale = 0 %}

{% if 100 >= discount_f  %} 
{% assign discount_percent = discount_f %}
{% assign percent_after = 100 | minus: discount_percent %}
{% assign price_sale = product_price | times: percent_after | divided_by:100 %}

{% else %}

{% assign discount = discount_f | times: 100 %}
{% assign discount_percent = discount | divided_by: product_price | times: 100 | round: 0%}
{% assign price_sale =  product_price | minus: discount%}

{% endif %}
{%- if product -%}
<div class=" col-md-3 col-sm-4 col-xs-6 pro-loop">
<style>
	.best {
		top: 40px!important;
    margin: 0;
    background: #fff!important;
    color: #000!important;
    border: 1px solid #000;
	}
</style>
<div class="product-block product-resize item product-item product-sale-ldp product-fl" data-anmation="{{forloop.index}}" data-id="{{flsaleid}}">
	<div class="product-img">
		<div class="product-sale">
		<span class="percent">{% if is_active != false and price_sale != 0 %}{{ discount_percent }}{%else%}?{%endif%}</span>
			<span class="txt">%</span>
		</div>
		{% if best %}<div class="product-sale best"><span>BEST</span></div>{% endif %}		
		{% if sold_out %}<div class="sold-out"><span>Hết hĂ ng</span></div>{% endif %}	
		{% if settings.promotion_hrvapp_use and settings.promotion_hrvapp == 'appbuyxgety' %}
		<div class="gift product_gift_label hidden" data-id="{{product.id}}">
			<img src="{{settings.appbuyxgety_icon}}" alt="icon quĂ  tặng">
		</div>
		{% endif %}
		<a href="{{product.url}}" title="{{product.title}}" class="image-resize">
			<picture>
				<source media="(max-width: 767px)" srcset="{%if product.images.size > 0%}{{ product.featured_image.src | product_img_url: 'large' }}{%else%}{{'no_image.jpg' | asset_url}}{%endif%}">
				<source media="(min-width: 768px)" srcset="{%if product.images.size > 0%}{{ product.featured_image.src | product_img_url: 'grande' }}{%else%}{{'no_image.jpg' | asset_url}}{%endif%}">
				<img class="img-loop" alt="{% if product.featured_image.alt.size >0 %}{{ product.featured_image.alt | escape }}{% else%} {{product.title}} {% endif %}" src="{%if product.images.size > 0%}{{ product.featured_image.src | product_img_url: 'grande' }}{%else%}//hstatic.net/0/0/global/design/theme-default/no-image.png{%endif%}"  />
			</picture>
			{% if product.images.size > 1 %}{% endif %}
			<picture>
				<source media="(max-width: 767px)" srcset="{% if product.images.size > 1 %}{{ product.images[1] | product_img_url: 'large' }}{%else%}{%if product.images.size > 0%}{{ product.featured_image.src | product_img_url: 'large' }}{%else%}{{'no_image.jpg' | asset_url}}{%endif%}{%endif%}">
				<source media="(min-width: 768px)" srcset="{% if product.images.size > 1 %}{{ product.images[1] | product_img_url: 'grande' }}{%else%}{%if product.images.size > 0%}{{ product.featured_image.src | product_img_url: 'grande' }}{%else%}{{'no_image.jpg' | asset_url}}{%endif%}{%endif%}">
				<img class="img-loop img-hover" alt="{% if product.featured_image.alt.size > 1 %}{{ product.featured_image.alt | escape }}{% else%} {{product.title}} {% endif %}" src="{% if product.images.size > 1 %}{{ product.images[1] | product_img_url: 'grande' }}{%else%}{{ product.featured_image.src | product_img_url: 'grande' }}{%endif%}"/>
			</picture>
		</a>
		{% if settings.promotion_hrvapp_use %}
		<div class="button-add">
			<button type="button" title="Xem chi tiết" class="action" onclick="window.location='{{product.url}}';">Xem chi tiết</button>
		</div>
		{% else %}
		<div class="button-add">
			<a href="{{ product.url }}" style="width: 100%;">
				<button type="submit" title="Mua ngay" class="action" style="height: 100%;">Mua ngay</button>
			</a>
			<button type="submit" title="ThĂªm vĂ o giỏ" class="action add-to-cart" data-variantid="{{ product.variants.first.id }}">ThĂªm vĂ o giỏ</button>
		</div>	
		{% endif %}
	</div>
	<div class="product-detail clearfix  {{is_active}}">
		{% if is_active == 'False' %}
		<div class="box-pro-detail">
			<h3 class="pro-name">
				<a href="{{product.url}}" title="{{product.title}}">
					{{ product.title }}
				</a>
			</h3>
			<div class="box-pro-prices">
				<p class="pro-price {% if on_sale %}highlight{% endif %}">
					{% if price_sale >= 1000000 %}
					{% assign hideNumber = price_sale | append: '' | slice: 0, 2  %}
					{% assign hideNumberCheck = hideNumber | slice: 1  %}
					{% else %}
					{% assign hideNumber = price_sale | append: '' | slice: 0, 1  %}
					{% assign hideNumberCheck = hideNumber | slice: 0  %}
					{% endif %}
					{% assign hideNumberApp = hideNumber | replace_first: hideNumberCheck, '?' %}
					<span class="{{price_sale}}">{{ price_sale | money | replace_first: hideNumber, hideNumberApp }}</span> 
					<span class="pro-price-del">{% if on_sale %}<del class="compare-price">{{ product_price | money}}</del>{% endif %}</span>
				</p>
			</div>
			
		</div>
		<div class="starbaprv-widget starbaprv-preview-badge starbaprv-preview-badge--with-link" data-id="{{product.id}}" data-url="{{product.handle}}">
			{% if product.metafields.starbap['starbaprv.badge']%}
			{{product.metafields.starbap['starbaprv.badge']}}
			{% endif %}
		</div>
		{%else%}
		<div class="box-pro-detail">
			<h3 class="pro-name">
				<a href="{{product.url}}" title="{{product.title}}">
					{{ product.title }}
				</a>
			</h3>
			<div class="box-pro-prices">	
				<p class="pro-price {% if on_sale %}highlight{% endif %} ">
					<span>{{ product.variants.first.price | money }}</span> 
					<span class="pro-price-del">{% if on_sale %}<del class="compare-price">{{ product.variants.first.compare_at_price | money}}</del>{% endif %}</span>
				</p>
				<div class="inventory-product">
					<div class="flash-sale-progress-bar__wrapper flash-sale-progress-bar__wrapper--home-page">
						<div class="flash-sale-progress-bar flash-sale-progress-bar--home-page"> 
							<div class="flash-sale-progress-bar__text">{% if 0 >= progress %}ChĂ¡y hĂ ng{% else %}{%if 40 > progress %}Sắp chĂ¡y hĂ ng{% else %}ÄĂ£ bĂ¡n {{sl_sold}}{% endif %}{% endif %}</div>
							<div class="flash-sale-progress-bar__complement-wrapper flash-sale-progress-bar__complement-wrapper--home-page">
								<div class="flash-sale-progress-bar__complement-sizer flash-sale-progress-bar__complement-sizer--home-page" style="{% if sl_sold == 0 %}width: 100%;{% else %}width: {{progress}}%{% endif %}">
									<div class="flash-sale-progress-bar__complement-color"></div>
								</div>
							</div>
							<div class="flash-sale-progress-bar__fire"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="starbaprv-widget starbaprv-preview-badge starbaprv-preview-badge--with-link" data-id="{{product.id}}" data-url="{{product.handle}}">
			{% if product.metafields.starbap['starbaprv.badge']%}
			{{product.metafields.starbap['starbaprv.badge']}}
			{% endif %}
		</div>
		{%endif%}

	</div>
</div>
</div>
{%- endif -%}
<script>
	$(document).ready(function(){
		var jsonData = '',mainpro='{{product.handle}}';
		$.ajax({
			type: "GET",
			url: '/?view=flashsale-json',
			async: false,
			cache: true,
			success: function(data){
				debugger;
				jsonData = JSON.parse(data);
				var checkhasfirst = false;
				$.each(jsonData.flashsale,function(i,v){
					if(v.handle == mainpro){
						if(v.is_active == "True"){
							var html = `
<div class="fsbanner">
<svg viewBox="0 0 108 21" height="21" width="108" class="flash-sale-logo flash-sale-logo--white">
<g fill="currentColor" fill-rule="evenodd">
<path d="M0 16.195h3.402v-5.233h4.237V8H3.402V5.037h5.112V2.075H0zm29.784 0l-.855-2.962h-4.335l-.836 2.962H20.26l4.723-14.12h3.576l4.724 14.12zM26.791 5.294h-.04s-.31 1.54-.563 2.43l-.797 2.744h2.74l-.777-2.745c-.252-.889-.563-2.43-.563-2.43zm7.017 9.124s1.807 2.014 5.073 2.014c3.13 0 4.898-2.034 4.898-4.384 0-4.463-6.259-4.147-6.259-5.925 0-.79.778-1.106 1.477-1.106 1.672 0 3.071 1.245 3.071 1.245l1.439-2.824s-1.477-1.6-4.47-1.6c-2.76 0-4.918 1.718-4.918 4.325 0 4.345 6.258 4.285 6.258 5.964 0 .85-.758 1.126-1.457 1.126-1.75 0-3.324-1.462-3.324-1.462zm12.303 1.777h3.402v-5.53h5.054v5.53h3.401V2.075h-3.401v5.648h-5.054V2.075h-3.402zm18.64-1.678s1.692 1.915 4.763 1.915c2.877 0 4.548-1.876 4.548-4.107 0-4.483-6.492-3.871-6.492-6.36 0-.987.914-1.678 2.08-1.678 1.73 0 3.052 1.224 3.052 1.224l1.088-2.073s-1.4-1.501-4.12-1.501c-2.644 0-4.627 1.738-4.627 4.068 0 4.305 6.512 3.87 6.512 6.379 0 1.145-.952 1.698-2.002 1.698-1.944 0-3.44-1.48-3.44-1.48zm19.846 1.678l-1.166-3.594h-4.84l-1.166 3.594H74.84L79.7 2.174h2.623l4.86 14.021zM81.04 4.603h-.039s-.31 1.382-.583 2.172l-1.224 3.752h3.615l-1.224-3.752c-.253-.79-.545-2.172-.545-2.172zm7.911 11.592h8.475v-2.192H91.46V2.173H88.95zm10.477 0H108v-2.192h-6.064v-3.772h4.645V8.04h-4.645V4.366h5.753V2.174h-8.26zM14.255.808l6.142.163-3.391 5.698 3.87 1.086-8.028 12.437.642-8.42-3.613-1.025z"></path>
	</g>
	</svg>
<svg height="20" viewBox="0 0 20 20" width="20" class="shopee-svg-icon iconClock ">
<g fill="none" fill-rule="evenodd" stroke="#fff" stroke-width="1.8" transform="translate(1 1)">
<circle cx="9" cy="9" r="9"></circle>
<path d="m11.5639648 5.05283203v4.71571528l-2.72832027 1.57129639" stroke-linecap="round" stroke-linejoin="round" transform="matrix(-1 0 0 1 20.39961 0)"></path>
	</g>
	</svg>
<div class="endIn">Kết thĂºc trong</div>
<div class="shopee-countdown-timer">
<div class="shopee-countdown-timer__number">
<span class="countdown-so countdown-ngay"></span>	
	</div>
<div class="shopee-countdown-timer__colon shopee-countdown-timer__colon--flashing-off">
<div class="colon-dot__wrapper"><span class="colon-dot"></span></div>
<div class="colon-dot__wrapper"><span class="colon-dot"></span></div>
	</div>
<div class="shopee-countdown-timer__number">
<span class="countdown-so countdown-gio"></span>	
	</div>
<div class="shopee-countdown-timer__colon shopee-countdown-timer__colon--flashing-off">
<div class="colon-dot__wrapper"><span class="colon-dot"></span></div>
<div class="colon-dot__wrapper"><span class="colon-dot"></span></div>
	</div>
<div class="shopee-countdown-timer__number">
<span class="countdown-so countdown-phut"></span>	
	</div>
<div class="shopee-countdown-timer__colon shopee-countdown-timer__colon--flashing-off">
<div class="colon-dot__wrapper"><span class="colon-dot"></span></div>
<div class="colon-dot__wrapper"><span class="colon-dot"></span></div>
	</div>
<div class="shopee-countdown-timer__number">
<span class="countdown-so countdown-giay"></span>	
	</div>
	</div>

	</div>`;
							if(checkhasfirst == false){
								checkhasfirst = true;
								$('.flashsale-wrap').prepend(html).addClass('active-flashsale');
								$('#add-to-cart').attr('data-max',v.quantity);
								$('#add-to-cart').removeClass('loading');
								$('#add-to-cartbottom').removeClass('loading');
								if(v.is_buyone == 'True'){
									$('#add-to-cart').attr('data-buyone','true');
								}
								dayjs.extend(dayjs_plugin_customParseFormat);
								var countDownDate = new Date(dayjs(v.countdown, "DD/MM/YYYY HH:mm").format()).getTime();;
								var x = setInterval(function() {
									var now = new Date().getTime();
									var distance = countDownDate - now;
									var days = Math.floor(distance / (1000 * 60 * 60 * 24));
									var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
									var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
									var seconds = Math.floor((distance % (1000 * 60)) / 1000);
									$('.countdown-ngay').html(days + 'd');
									$('.countdown-gio').html(hours + 'h');
									$('.countdown-phut').html(minutes);
									$('.countdown-giay').html(seconds);
									if (distance < 0) {
										clearInterval(x);
										$('.fsbanner').hide();
									}
								}, 1000);
							}
						}
						else{
							var html = '';
							if($(window).width() > 768){
							html = `
<div class="flex items-center flashsale-comming">
<svg viewBox="0 0 108 21" height="21" width="108" class="flash-sale-logo flash-sale-logo--default"><g fill="currentColor" fill-rule="evenodd"><path d="M0 16.195h3.402v-5.233h4.237V8H3.402V5.037h5.112V2.075H0zm29.784 0l-.855-2.962h-4.335l-.836 2.962H20.26l4.723-14.12h3.576l4.724 14.12zM26.791 5.294h-.04s-.31 1.54-.563 2.43l-.797 2.744h2.74l-.777-2.745c-.252-.889-.563-2.43-.563-2.43zm7.017 9.124s1.807 2.014 5.073 2.014c3.13 0 4.898-2.034 4.898-4.384 0-4.463-6.259-4.147-6.259-5.925 0-.79.778-1.106 1.477-1.106 1.672 0 3.071 1.245 3.071 1.245l1.439-2.824s-1.477-1.6-4.47-1.6c-2.76 0-4.918 1.718-4.918 4.325 0 4.345 6.258 4.285 6.258 5.964 0 .85-.758 1.126-1.457 1.126-1.75 0-3.324-1.462-3.324-1.462zm12.303 1.777h3.402v-5.53h5.054v5.53h3.401V2.075h-3.401v5.648h-5.054V2.075h-3.402zm18.64-1.678s1.692 1.915 4.763 1.915c2.877 0 4.548-1.876 4.548-4.107 0-4.483-6.492-3.871-6.492-6.36 0-.987.914-1.678 2.08-1.678 1.73 0 3.052 1.224 3.052 1.224l1.088-2.073s-1.4-1.501-4.12-1.501c-2.644 0-4.627 1.738-4.627 4.068 0 4.305 6.512 3.87 6.512 6.379 0 1.145-.952 1.698-2.002 1.698-1.944 0-3.44-1.48-3.44-1.48zm19.846 1.678l-1.166-3.594h-4.84l-1.166 3.594H74.84L79.7 2.174h2.623l4.86 14.021zM81.04 4.603h-.039s-.31 1.382-.583 2.172l-1.224 3.752h3.615l-1.224-3.752c-.253-.79-.545-2.172-.545-2.172zm7.911 11.592h8.475v-2.192H91.46V2.173H88.95zm10.477 0H108v-2.192h-6.064v-3.772h4.645V8.04h-4.645V4.366h5.753V2.174h-8.26zM14.255.808l6.142.163-3.391 5.698 3.87 1.086-8.028 12.437.642-8.42-3.613-1.025z"></path></g></svg>
<div class="flashsale-comming-text">BẮT ĐẦU SAU ${v.comming}</div>
<svg enable-background="new 0 0 11 11" viewBox="0 0 11 11" x="0" y="0" class="shopee-svg-icon icon-arrow-right"><path d="m2.5 11c .1 0 .2 0 .3-.1l6-5c .1-.1.2-.3.2-.4s-.1-.3-.2-.4l-6-5c-.2-.2-.5-.1-.7.1s-.1.5.1.7l5.5 4.6-5.5 4.6c-.2.2-.2.5-.1.7.1.1.3.2.4.2z"></path></svg>
	</div>
`;
							}
							else{
								html = `
<div class="flash-sale-coming-soon-product-band">
<div class="flash-sale-coming-soon-product-band__left">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="flash-sale-coming-soon-product-band-icon"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 1C1.44772 1 1 1.44772 1 2V14C1 14.5523 1.44772 15 2 15H14C14.5523 15 15 14.5523 15 14V2C15 1.44772 14.5523 1 14 1H2ZM9.41779 7.16033H11.7983C11.9618 7.16033 12.0742 7.37034 11.9414 7.52036L7.47657 12.9308C7.35396 13.0908 7.07811 12.9508 7.11897 12.7408L7.92612 9.08048C7.96698 8.95047 7.8546 8.83046 7.73199 8.83046H5.31057C5.09601 8.83046 4.95298 8.62044 5.01428 8.41043L6.7716 3.35003C6.85333 3.15001 7.04746 3 7.28245 3H11.0525C11.3079 3 11.451 3.27002 11.3284 3.48004L9.22367 6.8503C9.14194 6.97031 9.2441 7.16033 9.41779 7.16033Z"></path></svg>
<div class="flash-sale-coming-soon-product-band-text">
<div>Flash Sale bắt đầu lĂºc ${v.comming}</div><div></div></div></div>
<div class="flash-sale-coming-soon-product-band__right"><svg enable-background="new 0 0 11 11" viewBox="0 0 11 11" role="img" class="stardust-icon stardust-icon-arrow-right"><path stroke="none" d="m2.5 11c .1 0 .2 0 .3-.1l6-5c .1-.1.2-.3.2-.4s-.1-.3-.2-.4l-6-5c-.2-.2-.5-.1-.7.1s-.1.5.1.7l5.5 4.6-5.5 4.6c-.2.2-.2.5-.1.7.1.1.3.2.4.2z"></path></svg></div>
	</div>
`;
							}
							if(checkhasfirst == false){
								checkhasfirst = true;
								$('.flashsale-wrap').append(html).addClass('inactive-flashsale');
							}
							
						}
					}
				});
			}
		});
	})
</script>
0 sản phẩm
0₫
Xem chi tiết
GIỎ HÀNG
Chat Facebook (8h00 - 21h00)
Chat Zalo (8h00 - 21h00)
1900.2037 (8h00 - 21h00)
url