Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const more_swatches = 2;
- const country_code = "ITA";
- 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
- },
- view_more_button_name: {
- "UK": "View More",
- "AUS": "View More",
- "USA" : "View More",
- "CH": "View More", //swiss
- "FR": "Voir plus", //french
- "GR": "Mehr sehen", //german
- "ITA": "Vedi di più", //italian
- "JP": "もっと見る", // japanese
- "TH": "ดูเพิ่มเติม", //Thai
- }
- };
- var __isp_options = {
- isp_serp_callback: function () {
- //change add to cart text for quick view
- ISP_ADD_TO_CART_TEXT = isp_translations.add_to_cart_button[country_code];
- //change add to cart text for serp
- $('.isp_add_to_cart_form > input[type=submit]').attr('value',ISP_ADD_TO_CART_TEXT);
- $(".isp_grid_product").each(function () {
- // show collapsed swatches
- $(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();
- }
- // change add to cart text to quick view
- 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(isp_translations.quick_view_button[country_code]);
- }
- // create custom add to cart button
- 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[country_code]+'</a></span>');
- $(this).find(".isp_product_quick_view_button").hide();
- }
- });
- }, isp_serp_quickview_callback: function (product_id) {
- //create custom price container (because price lists are not supported)
- 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[country_code]);
- //hide info bar if only single children exist
- if($(".isp_quick_view_info_bar").children().length === 1){
- $(".isp_quick_view_info_bar").hide();
- }
- //view more button
- const view_more_button = '<button class="isp_custom_view_more_btn" href="'+ISP_PRODUCTS[product_id].u+'">' +
- '<img src="https://acp-magento.appspot.com/images/isp_ico-AllInfo.png">'+isp_translations.view_more_button_name[country_code]+'</button>';
- $(".isp_view_full_details").replaceWith(view_more_button);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement