$(window).load(function(){ if(isNaN(parseInt($('.header-menu > ul > li').css('z-index'))) == false && $(window).width() > 768) { $('.header-menu .s_submenu').each(function(){ $(this).parents('li').addClass('active'); var width = 0; $(this).find('div').each(function(){ width += $(this).outerWidth(); }); $(this).width(width+5); $(this).parents('li').removeClass('active'); }); } var product_grid_highest_name = 0; $('.s_listing.s_grid_view .s_item h3').each(function() { if(product_grid_highest_name < $(this).height()) { product_grid_highest_name = $(this).height(); } }); $('.s_listing.s_grid_view .s_item h3').height(product_grid_highest_name + 'px'); var product_grid_highest_name = 0; $('.jcarousel .s_item h3').each(function() { if(product_grid_highest_name < $(this).height()) { product_grid_highest_name = $(this).height(); } }); $('.jcarousel .s_item h3').height(product_grid_highest_name + 'px'); }); /* Inline scripts */ //catalog\view\theme\shoppica2\template\tb\intro\images.tpl var slideEffect = 'fade'; $(function(){ if($(window).width() < 768 && $('#breadcrumbs').size()) { var bread_top = $('#breadcrumbs').offset().top; if(bread_top) { $('body, html').animate({ scrollTop: bread_top }, 800); } else { $('body, html').animate({ scrollTop: $('h1:first').offset().top }, 800); } } $('.ocfilter .box-heading').on('click', function(){ $(this).next().toggle(400); }); //Callme /* $('.callme > span').on('click', function(){ $('.callme .s_submenu').fadeIn(); }); $('.callme .close').on('click', function(){ $('.callme .s_submenu').fadeOut(); }); */ $('#callme_button').on('click', function(){ var phone = $('.callme .s_submenu [name="callme_phone"]').val(); var name = $('.callme .s_submenu [name="callme_name"]').val(); if(!phone) { alert('Введите номер телефона!'); $('.callme .s_submenu [name="callme_phone"]').focus(); return false; } else if(!name) { alert('Введите имя!'); $('.callme .s_submenu [name="callme_name"]').focus(); return false; } $.post( '/callme.php', { name: name, phone: phone }, function(){ alert('Мы позвоним в ближайшее время'); $('.callme .s_submenu').fadeOut(); $('.callme .s_submenu [name="callme_phone"]').val(""); $('.callme .s_submenu [name="callme_name"]').val(""); } ); }); //buy_oneclick $('.buy_oneclick .close').on('click', function(){ $('.buy_oneclick .s_submenu').fadeOut(); $('.buy_oneclick .success_call').hide(); }); $('#buy_oneclick_button').on('click', function(){ var phone = $('.buy_oneclick .s_submenu [name="buy_oneclick_phone"]').val(), product_id = $('#product_add_to_cart_form input[name=\'product_id\']').val();; if(!phone) { alert('Введите номер телефона!'); $('.buy_oneclick .s_submenu [name="buy_oneclick_phone"]').focus(); return false; } $.post( '/callme.php', { name: 'Купить в один клик', phone: phone, product_id: product_id }, function(){ $('.buy_oneclick .success_call').fadeIn(); } ); }); //catalog\view\theme\shoppica2\template\tb\header.tpl $.widget("tb.tbTabs", $.ui.tabs, {}); $.each($sReg.get("/tb/category_path").split("_"), function(number, id){ $("#menu_" + id).addClass("s_selected"); }); //catalog\view\theme\shoppica2\template\tb\menu.tpl /*$('.header-menu > ul > li').on('click', function(e) { $('.header-menu > ul > li').removeClass('active'); if($(this).find('.s_category_group').size()) { $(this).addClass('active'); if(!$(e.target).closest(".s_submenu").size()) return false; } }); $(document).on('click', function(e) { if($(e.target).closest(".header-menu > ul > li").size()) return; $('.header-menu > ul > li').removeClass('active'); }); */ //catalog\view\theme\shoppica2\template\module\featured.tpl if(typeof(jQuery.jcarousel) != 'undefined') { //catalog\view\theme\shoppica2\template\product\product.tpl // if($('#related_products .jcarousel ul li').length > 5 && $(window).width() > 767) { // $('#related_products .jcarousel ul').jcarousel({ // visible: 5, // scroll: 1, // wrap: 'circular' // }); // } if($('#product_gallery ul li').length > 3) { $('#product_images #product_gallery').css('padding-top', '16px'); $('#product_gallery .s_thumbs li').css({'margin-left':'0', 'margin-right':'0'}); $('#product_gallery ul').jcarousel({ visible: 3, scroll: 1, vertical: $(window).width() > 767 ? true : false }); } //var related_products_per_line = Math.floor($('#related_products').width() / 74); //if($('#related_products ul li').length > related_products_per_line) { $('#related_products .s_thumbs li').css({'margin-left':'0', 'margin-right':'0'}); // $('#related_products ul').jcarousel({ // visible: related_products_per_line, // scroll: 1, // vertical: false // }); // } } //catalog\view\theme\shoppica2\template\product\product_options.tpl $('a[href="#sizes_table"]').on('click', function() { $.colorbox({html:'
'+$('#sizes_tables').html()+'
', width:'720', height:'600'}); $(".t_tabs").tbTabs({ fx: { opacity: 'toggle', duration: 300 } }); return false; }); $('.product_sizes .size').on('click', function() { $('.product_sizes .size').removeClass('active'); $(this).addClass('active'); var opt_name = $(this).parent().data('value'); var opt_value = $(this).data('value'); $('select[name="' + opt_name + '"]').val(opt_value); return false; }); var opt_value = $('select[name="option[]"]').val(); if (opt_value) $('.product_sizes .size[data-value="' + opt_value + '"]').addClass('active'); $('input[name="callme_phone"]').not(".inputmask-processed").inputmask({mask: '+38(099) 999-99-99', showMaskOnHover: false}).addClass('inputmask-processed'); $('.phone-mask').not(".inputmask-processed").inputmask({mask: '+38(099) 999-99-99', showMaskOnHover: false}).addClass('inputmask-processed'); $('#bingc-passive-close-button').click(function(){ $('.bingc-passive').addClass('bingc-passive-closed'); }) $('#add_to_cart_oneclick').click(function(){ $('#bingc-type').val(1); $('.bingc-passive').removeClass('bingc-passive-closed'); }); $('.bingc-show, .callme > span').click(function(){ $('.bingc-passive').removeClass('bingc-passive-closed'); }) }); //catalog\view\theme\shoppica2\template\product\product.tpl if(typeof(product_id) != 'undefined') { jQuery( function($) { $(document).on('click', '.mousetrap', function() { var product_gallery = ''; $('#product_gallery li a').each(function(){ product_gallery += ''; }); $.colorbox({html:'\
\ '+(product_gallery ? '
'+product_gallery+'
' : '')+'\ \
\ '}); return false; }); $(document).on('click', '.full_image .left img', function() { $('.full_image > img').prop('src', $(this).prop('src')); return false; }); function set_product_info() { var w = $("html").width(); if (w < 768) { $(".s_tabs").tbTabs("destroy"); $(".s_tab_box").accordion ({ autoHeight: false, collapsible: true, active: false }); } else { $(".s_tab_box").accordion("destroy"); $(".s_tabs").tbTabs({ fx: { opacity: 'toggle', duration: 300 } }); } } set_product_info(); $("#product_images a.s_thumb").bind("click", function() { $("#product_image_preview > img").attr("src", ($(this).attr("href"))); $("#product_images a.s_thumb").removeAttr("selected"); $(this).attr("selected", "selected"); return false; }); $("#product_image_preview").bind("click", function() { var current_image = $('#product_images a.s_thumb[selected="selected"]'); if (!current_image.is("a")) { next_image = $("#product_images a.s_thumb:first"); } else { var next_image = current_image.parent("li").next("li").find("a.s_thumb"); if (!next_image.is("a")) { next_image = $("#product_images a.s_thumb:first"); } current_image.removeAttr("selected"); } next_image.attr("selected", "selected"); if (!next_image.is("a")) { next_image = $("#product_images a.s_thumb:first"); } $("#product_image_preview > img").attr("src", next_image.attr("href")); return false; }); $(".s_review_write, .s_total a").bind("click", function() { $('.s_tabs').tbTabs('select', '#product_reviews'); }); $('#review .pagination a').live('click', function() { $('#review').slideUp('slow'); $('#review').load(this.href); $('#review').slideDown('slow'); return false; }); $('#review').load('index.php?route=product/product/review&product_id='+product_id); }); function review() { $.ajax({ type: 'POST', url: 'index.php?route=product/product/write&product_id='+product_id, dataType: 'json', data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()), beforeSend: function() { $('#review_button').attr('disabled', 'disabled'); $('#review_title').after('
'); }, complete: function() { $('#review_button').attr('disabled', ''); $('.wait').remove(); }, success: function(data) { if (data.error) { simpleNotice('Error!', data.error, 'failure'); } if (data.success) { simpleNotice('Success!', data.success, 'success'); $('input[name=\'name\']').val(''); $('textarea[name=\'text\']').val(''); $('input[name=\'rating\']:checked').attr('checked', ''); $('input[name=\'captcha\']').val(''); } } }); } } $('#add_to_cart').bind('click', function() { var product_id = $('#product_add_to_cart_form input[type=\'hidden\']').val(); $.ajax({ url: 'index.php?route=tb/cartCallback', type: 'post', data: $('#product_add_to_cart_form input[type=\'text\'], #product_add_to_cart_form input[type=\'hidden\'], #product_add_to_cart_form input[type=\'radio\']:checked, #product_add_to_cart_form input[type=\'checkbox\']:checked, #product_add_to_cart_form select, #product_add_to_cart_form textarea'), dataType: 'json', success: function(json) { $("#product_options p.s_error_msg").remove(); if (json['error']) { if (json['error']['warning']) { productNotice(json['title'], json['thumb'], json['error']['warning'], 'failure'); $('.warning').fadeIn('slow'); } for (i in json['error']) { $('div[data-value="option[' + i + ']"]').after('

