    <span class="close float-right  icon-cross-medium close-icon" rel="{$productPage|default:''}" data-dismiss="modal"></span>
            <h4 class="modal-title">{$language.lblChooseYourFreeGiftProduct}</h4>
            {assign var="freeinc" value="0"}
            {foreach $resProductsFree|default:array() as $resProducts}
                
              {assign var="freeinc" value=$freeinc+1}
            <div class="gift-listing clearfix  p-2">
                <div class="itemName clearfix">
                    {if $resProducts['free']|count>0}
                    <img src="{$view_images}/free-gift.png" alt="free gift" class="float-right mx-2">
                    {/if}
                     {if isset( $resProducts['productImage']) &&  $resProducts['productImage']!=''}
                            {assign var="image" value="{$view_public_path}/uploads/catalog/product/thumb/{$resProducts['productImage']}"}
                    {else}
                            {assign var="image" value="{$view_images}/not-av-img.gif"}
                    {/if}
                   
                    <input type="hidden" name="totAddedFreeGifts_{$resProducts.productID}" id="totAddedFreeGifts_{$resProducts.productID}" value="{$resProducts.totAddedFreeGifts}">
                    <div class="item-image d-none d-md-block">
                        <img id="img_01" src="{$image}" class="img-fluid" alt="{$resProducts.productTitle}" title="{$resProducts.productTitle}"/>
                    </div>
                  <figcaption>
                      {html->anchor href="{$resProducts.productID|sef_path:'product'}"  title="{$language.lblViewDetails}" class="h6 font-rglr m-0" content="{$resProducts.productTitle}"}                    
                    {if $resProducts.brandName|default:'' neq ''}<p class="d-none d-md-block h6 font-rglr">{$resProducts.brandName}</p>{/if}                    
                  </figcaption>
                  {if $resProducts['freeProductsCount']|default:'' neq '' && $resProducts['free']|count!=$resProducts['freeProductsCount']}
                       <p class="d-none d-md-block h6 font-rglr">
                           {$language.lblFreePurchase} <strong>{$resProducts['freeProductsCount']*$resProducts.totQty}</strong> {$language.lblFreePurchaseGift}                    
                       </p>
                       <p class="d-none d-md-block h6 font-rglr selected-gift pt-2{if $resProducts.totAddedFreeGifts|default:'' <=0} hide {/if}">
                           <strong class="selected-gift-no">{$resProducts.totAddedFreeGifts}</strong> {$language.lblFreePurchaseGift} {$language.lblselectedtext}
                       </p>
                  {/if}
                  </div>
                    <div class="clearfix gift-slider p-2"> 
                        {foreach $resProducts['free']|default:array() as $resProduct key="key"}
                            {assign var="productID" value=$resProduct.productID}
                            {assign var="productOptionID" value=$resProduct.productOptionID}
                            {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="uniqueID" value=$uniqueID|default:''}
                            {assign var="selectedProductID" value=$resProduct.productID}
                            {assign var="customOption" value=$resProduct.customOption}

                            <div class="p-0 thumb"  rel="product_{$productID}" uniqueID="{$uniqueID}">
                                <div class="imageBox border mx-2 p-2">
                                      <div class="image-thumb position-relative text-center m-0">                                     
                                        {if isset( $resProduct['productImage']) &&  $resProduct['productImage']!=''}
                                                {assign var="image" value="{$view_public_path}/uploads/catalog/product/thumb/{$resProduct['productImage']}"}
                                        {else}
                                                {assign var="image" value="{$view_images}/not-av-img.gif"}
                                        {/if}
                                       <figure class="m-0">
                                           {html->anchor  class="no-anim"  href="{$resProduct.productID|sef_path:'product':$originCatalogID|default:0}" content="<img src='{$image}' class='img-fluid' alt='{$resProduct.productTitle}' title='{$resProduct.productTitle}'>"}

                                       </figure>
                                        <!-- days left ends -->
                                    </div>
                                    <div class="product-info-block mt-3">

                                     <h2 class="font-small">{html->anchor href="{$resProduct.productID|sef_path:'product':$originCatalogID|default:0}" content="{$resProduct.productTitle|truncate:45}" class="text-dark"}
                                    </h2>
                                    <div> {if $resProduct.sellAsBatch eq 'Yes'}<span class="font-small text-medium">{$language.lblSetof}
                                        {$resProduct.qtyPerBatch}   {$resProduct.batchType} </span>{/if} </div>
                                       <div class="price-box" >
                                        {*<strong class="price dark" id="product-price-free">{$offerPrice|price:''}</strong> *}
                                       </div>                                   
                                       {include file="{$pageLayout}FreeProductOptions.tpl"}
                                       {include file="{$pageLayout}FreeProductsCustomOption.tpl"}
                                        <div id="stock-not-avilable_{$resProduct.productID}_{$freeinc}" class="soldout font-sml curve-r5" style="display:none;">          
                                            <span class="soldout message_error error-xs mb-2">{$language.lblOutOfStock|upper}</span>                                        
                                          </div>
                                          <div id="combination-not-avilable_{$resProduct.productID}_{$freeinc}" class="message_error error-xs" style=" display:none;">          
            {$language.lblCombinationNotFound|upper}
      </div>
                                      <div class="more-option1 text-center">
                                            <div class="freeadded_{$resProduct.productID}_{$freeinc} {if ($resProduct.itemExists<=0 ||  ($resProduct.itemExists>0 && (((count($customOption)>0 || $resProduct['options']|count>1) && $resProducts['totFreeCnt']<=0) || $resProducts['totFreeCnt']<=0)))}hide{/if} {if $resProduct.itemExists>0} prdadded_{$resProducts.productID} {/if}" >{html->anchor class="btn btn-outline-secondary btn-block btn-sm" caption="<span class='align-middle d-inline-block icon-shopping-cart mr-1'></span>{$language.lblAddedToCart}"}</div>                              
                                          
                                            {if $resProduct.productOptionQuantitySum <1 && ($resProduct.InventoryTrackLevel=='Product' || $resProduct.InventoryTrackLevel=='Combination')} 
                                                 <div class="soldout ">{$language.lblSoldOut|upper}</div>
                                            {else} 
                                                    {assign var="addtocartlbl" value=""}
                                                    {assign var="updateCls" value=""}
                                                    {if $resProducts['totFreeCnt']<=0 && $resProduct.itemExists<=0}
                                                        {assign var="addtocartlbl" value="{$language.lblAddtoCart}"}
                                                        {assign var="updateCls" value="add_btn_free_{$resProducts.productID}"}
                                                    {else}
                                                        {if ((count($customOption)>0 || $resProduct['options']|count>0) && $resProducts['totFreeCnt']<=0  && $resProduct.itemExists>0)}

                                                            {assign var="addtocartlbl" value="{$language.lblUpdate}"}
                                                            {assign var="updateCls" value="update_btn_free_{$resProducts.productID}"}
                                                        {/if}
                                                    {/if}
                                                    {if $addtocartlbl neq ''}
                                                        {assign var="relData" value=$resProduct.productID|cat:"-"|cat:$resProduct.productOptionID|cat:"-"|cat:$resProduct.businessID|default:0|cat:"-"|cat:$freeinc|default:''}                        
                                                        {html->anchor free="{$resProducts.productID}" fgc="{$resProducts['freeProductsCount']*$resProducts.totQty}" attrs="{$resProduct.productMinBuyLimit}~{$resProduct.productMaxBuyLimit}~{$resProduct.productMaxGiftBuy}~{$resProduct.productDefaultCurrency}~{$resProduct.InventoryTrackLevel}~{count($customOption)}~{$resProduct['options']|count}"  id="addfromlistfree" class="btn btn-outline-secondary btn-block btn-sm buynow_link buynow  freeprodcls_{$resProduct.productID}_{$freeinc} {$updateCls}" caption="<span class='align-middle d-inline-block icon-shopping-cart mr-1'></span>{$addtocartlbl}" rel=$relData}
                                                    {/if}
                                            {/if}
                                      </div>

                                    </div>
                                </div>
                          </div>

                          {/foreach}
                    </div>
            </div>
                
               
          {/foreach}
           <script type="text/javascript">	                    
                    var freeProducts = {$allfreeProducts|default:''};
                    
                   
                </script>   
                
          <span class="close bottom close-icon  btn btn-primary" data-dismiss="modal" rel="{$productPage|default:''}">{$language.lblclosetext}</span>

