Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const more_swatches = 2;
- const isp_translations = {
- quick_view_button: {
- "UK": "Quick View",
- "AUS": "Quick View",
- "USA" : "Quick View",
- "CH": "Quick View", //swiss
- "FR": "Voir rapide", //french
- "GR": " Schnellansicht", //german
- "ITA": "Visualizza veloce", //italian
- "JP": "クイックビュー", // japanese
- "TH": "มุมมองด่วน", //Thai
- },
- add_to_cart_button: {
- "UK": "Add to Basket",
- "AUS": "Add to Basket",
- "USA" : "Add to Cart",
- "CH": "Add to Basket", //swiss
- "FR": "Ajouter Au Panier", //french
- "GR": "Zum Warenkorb Hinzufugen", //german
- "ITA": "Aggiungi Al Carrello", //italian
- "JP": "バスケットに追加", // japanese
- "TH": "เพิ่มในตะกร้า", //Thai
- },
- color_option_name:{
- "UK": "Colour",
- "AUS": "Colour",
- "USA" : "Color",
- "CH": "Colour", //swiss
- "FR": "Couleur", //french
- "GR": "Farbe", //german
- "ITA": "Colore", //italian
- "JP": "色", // japanese
- "TH": "สี", //Thai
- }
- };
- var __isp_options = {
- isp_serp_callback: function () {
- ISP_ADD_TO_CART_TEXT = isp_translations.add_to_cart_button[getSiteCountryCode()];
- $('.isp_add_to_cart_form > input[type=submit]').attr('value',ISP_ADD_TO_CART_TEXT);
- $(".isp_grid_product").each(function () {
- $(this).find('.isp_product_color_swatch_pop_up span').each(function () {
- if ($(this).parents(".isp_product_color_swatch_pop_up").find(".moved").length === more_swatches) {
- return false; //stop loop
- }
- $(this).addClass("moved");
- $(this).parents(".isp_product_color_swatch").find(".extra_swatch_text").before($jquery_isp(this));
- });
- let pop_ups = $(this).find(".isp_product_color_swatch_pop_up span").length;
- if(pop_ups > 0){
- $(this).find(".extra_swatch_text").text("+"+pop_ups);
- } else {
- $(this).find(".extra_swatch_text").hide();
- }
- let product_id = $(this).attr("product_id");
- if($(this).find(".isp_add_to_cart_btn").length > 0 && ISP_PRODUCTS[product_id].vra.length > 1){
- $(this).find(".isp_add_to_cart_btn").val("Quick View");
- }
- if ($(this).find("span.view_product_container").length === 0) {
- $(this).find(".isp_product_image_wrapper").prepend('<span class="view_product_container">' +
- '<a class="view_product_btn" href="#" product_id="'+product_id+'" onclick="'+
- $(this).find(".isp_product_quick_view_button").attr("onclick")+'" >'+isp_translations.quick_view_button[getSiteCountryCode()]+'</a></span>');
- $(this).find(".isp_product_quick_view_button").hide();
- }
- });
- }, isp_serp_quickview_callback: function (product_id) {
- let priceHTML = $(".isp_grid_product[product_id='"+product_id+"'] .isp_product_price_wrapper").html();
- $(".isp_quick_view_price_wrapper").hide()
- .after("<span class='custom_price_container' currency='"+ ISP_SITE_CURRENCY +"'>"+priceHTML+"</span>");
- $(".isp_quick_view_container_title").text(isp_translations.color_option_name[getSiteCountryCode()]);
- if($(".isp_quick_view_info_bar").children().length === 1){
- $(".isp_quick_view_info_bar").hide();
- }
- }
- };
- function getSiteCountryCode() {
- let country = window.location.href;
- if(country.indexOf("japan") > -1){
- return "JP";
- } else if(country.indexOf("thailand") > -1){
- return "TH";
- } else if(country.indexOf("australia") > -1){
- return "AUS";
- } else if (country.indexOf("france") > -1){
- return "FR";
- } else if(country.indexOf("germany") > -1){
- return "GR";
- } else if(country.indexOf("italy") > -1){
- return "IT";
- } else if(country.indexOf(".ch") > -1){
- return "CH";
- } else if (country.indexOf("usa") > -1){
- return "USA";
- } else {
- return "UK";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement