<script type="text/javascript">
	 var productsCountVar = '{$prodsMaxCount|default:0}';
</script> 

{if  $toAppend|default:'' neq Yes}
<ul class="cateListing gridBg row" id="prodListingUl">
{/if}
	{foreach $resProducts|default:array() as $resProduct key="key" name="highlt"}
		{assign var="productID" value=$resProduct.productID}
		{assign var="productOptionsCount" value=$resProduct['productOptionCount']|default:''}
		{assign var="offerPrice" value=$resProduct['offerPrice']}
		{assign var="productOptionRegularPrice" value=$resProduct['productOptionRegularPrice']}
                {assign var="productOptionCashBack" value=$resProduct['productOptionCashBack']|default:''}
		{assign var="productOptionOfferDiscount" value=$resProduct['productOptionOfferDiscount']|round}
		{assign var="productOptionQuantitySum" value=$resProduct.productOptionQuantitySum} 
		{assign var="item.freeProductsCount" value=$resProduct.freeProductsCount} 
                {assign var="productCurrency" value=$resProduct.productDefaultCurrency}
		{assign var="uniqueID" value=$uniqueID|default:''}
		<li class="col-6 col-sm-4 col-lg-3" rel="product_{$productID}" uniqueID="{$uniqueID}">
			<div class="imageBox p-2 p-lg-3">
              <div class="image-thumb position-relative">
                  {include file="catalog/default/FreeGift.tpl"}
			
                {if $productOptionCashBack|default:'' > 0}
                                    <span class="offerPrice btn-primary">
                                        {$productOptionCashBack|price:'':$productCurrency:$currentCurrencyID}
                                        {$language.lblCashback}
                                    </span>
                                    {/if}
                {if $resProduct['featuredStatus']=='Yes'} <span class='featured'>{$language.lblFeatured}</span>{/if}
                {if $resProduct.isProductDeal|default:'' eq 'Yes'}
                    {*{assign var="dealDiscount" value=$resProduct['dealDiscount']|round}*}
                    {*{if $resProduct['productOptionProductPrice']>0}
                        {assign var="dealOrginalPrice" value=$resProduct['productOptionProductPrice']|round}
                    {else}
                        {assign var="dealOrginalPrice" value=$resProduct['productOptionRegularPrice']|round}
                    {/if}*}
                    {assign var="dealOrginalPrice" value=$resProduct['productOptionRegularPrice']|round}
                    {if $dealOrginalPrice > 0}
                        {assign var="dealDiscount" value=((($dealOrginalPrice-$resProduct['dealPrice']|round)*100)/$dealOrginalPrice)}
                        {if $dealDiscount > 0}
                            <div class="discont">{$dealDiscount|round}<span>%</span> <span class="off">{$language.lblOff|upper}</span></div>
                        {/if}
                    {/if} 
                {else}
                   {if $productOptionOfferDiscount > 0}
                  <div class="discont">{$productOptionOfferDiscount}<span>%</span> <span class="off">{$language.lblOff|upper}</span></div>
                    {/if}   
                {/if}
               <figure>
				{html->anchor href="{$resProduct.productID|sef_path:'product':$originCatalogID|default:0}" class="justify-content-around" title=$language.lblViewDetails content="<img class='lazy img-fluid' data-original='{$view_public_path}/uploads/catalog/product/thumb/{$resProduct.productImage}' src='{$view_images}/list-loader.png' alt='{$resProduct.productTitle}'>"}
               </figure>
                
   <div class="view-section">
               {if $productOptionQuantitySum  && ($resProduct.InventoryTrackLevel!='Product' || $resProduct.InventoryTrackLevel!='Combination')} 
			     	{assign var="layoutType" value="grid"}
					{include file="{$pageLayout}BuyNowMultiBlock.tpl"}
              {/if}
               
            
            </div>
                <!-- days left ends -->
			</div>
