Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
below my javascript:


sj_vm_deal_437 this id was using javascript. how to use datalist in this id





HTML
<script type="text/javascript">
//<![CDATA[
        if (typeof  Virtuemart !== 'undefined') {
        Virtuemart.addtocart_popup = 1;
        usefancy = "1";
        vmLang = "";
        window.vmSiteurl = "http://demo.smartaddons.com/templates/joomla3/sj-maxshop/";
		var _carts =  jQuery("#sj_vm_deal_437").find('form');
		_carts.each(function(){
		var _cart = jQuery(this),
		_addtocart = _cart.find('input.addtocart-button');
		_addtocart.on('click',function(e) {
			Virtuemart.sendtocart(_cart);
			return false;
			});	
		});
		}
     			
jQuery(document).ready(function ($) {
	
	 $("#sj_vm_deal_437 .addtocart-button input").val('');
	 $("#sj_vm_deal_437 .addtocart-button input").parent().append('<i class="fa fa-gift"></i>');
	 var total_product = '8';
	var owl = $("#sj_vm_deal_437 .owl-carousel");
			var nb_column1 = 4,
			nb_column2 = 2,
			nb_column3 = 2,
			nb_column4 = 1;
			owl.owlCarousel({
                nav: 1,
                dots: false,
                margin: 30,
                loop:  0,
                autoplay: 0,
                autoplayHoverPause: 1,
                autoplayTimeout: 5000,
                autoplaySpeed: 2000,
                mouseDrag: 1,
                touchDrag: 1,
                navRewind: true,
                navText: [ '<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>' ],
                responsive: {
                    0: {
                        items: nb_column4,
                        nav: total_product <= nb_column4 ? false : ((1) ? true: false),
                    },
                    480: {
                        items: nb_column3,
                        nav: total_product <= nb_column3 ? false : ((1) ? true: false),
                    },
                    768: {
                        items: nb_column2,
                        nav: total_product <= nb_column2 ? false : ((1) ? true: false),
                    },
                    1200: {
                        items: nb_column1,
                        nav: total_product <= nb_column1 ? false : ((1) ? true: false),
                    },
                }
            });

	  $("#sj_vm_deal_437 .item .item-rating").each(function(){
		  var item = $(this);
		  var rating = item.attr('data-rating');
		  if(parseFloat(rating) > 4.5){
			   item.find('.item-star').addClass('item-rating-chose');
		  }else{
			  for(var i = 0; i < 5; i++){
				  var a = i + 1;
				  var b = parseFloat(a) + 0.5;
				  var c = parseFloat(a) - 0.5;
				  if((c < parseFloat(rating)  && parseFloat(rating) < b) || b < parseFloat(rating)){
					  item.find('.item-star').eq(i).addClass('item-rating-chose');
				  }
			  }			  
		  }
		  
	  });
	  	 function mktime(time){
		 var array_time = time.split(' ');
		 var array_year = array_time[0].split('-');
		 var array_minus = array_time[1].split(':');
		  a=new Date()
		  a.setHours(array_minus[0]);
		  a.setSeconds(array_minus[2]);
		  a.setMinutes(array_minus[1]);
		  a.setDate(array_year[2]);
		  a.setYear(array_year[0]);
		  a.setMonth(array_year[1]);
		  return a.getTime();
	}
	var array_time = new Array();
	var time_now = mktime('2015-12-25 04:43:02');
	var i = 0;
	$("#sj_vm_deal_437 .owl-carousel .item").each(function(){
		var mk_time = $(this).find('.item-deals').attr('data-deals');
		if(typeof mk_time != 'undefined'){
		array_time[i] = mktime(mk_time);
		var minutes = 1000 * 60;
		var hours = minutes * 60;
		var days = hours * 24;
		var years = days * 365;
		var html_day = parseInt((parseInt(array_time[i]) - parseInt(time_now))/days);
		var html_hours =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days)/hours);
		var html_minus = parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
		var html_seconds =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
		$(this).find('.item-deals').html('<div class="sj_deals_cd_day">'+(html_day)+'<p>Days</p></div><div class="sj_deals_cd_day">'+html_hours+'<p>Hours</p></div><div class="sj_deals_cd_day">'+html_minus+'<p>Mins</p></div><div class="sj_deals_cd_day">'+html_seconds+'<p>Secs</p></div>');
		i++;
		}
	});
		var mk_time = $("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.item-deals').attr('data-deals');
		if(typeof mk_time != 'undefined'){
		var mk_time_first_product = mktime(mk_time);
		var minutes = 1000 * 60;
		var hours = minutes * 60;
		var days = hours * 24;
		var years = days * 365;
		var html_day = parseInt((parseInt(mk_time_first_product) - parseInt(time_now))/days);
		var html_hours =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days)/hours);
		var html_minus = parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
		var html_seconds =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
		$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.item-deals').html('<div class="sj_deals_cd_day">'+(html_day)+'<p>Days</p></div><div class="sj_deals_cd_day">'+html_hours+'<p>Hours</p></div><div class="sj_deals_cd_day">'+html_minus+'<p>Mins</p></div><div class="sj_deals_cd_day">'+html_seconds+'<p>Secs</p></div>');
		}
	setInterval(function(){
		time_now = time_now + 1000;
		var i = 0;
		$("#sj_vm_deal_437 .owl-carousel .item").each(function(){
			var minutes = 1000 * 60;
			var hours = minutes * 60;
			var days = hours * 24;
			var years = days * 365;
			var html_day = parseInt((parseInt(array_time[i]) - parseInt(time_now))/days);
			var html_hours =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days)/hours);
			var html_minus = parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
			var html_seconds =  parseInt((parseInt(array_time[i]) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(0).html(html_day + '<p>Days</p>');
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(1).html(html_hours + '<p>Hours</p>');
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(2).html(html_minus + '<p>Mins</p>');
			$(this).find('.item-deals').find('.sj_deals_cd_day').eq(3).html(html_seconds + '<p>Secs</p>');
			i++;
		});
			var minutes = 1000 * 60;
			var hours = minutes * 60;
			var days = hours * 24;
			var years = days * 365;
			var html_day = parseInt((parseInt(mk_time_first_product) - parseInt(time_now))/days);
			var html_hours =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days)/hours);
			var html_minus = parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours)/minutes);
			var html_seconds =  parseInt((parseInt(mk_time_first_product) - parseInt(time_now) - html_day*days - html_hours*hours - html_minus*minutes)/1000);
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(0).html(html_day + '<p>Days</p>');
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(1).html(html_hours + '<p>Hours</p>');
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(2).html(html_minus + '<p>Mins</p>');
			$("#sj_vm_deal_437 .sj_vm_deals_first_product .item").find('.sj_deals_cd_day').eq(3).html(html_seconds + '<p>Secs</p>');
	}, 1000);
	  	  setTimeout(function(){
			$('.sj_quickview_handler').html('<i class="fa fa-search"></i>');
	  },1500);
	  
	  $("#sj_vm_deal_437 .sj_percentage_discount_display").each(function(){
		  if($(this).find('a').length > 0){
			  var html = $(this).find('a').html();
			  $(this).html(html);
		  }		  
	  })
	  });
//]]>
</script>
Posted
Comments
dan!sh 5-Jan-16 0:46am    
Is sj_vm_deal_437 defined somewhere in your HTML? Update that part in your question.
MohamedEliyas 5-Jan-16 1:08am    
yes this was using one div class and id below i will be updated...
MohamedEliyas 5-Jan-16 1:09am    
<div class="sj_vm_deals_wrap sj_relative" id="sj_vm_deal_437">



<div class="item-inner-title-module">



<div class="sj_vm_border">
<div class="item-inner-title-module-title">Hot Deals</div>
</div>


<div class="owl-carousel owl-theme">

<asp:DataList ID="list" runat="server" RepeatDirection="Horizontal" >
<itemtemplate>


<div class="item" >
<div class="sj_relative">
<div class="item-inner">
<div class="item-image">
<asp:ImageButton ID="image" class="item-image" PostBackUrl='<%#Eval("product_id","productdetail.aspx?product_id={0}") %>' ImageUrl='<%#Eval("product_image","LargeUpload/{0}") %>' Width="180" Height="180" runat="server">
<asp:Label ID="lbl_largeimage" runat="server" Visible="false" Text='<%# Bind("product_image") %>'>
<span class="image-border" > </span>

</div>
<div class="item-title">
<asp:Label ID="lbl_productname" runat="server" Text='<%#Eval("product_name") %>' >
<asp:Label ID="lblproduct_id" Visible="false" runat="server" Text='<%#Eval("product_id") %>' >
</div>
<div class="item-prices">
<div class="item-prices-override"><div class="PricesalesPrice vm-display vm-price-value" ><span class="PricesalesPrice" >
$<asp:Label ID="price" runat="server" Text='<%#Eval("product_price") %>' ></span></div>
</div>
<div class="item-prices-final"><div class="PricesalesPrice vm-display vm-price-value" ><span class="PricesalesPrice" >
$<asp:Label ID="lbl_product_offerprice" runat="server" Text='<%#Eval("product_offerprice") %>' ></span></div>
</div></div></div>
<div class="sj_vm_deals_popup sj_absolute"><div class="item-addtocart">
<div class="addtocart-area">

<%--
<div class="product js-recalculate">--%>

<div class="vm-customfields-wrap">
</div>

<div class="addtocart-bar">
<div class="wrap-qty">
<div class="qty-title">
<span class="quantity_box">Quantity: </span>
</div>
<div class="qty-set">
<span class="quantity-box">
<input type="text" class="quantity-input js-recalculate" name="quantity[]"
/>
<input type="button" value="plus" class="quantity-controls quantity-plus"/>
<input type="button" value="minus" class="quantity-controls quantity-minus"/>
</span>
</div>
</div>
<div class="addtocart-button">

<asp:Button ID="Button1" OnClick="addtocart_2_Click" runat="server" Text="Button">

</div> <input type="hidden" name="virtuemart_product_id[]" value="25"/>
<noscript><input type="hidden" name="task" value="add"/></noscript>
</div>
<input type="hidden" name="option" value="com_virtuemart"/>
<input type="hidden" name="view" value="cart"/>
<input type="hidden" name="virtuemart_product_id[]" value="25"/>
<input type="hidden" name="pname" value="Enma ruka pite"/>
<input type="hidden" name="pid" value="25"/>
<input type="hi
Sergey Alexandrovich Kryukov 5-Jan-16 2:30am    
It's possible that the inquirer does not understand the role of id, and maybe even the use of ASP.NET in general; and the code sample does not seem reasonable or comprehensible — please see my comment below.
—SA

1 solution

Instead of datalist use Reapeater
 
Share this answer
 
Comments
Arasappan 29-Jan-16 23:53pm    
y they are unvoting..after the answer was accepted..:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900