'+this.gsx$linkdescription.$t+'
'); }); }; $(document).ready(function(){ var spreadsheetId = "1JJydou8KY6OPtc4QxlUBtWl6DDI9y3miJn3ygvrwnpM"; ElgigantenScript.GetGoogleSheetJson(spreadsheetId, testFunction); }); */ // ==== Function to transfrom $('.mini-product') ==== // Created by : Fredrik Frederiksen // Version : 1.4 // Update Date : 13/11-2019 // ==== ==== // Can change | price | salespoint | ammount of offer | imageLayer | recommendedProduct | additionalInfo | additionalText // products = An object containing all the product objects and specifications for their transformations (se example for demo) // you only need to add the fields you wish to overwrite on specific products // if you just wish to use the egab price design, run function without input // productPrice -> overwrites current price // salesPoint -> overwrites the sales point // amountOfOffers -> overwrites the ammount of offers field // imageLayer -> can be used to set the bundle-icon (the little image over the product image) // recommendedProduct -> used to set set the green recommended box / icon - set this value to true. // additionalInfo -> adds more lines to the grey additional info box. // additionalText -> adds text to the bottom of the mini product box accepts html. ElgigantenScript.TransformMiniProduct = function (products) { if(!products){products = {};}; var defaultProduct = {}; if (products && products['DEFAULT']) { defaultProduct = products['DEFAULT']; } var overRuleProduct = {}; if (products && products['OVERRULE']) { overRuleProduct = products['OVERRULE']; } $('.mini-product').each(function () { var $this = $(this), id = $this.find('.product-number.sku').text().trim(), currentProduct = products[id]; if (currentProduct || defaultProduct || overRuleProduct) { var salesPoint = $this.find('.sales-point').text(); if (currentProduct && currentProduct['salesPoint']) { salesPoint = currentProduct['salesPoint']; } else if (currentProduct && currentProduct['salesPoint'] === null) {} else if (overRuleProduct && overRuleProduct['salesPoint']) { salesPoint = overRuleProduct['salesPoint']; } else if (salesPoint === '' && defaultProduct && defaultProduct['salesPoint']) { salesPoint = defaultProduct['salesPoint']; } $this.find('.sales-point').remove(); var amountOfOffers = $this.find('.amount-of-offers').text(); if (currentProduct && currentProduct['amountOfOffers']) { amountOfOffers = currentProduct['amountOfOffers']; } else if (currentProduct && currentProduct['amountOfOffers'] === null) {} else if (overRuleProduct && overRuleProduct['amountOfOffers']) { amountOfOffers = overRuleProduct['amountOfOffers']; } else if ($.trim(amountOfOffers) == '' && defaultProduct && defaultProduct['amountOfOffers']) { amountOfOffers = defaultProduct['amountOfOffers']; } $this.find('.amount-of-offers').remove(); var productPriceSub = ''; firstLoop = true; $this.find('.product-price').children().each(function(){ if(firstLoop){ firstLoop = false; } else { productPriceSub += '