From 245076ae4b225f633838bd8479de526c18af785c Mon Sep 17 00:00:00 2001 From: Anshuman Tiwari Date: Wed, 24 Jul 2024 18:06:42 +0000 Subject: [PATCH] plus page added --- plus/index.html | 43 ++----------------------- plus/plus.js | 19 +++++++++++ plus/products.json | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 40 deletions(-) create mode 100644 plus/products.json diff --git a/plus/index.html b/plus/index.html index 33d0124e..ef98899a 100644 --- a/plus/index.html +++ b/plus/index.html @@ -1,23 +1,18 @@ - - - Flipkart | Online Shopping Site for Mobiles, Electronics, Furniture, - Grocery, Lifestyle, Books & More. Best Offers! - + Flipkart Plus | Membership Benefits -
- This is Header + Flipkart Plus Membership
@@ -128,38 +123,7 @@

Welcome to Flipkart Plus Zone

-
-
- Product Image -
Moto G
-
₹9999
-
-
- Product Image -
Poco M6
-
₹11,999
-
-
- Product Image -
Poco C65
-
₹21,999
-
-
- Product Image -
Moto A14
-
₹19,999
-
-
- Product Image -
Poco C65
-
₹21,999
-
-
- Product Image -
Moto G
-
₹9999
-
-
+
@@ -168,5 +132,4 @@

Welcome to Flipkart Plus Zone

- diff --git a/plus/plus.js b/plus/plus.js index de63fd68..a89ae08c 100644 --- a/plus/plus.js +++ b/plus/plus.js @@ -51,6 +51,25 @@ let btmText = ` document.getElementById("btmTxtP").innerHTML = btmText; +document.addEventListener("DOMContentLoaded", () => { + fetch("products.json") + .then(response => response.json()) + .then(products => { + const productList = document.getElementById("productList"); + products.forEach(product => { + const productDiv = document.createElement("div"); + productDiv.className = "product"; + productDiv.innerHTML = ` + Product Image +
${product.name}
+
${product.price}
+ `; + productList.appendChild(productDiv); + }); + }) + .catch(error => console.error("Error loading products:", error)); +}); + // fetch header footer document.addEventListener("DOMContentLoaded", () => { diff --git a/plus/products.json b/plus/products.json new file mode 100644 index 00000000..5ebd9b06 --- /dev/null +++ b/plus/products.json @@ -0,0 +1,80 @@ +[ + { + "name": "Moto G", + "price": "₹9999", + "image": "../img/phone-6.webp", + "category": "Mobile" + }, + { + "name": "Poco M6", + "price": "₹11,999", + "image": "../img/phone-2.webp", + "category": "Mobile" + }, + { + "name": "Poco C65", + "price": "₹21,999", + "image": "../img/phone-3.webp", + "category": "Mobile" + }, + { + "name": "Moto A14", + "price": "₹19,999", + "image": "../img/phone-5.webp", + "category": "Mobile" + }, + { + "name": "Samsung Galaxy", + "price": "₹15,999", + "image": "https://fdn2.gsmarena.com/vv/pics/samsung/samsung-galaxy-s22-ultra-5g-2.jpg", + "category": "Mobile" + }, + { + "name": "iPhone 12", + "price": "₹59,999", + "image": "https://fdn2.gsmarena.com/vv/pics/apple/apple-iphone-12-r1.jpg", + "category": "Mobile" + }, + { + "name": "Dell Inspiron 15", + "price": "₹45,999", + "image": "https://i.dell.com/is/image/DellContent/content/dam/ss2/product-images/dell-client-products/notebooks/inspiron-notebooks/15-3530-intel/media-gallery/silver-plastic/notebook-inspiron-15-3530-nt-plastic-usbc-silver-gallery-4.psd?fmt=pjpg&pscan=auto&scl=1&wid=4582&hei=2810&qlt=100,1&resMode=sharp2&size=4582,2810&chrss=full&imwidth=5000", + "category": "Laptop" + }, + { + "name": "HP Pavilion x360", + "price": "₹55,999", + "image": "https://m.media-amazon.com/images/I/71Njhmxnc5L.jpg", + "category": "Laptop" + }, + { + "name": "Apple MacBook Air", + "price": "₹92,999", + "image": "https://store.storeimages.cdn-apple.com/4668/as-images.apple.com/is/mba13-midnight-select-202402?wid=904&hei=840&fmt=jpeg&qlt=90&.v=1708367688034", + "category": "Laptop" + }, + { + "name": "Logitech MX Master 3", + "price": "₹8,499", + "image": "https://m.media-amazon.com/images/I/613a-3jtieL.jpg", + "category": "Accessory" + }, + { + "name": "Sony WH-1000XM4", + "price": "₹29,990", + "image": "https://www.sony.co.in/image/5d02da5df552836db894cead8a68f5f3?fmt=pjpeg&wid=330&bgcolor=FFFFFF&bgc=FFFFFF", + "category": "Accessory" + }, + { + "name": "Philips Air Fryer", + "price": "₹12,999", + "image": "https://m.media-amazon.com/images/I/61uCr9G6hIL._AC_UF894,1000_QL80_.jpg", + "category": "Home Appliance" + }, + { + "name": "Samsung 32' Smart TV", + "price": "₹22,999", + "image": "https://images.samsung.com/is/image/samsung/p6pim/in/ua32t4340akxxl/gallery/in-hd-tv-ua32t4340akxxl-front-black-537470101?$650_519_PNG$", + "category": "Home Appliance" + } +]