<div class="deatils product-info-block">

			<h2 class="productTitle ">{html->anchor href="{$resProduct.productID|sef_path:'product':$originCatalogID|default:0}" content="{$resProduct.productTitle|truncate:45}"}
    </h2>
         {if $resProduct['featuredStatus']=='Yes'} <span class='featured float-right'>{$language.lblFeatured}</span>{/if}
    
    {if $resProduct.sellAsBatch eq 'Yes'}<span class="font-small text-medium">{$language.lblSetof} {$resProduct.qtyPerBatch} {$resProduct.batchType} </span>{/if}
			  
               <div class="price-box mb-1" >
         {*        {if $resProduct['brandKey']!=''}
    
					{html->anchor href="brand/{$resProduct['brandKey']}" class='bpfc brandkey' caption="{$resProduct['brandName']}"}
	
			{/if} *}
                        {if $resProduct.isProductDeal|default:'' eq 'Yes'}
                            {if $productOptionRegularPrice!=$resProduct.dealPrice}
				<del class="regular-price">{$productOptionRegularPrice|price:'':$productCurrency:$currentCurrencyID}</del>
                            {/if} 
                            <strong class="price dark">{$resProduct.dealPrice|price:'':$productCurrency:$currentCurrencyID}</strong> 
                        {else}
                            {if $productOptionRegularPrice!=$offerPrice}
                                <del class="regular-price">{$productOptionRegularPrice|price:'':$productCurrency:$currentCurrencyID}</del>
                            {/if}
                            <strong class="price dark">{$offerPrice|price:'':$productCurrency:$currentCurrencyID}</strong> 
                        {/if}
                     </div>
    <div class="discription">
                    {$resProduct['productDescription']|unescape:"html"|strip_tags|truncate:250}{html->anchor href="{$resProduct.productID|sef_path:'product':$originCatalogID|default:0}" class="pl-2" content="{$language.lblMore}"}
                    </div>
              
        <div class="avg mb-2">
			 
		
                {if $resProduct.comparable eq 'Y'}
            <div class="Comparebx d-none d-lg-inline-block mr-2">
			
			<span class="addtoCompare iconappend2 slip">
		<input type="checkbox" class="compareIt" rel="checkbox_compare_{$productID}" data-id="{$productID}" id ="compare_{$productID}" data-src="{$view_public_path}/uploads/catalog/product/small/{$resProduct.productImage}" data-title="{$resProduct.productTitle|truncate:28}" data-category="{$selCategoryDet['productCategoryName']|default:''}" data-setkey="{$resProduct['attributeSetID']}"/>  <label for='compare_{$productID}'> {$language.lblCompare}</label>
			</span>
            </div>
			{/if}

			  {if $resProduct['productReviewsCount']|default:0 > 0}
            <div class="ratingBx d-inline-block m-0 mt-1">
					{assign var="avgRating" value=$resProduct['ratingTotal']/$resProduct['productReviewsCount']}
					{assign var="avgRating" value=$avgRating|number_format:1}
				<div class="starRating"><div class="rated" style="width:{$avgRating * 20}%"></div></div>{* [ {$resProduct['productReviewsCount']} {$language.lblReviews}  ] *}
				
			  </div>
    		{/if}
  </div>
			<div class="more-option px-3 pb-3 d-flex justify-content-between">
               <div class="AddwishLst pull-left"> 
            {if in_array($resProduct.productID, $listUsersWishListItems)} 
                
				{html->anchor href="user/wishlist/" title="{$language.lblAddedTo} {$language.lblWishlist}" 
				class="addedToWishList icon-heart btn border"  } 
			{else}

				{html->anchor 
				title="{$language.lblAddToWishlist}" 
				class="addToWishList icon-heart-o btn border {if $commonUserID|default:'' > 0} wishlistlogin{/if}" 
							 
				productid="{$resProduct.productID}"} 
			{/if}
            </div>
                 {if $productOptionQuantitySum <1 && ($resProduct.InventoryTrackLevel=='Product' || $resProduct.InventoryTrackLevel=='Combination')} 
                 <div class="btn  btn-outline-secondary soldout ">{$language.lblSoldOut}</div>
                {else}  
                    {if $resProduct.customOptionCount|default:'' > 0 || $resProduct.isProductDeal|default:'' eq 'Yes'}
                        {html->anchor href="{$resProduct.productID|sef_path:'product':$originCatalogID|default:0}" class="btn btn-primary btn-link buynow_link" caption="<span class='icon-shopping-cart mr-1'></span>{$language.lblAddtoCart}"}
                    {else}
                        {assign var="relData" value=$resProduct.productID|cat:"-"|cat:$resProduct.productOptionID|cat:"-"|cat:$resProduct.businessID}                        
                        {html->anchor id="addfromlist" class="btn btn-primary btn-link buynow buynow_link" caption="<span class='icon-shopping-cart mr-1'></span>{$language.lblAddtoCart}" rel=$relData selbusinessKey="{$resProduct.businessKey}" productoptbusid={$resProduct.productOptionBusinessID}}
                    {/if}
                {/if}
			</div>
                
			</div>
			</div>
			 </li>
	{/foreach}
	

{if $toAppend|default:'' neq Yes}</ul>{/if}

{if $toAppend|default:'' neq Yes && $resProducts|default:array()|count ==0}
{include file='IndexNoProduct.tpl'}
{/if}