<script type="text/javascript">
      $(document).ready(function() {
                $('.gift-slider').slick({
                infinite: false,
                dots: false,
	              speed: 700,
                centerPadding:'10px',
                prevArrow: '<span class="sli-arrow  slick-prev left icon-left-thin"></span>',
                nextArrow: '<span class="sli-arrow right slick-next icon-right-thin"></span>', 
                items: 4,
		      	slidesToShow: 4,
				slidesToScroll: 4,
				responsive: [
                    {
				      breakpoint: 360,
				      settings: {
				        slidesToShow: 1,
				        slidesToScroll: 1
				      }
				    },
				    {
				      breakpoint: 600,
				      settings: {
				        slidesToShow: 2,
				        slidesToScroll: 2
				      }
				    },
                    {
				      breakpoint: 800,
				      settings: {
				        slidesToShow: 3,
				        slidesToScroll: 3
				      }
				    }
                    
			  	]
            });
          
          
          $('.modal').on('shown.bs.modal', function (e) {
            $('.gift-slider').resize(); 
          })

        if (window.matchMedia('(max-width: 768px)').matches){
            $(".item-caption").click(function(){
                if ( $(this).parents(".gift-listing").hasClass("active") ) {
                    $(this).parents(".gift-listing").removeClass("active");
                    $(this).parents(".itemName").next(".gift-slider").slideUp();
                }
                else{
                    $(".gift-listing").removeClass("active");
                    $(".specification").slideUp();
                    $(this).parents(".gift-listing").addClass("active");
                    $(this).parents(".itemName").next(".gift-slider").slideDown();
                    
                }
            });
        }  
          
      });
      