' + json['error'][i] + '

'); } } if (json['success']) { productNotice(json['title'], json['thumb'], json['success'], 'success', 'center', product_id); $('#cart_menu span.s_grand_total').html(json['total_sum']); } } }); return false; }); $('#add_to_cart_once').bind('click', function() { var product_id = $('#product_add_to_cart_form input[name=\'product_id\']').val(); $.ajax({ url: 'index.php?route=tb/cartCallback', type: 'post', data: $('#product_add_to_cart_form input[type=\'text\'], #product_add_to_cart_form input[type=\'hidden\'], #product_add_to_cart_form input[type=\'radio\']:checked, #product_add_to_cart_form input[type=\'checkbox\']:checked, #product_add_to_cart_form select, #product_add_to_cart_form textarea'), dataType: 'json', success: function(json) { $("#product_options p.s_error_msg").remove(); if (json['error']) { if (json['error']['warning']) { productNotice(json['title'], json['thumb'], json['error']['warning'], 'failure'); $('.warning').fadeIn('slow'); } for (i in json['error']) { $('div[data-value="option[' + i + ']"]').after('

' + json['error'][i] + '

'); } } if (json['success']) { productNotice(json['title'], json['thumb'], json['success'], 'success', 'center', product_id); $('#cart_menu span.s_grand_total').html(json['total_sum']); } } }); return false; }); // $('#add_to_cart_oneclick').bind('click', function() { // $(this).next('.s_submenu').fadeToggle(); // $('.buy_oneclick .success_call').hide(); // $('input[name="buy_oneclick_phone"]').not(".inputmask-processed").inputmask({mask: '+38(099) 999-99-99', showMaskOnHover: false}).addClass('inputmask-processed'); // return false; // }); //catalog\view\theme\shoppica2\template\product\product_options.tpl jQuery(document).ready(function () { $('.date').datepicker({ dateFormat: 'yy-mm-dd', beforeShow: function(input, inst) { var newclass = 's_jquery_ui'; if (!inst.dpDiv.parent().hasClass('s_jquery_ui')) { inst.dpDiv.wrap('
') } } }); $('.datetime').datetimepicker({ dateFormat: 'yy-mm-dd', timeFormat: 'h:m', beforeShow: function(input, inst) { var newclass = 's_jquery_ui'; if (!inst.dpDiv.parent().hasClass('s_jquery_ui')) { inst.dpDiv.wrap('
') } } }); $('.time').timepicker({ timeFormat: 'h:m', beforeShow: function(input, inst) { var newclass = 's_jquery_ui'; if (!inst.dpDiv.parent().hasClass('s_jquery_ui')) { inst.dpDiv.wrap('
') } } }); }); //if(typeof(payment) !== 'undefined') { $(document).on('click', '#button-confirm', function() { $.ajax({ type: 'get', url: 'index.php?route=payment/'+payment+'/confirm', success: function() { location = '/checkout/success/'; } }); }); //} if(typeof(route) !== 'undefined' && route === 'checkout/checkout') { jQuery(function(){ jQuery('#cart_total').html(cart_total); jQuery('#cart-total').html(cart_total); jQuery('#cart_menu .s_grand_total').html(cart_total); if (simple_show_weight) { jQuery('#weight').text(weight); } if (template == 'shoppica2') { jQuery('#cart_menu div.s_cart_holder').html(''); $.getJSON('index.php?'+tpl_joomla_route+'route=tb/cartCallback', function(json) { if (json['html']) { jQuery('#cart_menu span.s_grand_total').html(json['total_sum']); jQuery('#cart_menu div.s_cart_holder').html(json['html']); } }); } if (template == 'shoppica') { jQuery('#cart_menu div.s_cart_holder').html(''); jQuery.getJSON('index.php?'+tpl_joomla_route+'route=module/shoppica/cartCallback', function(json) { if (json['output']) { jQuery('#cart_menu span.s_grand_total').html(json['total_sum']); jQuery('#cart_menu div.s_cart_holder').html(json['output']); } }); } }); } $(function(){ if(typeof(ocfilter) === 'object') { var options = { element: { priceScale : $('#scale-price-'+ocfilter.module), // Slide scale element priceMin : $('#min-price-value-'+ocfilter.module), // Price min field priceMax : $('#max-price-value-'+ocfilter.module), // Price max field priceFrom : $('#price-from-'+ocfilter.module),// Price from elemenet priceTo : $('#price-to-'+ocfilter.module), // Price to elemenet submitButton : $('#button-submit-'+ocfilter.module), floatButton : $('#button-float-'+ocfilter.module), scales : $('.scale-'+ocfilter.module) }, php: { module : ocfilter.module, minPrice : ocfilter.minPrice, maxPrice : ocfilter.maxPrice, minPriceValue: ocfilter.minPriceValue, maxPriceValue: ocfilter.maxPriceValue, showButton : ocfilter.showButton, showPrice : ocfilter.showPrice, showCounter : ocfilter.showCounter, manualPrice : ocfilter.manualPrice, total : ocfilter.total, link : ocfilter.link, path : ocfilter.path, params : ocfilter.params, index : ocfilter.index }, text: { show_all: ocfilter.show_all, hide : ocfilter.hide, load : ocfilter.load, any : ocfilter.any, select : ocfilter.select }, sliders : [] }; /* */ $('#ocfilter-'+ocfilter.module).ocfilter(options); } }); $(document).on('click','.open-all',function(){ $('.category-tags').addClass('active'); return false; }); $(document).on('click','.hide-all',function(){ $('.category-tags').removeClass('active'); return false; }); $(document).on('click','#bingc-passive-phone-form-button',function(){if($('#bingc-passive-get-phone-form .phone-mask').val()==''){alert('Введите телефон.');$('#bingc-passive-get-phone-form .phone-mask').focus();return false;}$.post('/callback.php',$(this).parent().serialize(),function(data){ $('.bingc-we-will-call-you').html(data); $('.bingc-passive-get-phone-form').hide(); });return false;});