Created
May 20, 2025 18:01
-
-
Save robisatthefunction/63d0bd7b3d22f62151123d6878a543af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugin_type": "widget", | |
"name": "Optimizely Product Recommendations", | |
"edit_page_url": "https://p13n.opti-demo.online/", | |
"form_schema": [ | |
{ | |
"name": "header", | |
"options": null, | |
"label": "Header Text", | |
"default_value": "You might also love", | |
"field_type": "text" | |
}, | |
{ | |
"name": "max", | |
"options": null, | |
"label": "Maximum Products", | |
"default_value": 4, | |
"field_type": "number" | |
}, | |
{ | |
"name": "widget", | |
"options": { | |
"choices": [ | |
{ | |
"value": "default", | |
"label": "Default widget" | |
}, | |
{ | |
"value": "a", | |
"label": "Variant A" | |
}, | |
{ | |
"value": "b", | |
"label": "Variant B" | |
} | |
] | |
}, | |
"label": "Override widget", | |
"default_value": "default", | |
"field_type": "dropdown" | |
}, | |
{ | |
"name": "selector", | |
"options": null, | |
"label": "Insert After Selector", | |
"default_value": "body", | |
"field_type": "selector" | |
}, | |
{ | |
"name": "start", | |
"options": null, | |
"label": "First recommendation", | |
"default_value": 1, | |
"field_type": "number" | |
}, | |
{ | |
"name": "recsposition", | |
"options": { | |
"choices": [ | |
{ | |
"value": "homeWidget", | |
"label": "Home Widget (Home page)" | |
}, | |
{ | |
"value": "categoryWidget", | |
"label": "Category Widget (Category page)" | |
}, | |
{ | |
"value": "basketWidget", | |
"label": "Basket Widget (Cart page)" | |
}, | |
{ | |
"value": "productAlternativesWidget", | |
"label": "Alternative Products (Product page)" | |
}, | |
{ | |
"value": "productCrossSellsWidget", | |
"label": "Complementary Products (Product page)" | |
}, | |
{ | |
"value": "searchWidget", | |
"label": "Search Results (Search result page)" | |
} | |
] | |
}, | |
"label": "Injection Point", | |
"default_value": "homeWidget", | |
"field_type": "dropdown" | |
}, | |
{ | |
"name": "example_recs", | |
"options": null, | |
"label": "example_recs", | |
"default_value": "[\n {\n \"widget\": \"homeWidget\",\n \"alias\": \"\",\n \"position\": \"homeWidget\",\n \"recs\": [\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 25.5,\n \"salePrice\": 25.5\n },\n \"CAD\": {\n \"unitPrice\": 23.5,\n \"salePrice\": 23.5\n },\n \"AUD\": {\n \"unitPrice\": 24.5,\n \"salePrice\": 24.5\n },\n \"SEK\": {\n \"unitPrice\": 280,\n \"salePrice\": 280\n },\n \"BRL\": {\n \"unitPrice\": 57.5,\n \"salePrice\": 57.5\n },\n \"CLP\": {\n \"unitPrice\": 11600,\n \"salePrice\": 11600\n },\n \"GBP\": {\n \"unitPrice\": 280,\n \"salePrice\": 280\n },\n \"JPY\": {\n \"unitPrice\": 2261,\n \"salePrice\": 2261\n },\n \"USD\": {\n \"unitPrice\": 280,\n \"salePrice\": 280\n },\n \"NOK\": {\n \"unitPrice\": 147.5,\n \"salePrice\": 147.5\n },\n \"EUR\": {\n \"unitPrice\": 17.5,\n \"salePrice\": 17.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/mens/mens-shoes/p-42518256/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/mens/shoes/morgan-sneaker/25932-1009-s19-1-f-0-0-1.jpg\",\n \"attributes\": {\n \"description\": \"details\\n\\n\\nmorgan is made for casual days, or for adding an unexpected edge to a formal look. it is a classic low top model made with leather and suede details, and is lined with soft calf leat\",\n \"productteaser\": \"details\\n\\n\\nmorgan is made for casual days, or for adding an unexpected edge to a formal look. it is a classic low top model made with leather and suede details, and is lined with soft calf leat\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"details\\n\\n\\nmorgan is made for casual days, or for adding an unexpected edge to a formal look. it is a classic low top model made with leather and suede details, and is lined with soft calf leat\",\n \"brand\": \"best seller\",\n \"pricerange\": \"expensive\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440101,\n \"title\": \"MORGAN SNEAKER\",\n \"refCode\": \"P-42518256\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 34.5,\n \"salePrice\": 34.5\n },\n \"CAD\": {\n \"unitPrice\": 30.5,\n \"salePrice\": 30.5\n },\n \"AUD\": {\n \"unitPrice\": 32.5,\n \"salePrice\": 32.5\n },\n \"SEK\": {\n \"unitPrice\": 208.5,\n \"salePrice\": 208.5\n },\n \"BRL\": {\n \"unitPrice\": 75.5,\n \"salePrice\": 75.5\n },\n \"CLP\": {\n \"unitPrice\": 15253,\n \"salePrice\": 15253\n },\n \"GBP\": {\n \"unitPrice\": 16.5,\n \"salePrice\": 16.5\n },\n \"JPY\": {\n \"unitPrice\": 2973,\n \"salePrice\": 2973\n },\n \"USD\": {\n \"unitPrice\": 24.5,\n \"salePrice\": 24.5\n },\n \"NOK\": {\n \"unitPrice\": 194.5,\n \"salePrice\": 194.5\n },\n \"EUR\": {\n \"unitPrice\": 23.5,\n \"salePrice\": 23.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/mens/mens-jackets/p-37378633/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/mens/jackets/ross-spring-coat/25885-8258-s19-1-m-f-h.jpg\",\n \"attributes\": {\n \"description\": \"size & fit\\n\\nslim\\nmodel is 185 cm and is wearing a size 48\\n\\n\\n \\ndetails\\n\\n\\nross was made for seasonal shifts with a clean look and classic tailoring, complete with sustainable corozo buttons under a\",\n \"showrecommendations\": \"true\",\n \"term\": \"coat\",\n \"brand\": \"best seller\",\n \"pricerange\": \"expensive\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440151,\n \"title\": \"ROSS SPRING COAT\",\n \"refCode\": \"P-37378633\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 42.5,\n \"salePrice\": 42.5\n },\n \"CAD\": {\n \"unitPrice\": 490,\n \"salePrice\": 490\n },\n \"AUD\": {\n \"unitPrice\": 39.5,\n \"salePrice\": 39.5\n },\n \"SEK\": {\n \"unitPrice\": 490,\n \"salePrice\": 490\n },\n \"BRL\": {\n \"unitPrice\": 93.5,\n \"salePrice\": 93.5\n },\n \"CLP\": {\n \"unitPrice\": 18906,\n \"salePrice\": 18906\n },\n \"GBP\": {\n \"unitPrice\": 490,\n \"salePrice\": 490\n },\n \"JPY\": {\n \"unitPrice\": 3685,\n \"salePrice\": 3685\n },\n \"USD\": {\n \"unitPrice\": 490,\n \"salePrice\": 490\n },\n \"NOK\": {\n \"unitPrice\": 241.5,\n \"salePrice\": 241.5\n },\n \"EUR\": {\n \"unitPrice\": 28.5,\n \"salePrice\": 28.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/womens/womens-shoes/p-27312186/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/women/shoes/clara-short-boot/25659-8080-s19-1-f-f-0.jpg\",\n \"attributes\": {\n \"description\": \"details\\n\\n\\nour flat zip bootie has a classic blake stitch construction and comes in a polished calf leather with a 3 cm high stacked leather heel. the luxurious style has a smooth lambskin lining and i\",\n \"productteaser\": \"our flat zip bootie has a classic blake stitch construction and comes in a polished calf leather with a 3 cm high stacked leather heel. the luxurious style has a smooth lambskin lining and insock,\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"product origin\\nwe believe that openness and transparency throughout the production chain plays an important role in modern, sustainable manufacturing.\\nmade in: portugal\\n\\n\\nfactory (sub contractor):\",\n \"term\": \"boot\",\n \"brand\": \"best seller\",\n \"pricerange\": \"expensive\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440201,\n \"title\": \"CLARA SHORT BOOT\",\n \"refCode\": \"P-27312186\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 25.5,\n \"salePrice\": 25.5\n },\n \"CAD\": {\n \"unitPrice\": 23.5,\n \"salePrice\": 23.5\n },\n \"AUD\": {\n \"unitPrice\": 24.5,\n \"salePrice\": 24.5\n },\n \"SEK\": {\n \"unitPrice\": 280,\n \"salePrice\": 280\n },\n \"BRL\": {\n \"unitPrice\": 57.5,\n \"salePrice\": 57.5\n },\n \"CLP\": {\n \"unitPrice\": 11600,\n \"salePrice\": 11600\n },\n \"GBP\": {\n \"unitPrice\": 280,\n \"salePrice\": 280\n },\n \"JPY\": {\n \"unitPrice\": 2261,\n \"salePrice\": 2261\n },\n \"USD\": {\n \"unitPrice\": 280,\n \"salePrice\": 280\n },\n \"NOK\": {\n \"unitPrice\": 147.5,\n \"salePrice\": 147.5\n },\n \"EUR\": {\n \"unitPrice\": 17.5,\n \"salePrice\": 17.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/mens/sportswear/felix-short/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/mens/sweaters/cotton-merino-sweater/25788-8137-s19-1-m-f-h.jpg\",\n \"attributes\": {\n \"description\": \"details\\n\\n\\nthis relaxed short is made for casual days in a soft cotton twill felpa, knit in portugal. it has a regular fit with an above knee length. the elasticated waistband has a herringbone dra\",\n \"productteaser\": \"details\\n\\n\\nthis relaxed short is made for casual days in a soft cotton twill felpa, knit in portugal. it has a regular fit with an above knee length. the elasticated waistband has a herringbone dra\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"details\\n\\n\\nthis relaxed short is made for casual days in a soft cotton twill felpa, knit in portugal. it has a regular fit with an above knee length. the elasticated waistband has a herringbone dra\",\n \"term\": \"short\",\n \"brand\": \"best seller\",\n \"pricerange\": \"expensive\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440251,\n \"title\": \"FELIX SHORT\",\n \"refCode\": \"felix-short\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 14.5,\n \"salePrice\": 14.5,\n \"formattedSalePrice\": \"14.50\",\n \"formattedUnitPrice\": \"14.50\",\n \"showUnitPrice\": false\n },\n \"CAD\": {\n \"unitPrice\": 11.5,\n \"salePrice\": 11.5,\n \"formattedSalePrice\": \"11.50\",\n \"formattedUnitPrice\": \"11.50\",\n \"showUnitPrice\": false\n },\n \"AUD\": {\n \"unitPrice\": 11.5,\n \"salePrice\": 11.5,\n \"formattedSalePrice\": \"11.50\",\n \"formattedUnitPrice\": \"11.50\",\n \"showUnitPrice\": false\n },\n \"SEK\": {\n \"unitPrice\": 165,\n \"salePrice\": 165,\n \"formattedSalePrice\": \"165.00\",\n \"formattedUnitPrice\": \"165.00\",\n \"showUnitPrice\": false\n },\n \"BRL\": {\n \"unitPrice\": 27.5,\n \"salePrice\": 27.5,\n \"formattedSalePrice\": \"27.50\",\n \"formattedUnitPrice\": \"27.50\",\n \"showUnitPrice\": false\n },\n \"CLP\": {\n \"unitPrice\": 5497,\n \"salePrice\": 5497,\n \"formattedSalePrice\": \"5497.00\",\n \"formattedUnitPrice\": \"5497.00\",\n \"showUnitPrice\": false\n },\n \"GBP\": {\n \"unitPrice\": 165,\n \"salePrice\": 165,\n \"formattedSalePrice\": \"165.00\",\n \"formattedUnitPrice\": \"165.00\",\n \"showUnitPrice\": false\n },\n \"JPY\": {\n \"unitPrice\": 1071,\n \"salePrice\": 1071,\n \"formattedSalePrice\": \"1071.00\",\n \"formattedUnitPrice\": \"1071.00\",\n \"showUnitPrice\": false\n },\n \"USD\": {\n \"unitPrice\": 165,\n \"salePrice\": 165,\n \"formattedSalePrice\": \"165.00\",\n \"formattedUnitPrice\": \"165.00\",\n \"showUnitPrice\": false\n },\n \"NOK\": {\n \"unitPrice\": 70.5,\n \"salePrice\": 70.5,\n \"formattedSalePrice\": \"70.50\",\n \"formattedUnitPrice\": \"70.50\",\n \"showUnitPrice\": false\n },\n \"EUR\": {\n \"unitPrice\": 8.5,\n \"salePrice\": 8.5,\n \"formattedSalePrice\": \"8.50\",\n \"formattedUnitPrice\": \"8.50\",\n \"showUnitPrice\": false\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/mens/mens-sweatshirts/p-39205836/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/mens/sweaters/tuxedo-sweatshirt/25700-2830-s19-1-m-f-h.jpg\",\n \"attributes\": {\n \"description\": \"size & fit\\n\\nregular\\nmodel is 188 cm and is wearing a size m\\n\\n\\n\\ndetails\\n\\n\\na casual take on tuxedo touches, this sweatshirt pairs classic french terry with contrasting shine. in 100% cotton, the\",\n \"productteaser\": \"size & fit\\n\\nregular\\nmodel is 188 cm and is wearing a size m\\n\\n\\n\\ndetails\\n\\n\\na casual take on tuxedo touches, this sweatshirt pairs classic french terry with contrasting shine. in 100% cotton, the\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"we believe that openness and transparency throughout the production chain plays an important role in modern, sustainable manufacturing.\\nmade in: portugal\\n\\n\\nfactory (sub contractor): nicosta\\naddres\",\n \"term\": \"sweatshirt\",\n \"brand\": \"new\",\n \"pricerange\": \"average\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440301,\n \"title\": \"TUXEDO SWEATSHIRT\",\n \"refCode\": \"P-39205836\",\n \"imageUrl\": \"https://ys-b2c-commerce.epi-uk.net/globalassets/catalogs/mosey/mens/sweaters/tuxedo-sweatshirt/25700-2830-s19-1-m-f-h.jpg\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 46.5,\n \"salePrice\": 46.5,\n \"formattedSalePrice\": \"46.50\",\n \"formattedUnitPrice\": \"46.50\",\n \"showUnitPrice\": false\n },\n \"CAD\": {\n \"unitPrice\": 41.5,\n \"salePrice\": 41.5,\n \"formattedSalePrice\": \"41.50\",\n \"formattedUnitPrice\": \"41.50\",\n \"showUnitPrice\": false\n },\n \"AUD\": {\n \"unitPrice\": 43.5,\n \"salePrice\": 43.5,\n \"formattedSalePrice\": \"43.50\",\n \"formattedUnitPrice\": \"43.50\",\n \"showUnitPrice\": false\n },\n \"SEK\": {\n \"unitPrice\": 280,\n \"salePrice\": 280,\n \"formattedSalePrice\": \"280.00\",\n \"formattedUnitPrice\": \"280.00\",\n \"showUnitPrice\": false\n },\n \"BRL\": {\n \"unitPrice\": 103,\n \"salePrice\": 103,\n \"formattedSalePrice\": \"103.00\",\n \"formattedUnitPrice\": \"103.00\",\n \"showUnitPrice\": false\n },\n \"CLP\": {\n \"unitPrice\": 20763,\n \"salePrice\": 20763,\n \"formattedSalePrice\": \"20763.00\",\n \"formattedUnitPrice\": \"20763.00\",\n \"showUnitPrice\": false\n },\n \"GBP\": {\n \"unitPrice\": 280,\n \"salePrice\": 280,\n \"formattedSalePrice\": \"280.00\",\n \"formattedUnitPrice\": \"280.00\",\n \"showUnitPrice\": false\n },\n \"JPY\": {\n \"unitPrice\": 4047,\n \"salePrice\": 4047,\n \"formattedSalePrice\": \"4047.00\",\n \"formattedUnitPrice\": \"4047.00\",\n \"showUnitPrice\": false\n },\n \"USD\": {\n \"unitPrice\": 280,\n \"salePrice\": 280,\n \"formattedSalePrice\": \"280.00\",\n \"formattedUnitPrice\": \"280.00\",\n \"showUnitPrice\": false\n },\n \"NOK\": {\n \"unitPrice\": 264.5,\n \"salePrice\": 264.5,\n \"formattedSalePrice\": \"264.50\",\n \"formattedUnitPrice\": \"264.50\",\n \"showUnitPrice\": false\n },\n \"EUR\": {\n \"unitPrice\": 31.5,\n \"salePrice\": 31.5,\n \"formattedSalePrice\": \"31.50\",\n \"formattedUnitPrice\": \"31.50\",\n \"showUnitPrice\": false\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/mens/mens-shoes/p-39850363/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/mens/shoes/robert-sneaker/25933-1009-s19-1-f-0-0.jpg\",\n \"attributes\": {\n \"description\": \"details\\n\\n\\nthis vintage basketball-inspired low top lined with calf leather, and made with tumbled cow nappa. it has a perforated toe vamp for breathability and a padded heel tab for comfort. wear\",\n \"productteaser\": \"this vintage basketball-inspired low top lined with calf leather, and made with tumbled cow nappa. it has a perforated toe vamp for breathability and a padded heel tab for comfort. wear it with je\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"product origin\\nwe believe that openness and transparency throughout the production chain plays an important role in modern, sustainable manufacturing.\\nmade in: portugal\\n\\n\\nfactory (sub contractor):\",\n \"brand\": \"new\",\n \"pricerange\": \"expensive\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440351,\n \"title\": \"ROBERT SNEAKER\",\n \"refCode\": \"P-39850363\",\n \"imageUrl\": \"https://ys-b2c-commerce.epi-uk.net/globalassets/catalogs/mosey/mens/shoes/robert-sneaker/25933-1009-s19-1-f-0-0.jpg\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 6.5,\n \"salePrice\": 6.5,\n \"formattedSalePrice\": \"6.50\",\n \"formattedUnitPrice\": \"6.50\",\n \"showUnitPrice\": false\n },\n \"CAD\": {\n \"unitPrice\": 195,\n \"salePrice\": 195,\n \"formattedSalePrice\": \"195.00\",\n \"formattedUnitPrice\": \"195.00\",\n \"showUnitPrice\": false\n },\n \"AUD\": {\n \"unitPrice\": 6.5,\n \"salePrice\": 6.5,\n \"formattedSalePrice\": \"6.50\",\n \"formattedUnitPrice\": \"6.50\",\n \"showUnitPrice\": false\n },\n \"SEK\": {\n \"unitPrice\": 195,\n \"salePrice\": 195,\n \"formattedSalePrice\": \"195.00\",\n \"formattedUnitPrice\": \"195.00\",\n \"showUnitPrice\": false\n },\n \"BRL\": {\n \"unitPrice\": 15.5,\n \"salePrice\": 15.5,\n \"formattedSalePrice\": \"15.50\",\n \"formattedUnitPrice\": \"15.50\",\n \"showUnitPrice\": false\n },\n \"CLP\": {\n \"unitPrice\": 3029,\n \"salePrice\": 3029,\n \"formattedSalePrice\": \"3029.00\",\n \"formattedUnitPrice\": \"3029.00\",\n \"showUnitPrice\": false\n },\n \"GBP\": {\n \"unitPrice\": 195,\n \"salePrice\": 195,\n \"formattedSalePrice\": \"195.00\",\n \"formattedUnitPrice\": \"195.00\",\n \"showUnitPrice\": false\n },\n \"JPY\": {\n \"unitPrice\": 590,\n \"salePrice\": 590,\n \"formattedSalePrice\": \"590.00\",\n \"formattedUnitPrice\": \"590.00\",\n \"showUnitPrice\": false\n },\n \"USD\": {\n \"unitPrice\": 195,\n \"salePrice\": 195,\n \"formattedSalePrice\": \"195.00\",\n \"formattedUnitPrice\": \"195.00\",\n \"showUnitPrice\": false\n },\n \"NOK\": {\n \"unitPrice\": 38.5,\n \"salePrice\": 38.5,\n \"formattedSalePrice\": \"38.50\",\n \"formattedUnitPrice\": \"38.50\",\n \"showUnitPrice\": false\n },\n \"EUR\": {\n \"unitPrice\": 4.5,\n \"salePrice\": 4.5,\n \"formattedSalePrice\": \"4.50\",\n \"formattedUnitPrice\": \"4.50\",\n \"showUnitPrice\": false\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/womens/womens-bottoms/p-42087915/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/women/trousers/sheer-crepe-pant/26066-1433-s19-1-m-f-f.jpg\",\n \"attributes\": {\n \"description\": \"size & fit\\n\\ncropped length\\nrelaxed\\nmodel is 175 cm and is wearing a size s\\n\\n\\n\\ndetails\\n\\n\\nour favourite enka viscose, made from sustainably harvested swedish wood pulp, is draped in a sheer pant\",\n \"productteaser\": \"our favourite enka viscose, made from sustainably harvested swedish wood pulp, is draped in a sheer pant with half lining and a cropped length this season – style with the sheer tunic blouse f\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"product origin\\nwe believe that openness and transparency throughout the production chain plays an important role in modern, sustainable manufacturing.\\nmade in: portugal\\n\\n\\nvendor (main supplier): r\",\n \"term\": \"trouser\",\n \"brand\": \"new\",\n \"pricerange\": \"cheap\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440401,\n \"title\": \"SHEER CREPE PANT\",\n \"refCode\": \"P-42087915\",\n \"imageUrl\": \"https://ys-b2c-commerce.epi-uk.net/globalassets/catalogs/mosey/women/trousers/sheer-crepe-pant/26066-1433-s19-1-m-f-f.jpg\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 17.5,\n \"salePrice\": 17.5,\n \"formattedSalePrice\": \"17.50\",\n \"formattedUnitPrice\": \"17.50\",\n \"showUnitPrice\": false\n },\n \"CAD\": {\n \"unitPrice\": 260,\n \"salePrice\": 260,\n \"formattedSalePrice\": \"260.00\",\n \"formattedUnitPrice\": \"260.00\",\n \"showUnitPrice\": false\n },\n \"AUD\": {\n \"unitPrice\": 16.5,\n \"salePrice\": 16.5,\n \"formattedSalePrice\": \"16.50\",\n \"formattedUnitPrice\": \"16.50\",\n \"showUnitPrice\": false\n },\n \"SEK\": {\n \"unitPrice\": 260,\n \"salePrice\": 260,\n \"formattedSalePrice\": \"260.00\",\n \"formattedUnitPrice\": \"260.00\",\n \"showUnitPrice\": false\n },\n \"BRL\": {\n \"unitPrice\": 39.5,\n \"salePrice\": 39.5,\n \"formattedSalePrice\": \"39.50\",\n \"formattedUnitPrice\": \"39.50\",\n \"showUnitPrice\": false\n },\n \"CLP\": {\n \"unitPrice\": 7941,\n \"salePrice\": 7941,\n \"formattedSalePrice\": \"7941.00\",\n \"formattedUnitPrice\": \"7941.00\",\n \"showUnitPrice\": false\n },\n \"GBP\": {\n \"unitPrice\": 260,\n \"salePrice\": 260,\n \"formattedSalePrice\": \"260.00\",\n \"formattedUnitPrice\": \"260.00\",\n \"showUnitPrice\": false\n },\n \"JPY\": {\n \"unitPrice\": 1548,\n \"salePrice\": 1548,\n \"formattedSalePrice\": \"1548.00\",\n \"formattedUnitPrice\": \"1548.00\",\n \"showUnitPrice\": false\n },\n \"USD\": {\n \"unitPrice\": 260,\n \"salePrice\": 260,\n \"formattedSalePrice\": \"260.00\",\n \"formattedUnitPrice\": \"260.00\",\n \"showUnitPrice\": false\n },\n \"NOK\": {\n \"unitPrice\": 101.5,\n \"salePrice\": 101.5,\n \"formattedSalePrice\": \"101.50\",\n \"formattedUnitPrice\": \"101.50\",\n \"showUnitPrice\": false\n },\n \"EUR\": {\n \"unitPrice\": 12.5,\n \"salePrice\": 12.5,\n \"formattedSalePrice\": \"12.50\",\n \"formattedUnitPrice\": \"12.50\",\n \"showUnitPrice\": false\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/womens/womens-bottoms/p-40799209/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/women/trousers/25857-1433-s19-1-m-f-f.jpg\",\n \"attributes\": {\n \"description\": \"women's printed fashion jogger pants :\\n\\n95% polyester 5% spandex\\nrelaxed fit\\nelastic waist\\nfloral pattern\\nsoft and comfortable\\nlightweight fabric\\nstretch ankle cuffs\\nmachine wash cold\",\n \"productteaser\": \"perfectly paired with the grace belted blazer or a bold statement with a simple tee, this cool fabric in a high waist and tapered leg is a summer suiting favourite.\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"trendy and comfortable! these women's printed fashion jogger pants are a must have. style them up with a simple tee, gladiators and a fun necklace.\",\n \"term\": \"trouser\",\n \"brand\": \"new\",\n \"pricerange\": \"average\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440451,\n \"title\": \"KARLIE TROUSER\",\n \"refCode\": \"P-40799209\",\n \"imageUrl\": \"https://ys-b2c-commerce.epi-uk.net/globalassets/catalogs/mosey/women/trousers/25857-1433-s19-1-m-f-f.jpg\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 14.5,\n \"salePrice\": 14.5\n },\n \"CAD\": {\n \"unitPrice\": 13.5,\n \"salePrice\": 13.5\n },\n \"AUD\": {\n \"unitPrice\": 14.5,\n \"salePrice\": 14.5\n },\n \"SEK\": {\n \"unitPrice\": 155,\n \"salePrice\": 155\n },\n \"BRL\": {\n \"unitPrice\": 33.5,\n \"salePrice\": 33.5\n },\n \"CLP\": {\n \"unitPrice\": 6719,\n \"salePrice\": 6719\n },\n \"GBP\": {\n \"unitPrice\": 155,\n \"salePrice\": 155\n },\n \"JPY\": {\n \"unitPrice\": 1309,\n \"salePrice\": 1309\n },\n \"USD\": {\n \"unitPrice\": 155,\n \"salePrice\": 155\n },\n \"NOK\": {\n \"unitPrice\": 85.5,\n \"salePrice\": 85.5\n },\n \"EUR\": {\n \"unitPrice\": 10.5,\n \"salePrice\": 10.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/mens/mens-sweatshirts/p-22471487/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/mens/sweaters/cotton-merino-sweater/25788-8258-s19-1-m-f-h.jpg\",\n \"attributes\": {\n \"description\": \"size & fit\\n\\nregular\\nmodel is 188 cm and is wearing a size m\\n\\n\\n\\ndetails\\n\\n\\nequal parts cotton and wool, this sweater is the ultimate year-round basic. it’s made with a regular fit and ribbed cuffs.\",\n \"productteaser\": \"equal parts cotton and wool, this sweater is the ultimate year-round basic. it’s made with a regular fit and ribbed cuffs. the sleeves are set in with a moved-back shoulder seam. wear it over a co\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"size & fit\\n\\nregular\\nmodel is 188 cm and is wearing a size m\\n\\n\\n\\ndetails\\n\\n\\nequal parts cotton and wool, this sweater is the ultimate year-round basic. it’s made with a regular fit and ribbed cuffs.\",\n \"term\": \"sweater\",\n \"brand\": \"top picks\",\n \"pricerange\": \"average\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440501,\n \"title\": \"COTTON MERINO SWEATER\",\n \"refCode\": \"P-22471487\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 7.5,\n \"salePrice\": 7.5\n },\n \"CAD\": {\n \"unitPrice\": 6.5,\n \"salePrice\": 6.5\n },\n \"AUD\": {\n \"unitPrice\": 7.5,\n \"salePrice\": 7.5\n },\n \"SEK\": {\n \"unitPrice\": 420,\n \"salePrice\": 420\n },\n \"BRL\": {\n \"unitPrice\": 16.5,\n \"salePrice\": 16.5\n },\n \"CLP\": {\n \"unitPrice\": 3341,\n \"salePrice\": 3341\n },\n \"GBP\": {\n \"unitPrice\": 420,\n \"salePrice\": 420\n },\n \"JPY\": {\n \"unitPrice\": 651,\n \"salePrice\": 651\n },\n \"USD\": {\n \"unitPrice\": 420,\n \"salePrice\": 420\n },\n \"NOK\": {\n \"unitPrice\": 42.5,\n \"salePrice\": 42.5\n },\n \"EUR\": {\n \"unitPrice\": 5.5,\n \"salePrice\": 5.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/mens/mens-shirts/p-38193107/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/mens/suits/rick-wool-jacket/25038-1448-s19-1-m-f-h.jpg\",\n \"attributes\": {\n \"description\": \"size & fit\\n\\nslim\\nmodel is 185 cm and is wearing a size 48\\n\\n\\n\\ndetails\\n\\n\\nrick is a dressy jacket with a slim, tailored fit and two-button closure. the updated classic is made from 100% wool, wit\",\n \"productteaser\": \"rick is a dressy jacket with a slim, tailored fit and two-button closure. the updated classic is made from 100% wool, with reworked shoulders, four pockets, two rear vents and buttoned\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"product origin\\nwe believe that openness and transparency throughout the production chain plays an important role in modern, sustainable manufacturing.\\nmade in: portugal\\n\\n\\nfactory (sub contractor):\",\n \"term\": \"jacket\",\n \"brand\": \"top picks\",\n \"pricerange\": \"cheap\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440551,\n \"title\": \"RICK WOOL JACKET\",\n \"refCode\": \"P-38193107\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 17.5,\n \"salePrice\": 17.5\n },\n \"CAD\": {\n \"unitPrice\": 540,\n \"salePrice\": 540\n },\n \"AUD\": {\n \"unitPrice\": 16.5,\n \"salePrice\": 16.5\n },\n \"SEK\": {\n \"unitPrice\": 540,\n \"salePrice\": 540\n },\n \"BRL\": {\n \"unitPrice\": 39.5,\n \"salePrice\": 39.5\n },\n \"CLP\": {\n \"unitPrice\": 7941,\n \"salePrice\": 7941\n },\n \"GBP\": {\n \"unitPrice\": 540,\n \"salePrice\": 540\n },\n \"JPY\": {\n \"unitPrice\": 1548,\n \"salePrice\": 1548\n },\n \"USD\": {\n \"unitPrice\": 540,\n \"salePrice\": 540\n },\n \"NOK\": {\n \"unitPrice\": 101.5,\n \"salePrice\": 101.5\n },\n \"EUR\": {\n \"unitPrice\": 12.5,\n \"salePrice\": 12.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/womens/womens-jackets/p-40707729/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/women/jackets/rachel-coat/25756-2830-s19-1-m-f-h.jpg\",\n \"attributes\": {\n \"description\": \"size & fit\\n\\ndropped shoulder\\nloose\\nmodel is 176 cm and is wearing a size s\\n\\n\\n\\ndetails\\n\\n\\ndesigned for the changing of the seasons, the boiled wool belted coat with a dropped shoulder and folded cro\",\n \"productteaser\": \"designed for the changing of the seasons, the boiled wool belted coat with a dropped shoulder and folded cropped sleeves is a timeless transitional piece.\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"product origin\\nwe believe that openness and transparency throughout the production chain plays an important role in modern, sustainable manufacturing.\\nmade in: lithuania\\n\\n\\nfactory (sub contractor)\",\n \"term\": \"coat\",\n \"brand\": \"top picks\",\n \"pricerange\": \"average\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440601,\n \"title\": \"RACHEL COAT\",\n \"refCode\": \"P-40707729\"\n },\n {\n \"prices\": {\n \"SAR\": {\n \"unitPrice\": 8.5,\n \"salePrice\": 8.5\n },\n \"CAD\": {\n \"unitPrice\": 210,\n \"salePrice\": 210\n },\n \"AUD\": {\n \"unitPrice\": 7.5,\n \"salePrice\": 7.5\n },\n \"SEK\": {\n \"unitPrice\": 210,\n \"salePrice\": 210\n },\n \"BRL\": {\n \"unitPrice\": 18.5,\n \"salePrice\": 18.5\n },\n \"CLP\": {\n \"unitPrice\": 3665,\n \"salePrice\": 3665\n },\n \"GBP\": {\n \"unitPrice\": 210,\n \"salePrice\": 210\n },\n \"JPY\": {\n \"unitPrice\": 714,\n \"salePrice\": 714\n },\n \"USD\": {\n \"unitPrice\": 210,\n \"salePrice\": 210\n },\n \"NOK\": {\n \"unitPrice\": 46.5,\n \"salePrice\": 46.5\n },\n \"EUR\": {\n \"unitPrice\": 5.5,\n \"salePrice\": 5.5\n }\n },\n \"url\": \"https://jk-fashion.opti-demo.online/en/fashion/womens/womens-tees/p-40977269/\",\n \"img\": \"https://jk-fashion.opti-demo.online/globalassets/catalogs/mosey/women/shirts/ashbury-dress/25880-8241-s19-1-m-f-f.jpg\",\n \"attributes\": {\n \"description\": \"size & fit\\n\\nloose\\nmidi length\\nmodel is 175 cm and is wearing a size s\\n\\n\\n\\ndetails\\n\\n\\nthe crinkle cotton voile dress with a playful ruffle hem is a wardrobe hero from a day dress with flats to cocktails\",\n \"productteaser\": \"the crinkle cotton voile dress with a playful ruffle hem is a wardrobe hero from a day dress with flats to cocktails in heels.\",\n \"showrecommendations\": \"true\",\n \"longdescription\": \"product origin\\nwe believe that openness and transparency throughout the production chain plays an important role in modern, sustainable manufacturing.\\nmade in: india\\n\\n\\nvendor (main supplier): magn\",\n \"term\": \"dress\",\n \"brand\": \"top picks\",\n \"pricerange\": \"cheap\",\n \"discount\": null,\n \"contenttype\": \"genericproduct\"\n },\n \"id\": 16021440651,\n \"title\": \"ASHBURY DRESS\",\n \"refCode\": \"P-40977269\"\n }\n ]\n }\n]", | |
"field_type": "multi_text" | |
} | |
], | |
"description": "Show a list recommended products based on ML algorithms.", | |
"options": { | |
"html": "<section class=\"related-products optimizely-recs\" id=\"optimizely-widget-{{ widget.$instance }}\">\n<h2>{{ widget.header }}</h2>\n <div class=\"row\">\n {{#products }}\n <div class=\"col-xs-12 col-sm-6 col-lg-3\">\n<div class=\"product-tile-grid\">\n<a class=\"product-tile-grid__image-icon\" data-recid={{id}}>\n<picture class=\"img-fluid product-tile-grid__image\" onclick=\"location.href='{{ url }}'\">\n<img class=\"img-fluid product-tile-grid__image\" src=\"{{ imageUrl }}\" onclick=\"location.href='{{ url }}'\">\n</picture>\n<div class=\"product-tile-grid__image-bottom\">\n<!--<span class=\"jsQuickView hover-feather-icon\" data-toggle=\"modal\" data-target=\"#quickView\" data=\"{{ refCode }}\" productcode=\"{{ refCode }}\" urlquickview=\"/product/quickview\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-eye\"><path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\"></path><circle cx=\"12\" cy=\"12\" r=\"3\"></circle></svg>\n</span>\n<span class=\"addToCart hover-feather-icon\" data=\"{{ refCode }}\" href=\"javascript:void(0);\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-shopping-cart\"><circle cx=\"9\" cy=\"21\" r=\"1\"></circle><circle cx=\"20\" cy=\"21\" r=\"1\"></circle><path d=\"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6\"></path></svg></span>-->\n</div>\n</a>\n<div class=\"product-tile-grid__title\">\n<a href=\"{{ url }}\" data-recid={{id}}>{{ title }}</a>\n {{# prices.USD.showUnitPrice }}\n<div class=\"price__old\">${{ prices.USD.formattedUnitPrice }}</div>\n {{/ prices.USD.showUnitPrice }}\n<div class=\"price__discount\">${{ prices.USD.formattedSalePrice }}</div>\n</div>\n</div>\n</div>\n {{/products }}\n </div>\n</section>", | |
"css": "", | |
"apply_js": "var debugMode = false;\n\nfunction insertPeeriusScript() {\n // Create a new script element\n const script = document.createElement('script');\n \n // Set the attributes\n script.type = 'text/JavaScript';\n script.src = 'https://livedemoshopoiduswe.uswe01.productrecs.episerver.net/tracker/peerius.page';\n script.charset = 'UTF-8';\n \n // Append the script to the document head\n document.head.appendChild(script);\n \n console.log('Peerius script has been inserted successfully');\n}\n\n// Call the function to insert the script\ninsertPeeriusScript();\nvar utils = window.optimizely.get('utils');\nwindow.PeeriusCallbacks = window.PeeriusCallbacks || {};\n\n// Function to return recs related HTML\nfunction expRenderRecs(recsData)\n{\n var recWidgets = recsData;\n if (!debugMode) {\n recWidgets = recWidgets.filter(function(recWidget) {\n return recWidget.position === widget.recsposition;\n });\n if (widget.widget !== 'default' && recWidgets.length > 1 ) {\n recWidgets = recWidgets.filter(function (recWidget) {\n return recWidget.widget === widget.recsposition + '.' + widget.widget;\n });\n }\n if (recWidgets.length === 0) {\n console.log('No product recs matching the configuration');\n return;\n }\n }\n var recs = recWidgets[0].recs.slice(widget.start - 1, widget.start + widget.max - 1);\n var ids = recs.map(function (rec) { return rec.id; });\n recs = recs.map(function (rec) { \n for (var currency in rec.prices) {\n var i = (new URL(rec.img));\n i.protocol = window.location.protocol; // Force protocol matching to ensure images load...\n rec.imageUrl = i.href;\n rec.prices[currency].formattedSalePrice = Number(rec.prices[currency].salePrice).toFixed(2).toString();\n rec.prices[currency].formattedUnitPrice = Number(rec.prices[currency].unitPrice).toFixed(2).toString();\n rec.prices[currency].showUnitPrice = rec.prices[currency].salePrice !== rec.prices[currency].unitPrice;\n }\n return rec;\n });\n var html = extension.$render({\n \twidget: widget,\n products: recs\n });\n \n\t\treturn html;\n}\n\n//*************** RENDERING RECS & INSERTING INTO DOM **********************//\n\nif (debugMode) {\n \n // in debug mode \n \n utils.waitForElement(extension.selector).then(function(el) {\n if (window.PeeriusCallbacks.recs) return;\n //console.log(\"Product Recs: Rendering design time products\");\n expRenderRecs(JSON.parse(extension.example_recs));\n \n // grab HTML\n var recsHTML = expRenderRecs(JSON.parse(extension.example_recs)); \n //console.log('this is recsHTML in debug', recsHTML);\n // insert HTML into DOM\n el.insertAdjacentHTML('afterend',recsHTML);\n //console.log('Product Recs: Not tracking impressions in debug');\n \n });\n} else { \n \n // non-debug mode\n\n utils.waitUntil(function() {\n \n return document.querySelector(widget.selector) && window.PeeriusCallbacks.recs;\n \n }).then(function() {\n \n // grab HTML\n var recsHTML = expRenderRecs(window.PeeriusCallbacks.recs);\n \n // insert HTML into DOM\n document.querySelector(widget.selector).insertAdjacentHTML('afterend', recsHTML);\n console.log('Product Recs: Tracking impressions', ids);\n Peerius.sendAjax(FoundationTracking.Client + \"/rec/shown.pagex?ids=\"+ids.join(\",\"));\n\n });\n\n}\n\n\n // ********************* CLICK TRACKING **********************//\n\nutils.waitForElement('#opti-widget-'+ extension.$instance).then(function(el){\n \n el.addEventListener('click', function(e) {\n var t = document.querySelector(e.target).closest('a[data-recid]');\n var recid = t.getAttribute('recid');\n if (recid !== undefined) {\n //console.log('Product Recs: Tracking click', recid);\n Peerius.smartRecsClick(recid);\n }\n });\n\n});\n", | |
"undo_js": "var extensionHTML = document.querySelector('#optimizely-widget-' + widget.$instance);\nif(extensionHTML) extensionHTML.remove();" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment