Boat Other Accessories (2024)

" ).insertAfter( "#ymm_searchbox .formFields ul.dropdowns li."+current_field); }} function hideLoader(){ jQuery('#ymm_loader').remove();} //Reset YMM dropdowns. - 786function resetYMMDropdowns(){ disableSearch(); var c = 0; jQuery("#ymm_searchbox .formFields .dropdowns select[id^=dropdown]").each(function(i, e) { c++; var dropdown_id = jQuery(this).attr("id"); if(c == 1) { jQuery("#"+dropdown_id).val("-1"); } else { jQuery("#"+dropdown_id).val("-1"); jQuery("#"+dropdown_id).prop('disabled',true); } });} function getDropdownsOnload(){ //786 //Empty fitment block is required if it's set - 786 jQuery(".ymm_fitment_block").hide(); jQuery(".ymm_fitment_block").find(".item_fits").html(""); jQuery(".ymm_fitment_block").find(".item_unfits").html(""); //Show YMMbox if it's hidden. jQuery("#ymm_label").css("display","block"); jQuery("#ymm_searchbox").css("display","block"); jQuery.ajax({type: "GET", dataType: 'jsonp', url: data_url,data: "domain="+shop_domain+"&action=onload&load=all&version=updated&ver_no=2",success: function(res) { if(res.html != null) { jQuery(".formFields ul.dropdowns").show().append(res.html); var $dropdowns = jQuery(res.html).find('.ymm-filter'); $dropdowns.find('option:first').each(function () { var curr_drop_id = jQuery(this).parent().attr("id"); var curr_text = jQuery(this).text(); var final_lbl = curr_text.replace('Select',select_lbl); var final_lbl_arr = final_lbl.split("--"); jQuery("#"+curr_drop_id+" option:first").text(final_lbl_arr[0]+" "+final_lbl_arr[1]); }); jQuery(".ymm-filter").find("option[value*='none']").html(none_lbl); var li_element = jQuery(".formFields ul.dropdowns").find('li.ymm_bttns'); if (!li_element.length) { jQuery(".formFields ul.dropdowns").append('

  • ');} }}});} //YMM Product Fitment Function - 786.function getYMMFitmentData(tags){ jQuery.ajax({type: "GET", dataType: 'jsonp', url: data_url,data: "domain="+shop_domain+"&product_id="+ymm_product_id+"&action=get_fitment_data&version=updated&tags="+encodeURIComponent(tags),beforeSend: function() { jQuery('.ymm-fitment-loading').html('Boat Other Accessories (1)').show(); }, success: function(res) { //786 if(typeof res.product_page_response != "undefined") { //Hide YMMbox and show fitments data- 786. jQuery('.ymm-fitment-loading').fadeOut("fast"); jQuery("#ymm_searchbox").hide(); jQuery("#ymm_searchbox").find(".dropdowns").html(""); jQuery(".ymm_fitment_block").show(); //If Item Fits if(res.product_page_response.status == "yes") { jQuery(".ymm_fitment_block").find(".item_unfits").html(""); if(res.product_page_response.fit_type == "exact_fit") { jQuery(".ymm_fitment_block").find(".item_fits").html('

    Boat Other Accessories (2)'+res.product_page_response.ymm_fit_title+'

    '+res.product_page_response.ymm_fit_desc+': '+res.searched_ymm+'

    '); } if(res.product_page_response.fit_type == "universal_fit") { jQuery(".ymm_fitment_block").find(".item_fits").html('

    Boat Other Accessories (3)'+res.product_page_response.ymm_uni_fit_title+'

    '+res.product_page_response.ymm_fit_desc+': '+res.searched_ymm+'

    '); } } //If Item Does Not Fits if(res.product_page_response.status == "no"){ jQuery(".ymm_fitment_block").find(".item_fits").html(""); jQuery(".ymm_fitment_block").find(".item_unfits").html('

    Boat Other Accessories (4)'+res.product_page_response.ymm_unfit_title+'

    '+res.product_page_response.ymm_unfit_desc+': '+res.searched_ymm+'

    '); } // product-template.liquid 添加到 sales-point 处 setYmmText && setYmmText(); } } });} //YMM Init. - 786function ymmInit(){ (function($){var tags = window.getYMMParameter('rq'); if(tags != null) { tags = tags.toString().split("~"); } else { tags = ""; } if(search_bttn == "") { search_bttn = "Find"; } if(reset_bttn == "") { reset_bttn = "Reset"; } if(none_lbl == "") { none_lbl = "None"; } if(tags == "") { jQuery("#ymm_label").css("display","block"); jQuery(".formFields ul.dropdowns").show(); } //Get First Dropdown onload//Get Next Dropdowns on change in Sequencial order jQuery(document).on('change','select[id^=dropdown]:not(:last)',function() { var arr = jQuery(this).attr("id").split("-"); var current_field = arr[1]; var dropdown_val = jQuery(this).val(); var field_val_Arr = []; var next_all = jQuery("li."+current_field).nextAll().find("select"); next_all.prop("disabled", true); next_all.val("-1"); //Dynamic disable search btn if all ymm fields were not selected. - 786/ASK var ymm_values_arr = jQuery("#ymm_searchbox .formFields .dropdowns option:selected").map(function() {return jQuery(this).val();}).get(); if(jQuery.inArray("-1", ymm_values_arr) !== -1) { disableSearch(); } else { enableSearch(); } jQuery("#ymm_searchbox .formFields .dropdowns select[id^=dropdown]:visible").each(function(i, e) { if(e.value != -1){ var dropval = e.value; field_val_Arr.push(dropval); } }); if(dropdown_val != "-1") { showLoader(current_field); jQuery.ajax({type: "GET", dataType: 'jsonp', url: data_url,data: "domain="+shop_domain+"&load=all&data_filter=updated&action=onchange&version=updated&ver_no=2&current_field="+current_field+"&prev_val="+encodeURIComponent(field_val_Arr)+"&current_val="+encodeURIComponent(dropdown_val),success: function(res) { if(res.html != "last_element~"){ var returned_fieldname = res.html.split("~"); jQuery(".formFields ul.dropdowns ."+returned_fieldname[1]).remove(); jQuery(returned_fieldname[0]).insertAfter(".formFields ul.dropdowns ."+current_field); var $dropdowns = jQuery(res.html).find('.ymm-filter'); $dropdowns.find('option:first').each(function () { var curr_drop_id = jQuery(this).parent().attr("id"); var curr_text = jQuery(this).text(); var final_lbl = curr_text.replace('Select',select_lbl); var final_lbl_arr = final_lbl.split("--"); jQuery("#"+curr_drop_id+" option:first").text(final_lbl_arr[0]+" "+final_lbl_arr[1]); }); jQuery(".ymm-filter").find("option[value*='none']").html(none_lbl); var li_element = jQuery(".formFields ul.dropdowns").find('li.ymm_bttns'); if (!li_element.length) { jQuery(".formFields ul.dropdowns").append('

  • ');} } hideLoader();} }); } }); //On change of last dropdown do not make any request just enable/disable search btn (here it will be enabled when all ymm fields selected.) - 786 jQuery(document).on('change','select[id^=dropdown]:last',function() { var dropdown_val = jQuery(this).val(); if(dropdown_val == -1) { disableSearch(); } else { enableSearch(); } }); //After Search Filter performs show selected dropdowns values if(tags != "") { if(template_name != "product") { jQuery.ajax({type: "GET", dataType: 'jsonp', url: data_url,data: "domain="+shop_domain+"&load=all&subaction=show_all&action=getdropdowns&version=updated&ver_no=2&tags="+encodeURIComponent(tags), success: function(res) { jQuery(".formFields ul.dropdowns").html(res.html); jQuery("#ymm_label").show(); jQuery(".formFields ul.dropdowns").show(); var $dropdowns = jQuery(res.html).find('.ymm-filter'); $dropdowns.find('option:first').each(function () { var curr_drop_id = jQuery(this).parent().attr("id"); var curr_text = jQuery(this).text(); var final_lbl = curr_text.replace('Select',select_lbl); var final_lbl_arr = final_lbl.split("--"); jQuery("#"+curr_drop_id+" option:first").text(final_lbl_arr[0]+" "+final_lbl_arr[1]); }); jQuery(".ymm-filter").find("option[value*='none']").html(none_lbl); var li_element = jQuery(".formFields ul.dropdowns").find('li.ymm_bttns'); if (!li_element.length) { jQuery(".formFields ul.dropdowns").append('

  • ');} enableSearch();} }); } else { //786/92 - get ymm product fitment data and display it on the product details page. getYMMFitmentData(tags); } } //On click of Search button build search filter URL jQuery(document).on('click','#ymm_search',function() { var dropval = ""; var loop_cnt = 0; var append_tag = ""; jQuery("#ymm_searchbox .formFields .dropdowns select[id^=dropdown]:visible").each(function(i, e) { dropval = e.value; loop_cnt++; if(dropval != "-1") { if(loop_cnt >= 1) { if(dropval != "") { if(dropval.indexOf("_none")== -1) { append_tag += dropval+"~"; } } } } }); append_tag = removeLastSign(append_tag); if(template_name != "product") { //Redirect to shopify Product for this searched ymm entry jQuery.ajax({type: "GET", jsonp: "callback", dataType: 'jsonp', url: data_url,data: "domain="+shop_domain+"&front_domain="+front_domain+"&action=get_single_product&tags="+encodeURIComponent(append_tag), success: function(res) { window.location.href = res.prd_handle;//786} }); } else { //Hide YMMbox and show fitments data- 786. jQuery("#ymm_searchbox").hide(); jQuery("#ymm_searchbox").find(".dropdowns").html(""); //If search button clicked on product page then show product fitments data. - 786 tags = append_tag.toString().replace(/~/g, ","); //Update ymm query parameter value in URL without page reload. const ymm_new_url = new URL(window.location);ymm_new_url.searchParams.set("rq", append_tag);window.history.replaceState({}, '', ymm_new_url); //Get YMM fitment data on page load of product details page for this searched ymm entry. - 786 getYMMFitmentData(tags); } }); //Reset function jQuery(document).on('click','#ymm_reset',function() { resetYMMDropdowns(); }); //Reset YMM product fitment means clicked on "check diff. vehicle" btn on product page. - 786 jQuery(document).on('click','#reset_ymm_fitment',function(e) { getDropdownsOnload(); //786 }); //On Click of view other fitments data - 786/92/313/ASM jQuery(document).on('click','#view_fitments',function() { tags = tags.toString().replace(/,/g, "~"); window.location.href = searchURL+"?rq="+tags; });//When back/forward button is pressed and coming to the page where ymmbox exists then first dropdown value will be resetted not on ymm result page. - 786 jQuery(window).bind("pageshow", function() { if(tags == "") { var form = jQuery('#ymm_form'); form.trigger("reset"); form.find("select.ymm-filter:first").val("-1").trigger('change'); }}); jQuery(document).on('click','#ymm_label',function() { if (jQuery(window).width() < 767) { jQuery(this).next("#ymm_form").slideToggle(); jQuery(this).toggleClass("active"); } });})(jQuery); } //Check jquery lib. is already included or not and if version is less then call jquery lib through our App.if ((typeof jQuery === "undefined") || (jQuery.fn.jquery.replace(/\.(\d)/g,".0$1").replace(/\.0(\d{2})/g,".$1") < "1.08.01")) { removeYMMJS("https://code.jquery.com/jquery-1.12.4.min.js"); //!IMPORTANT window.ymmLoadScript("https://code.jquery.com/jquery-1.12.4.min.js","ymm_script", function (){ jQuery.noConflict(); ymmInit(); }); } else {ymmInit();}

    Boat Other Accessories (2024)

    References

    Top Articles
    Latest Posts
    Article information

    Author: Mr. See Jast

    Last Updated:

    Views: 6268

    Rating: 4.4 / 5 (55 voted)

    Reviews: 94% of readers found this page helpful

    Author information

    Name: Mr. See Jast

    Birthday: 1999-07-30

    Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

    Phone: +5023589614038

    Job: Chief Executive

    Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

    Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.