forked from RohitMBelure/Project_Sugar_Cosmetics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
78 lines (65 loc) · 3.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var addToCardArr = JSON.parse(localStorage.getItem("addToCardData")) || []
function bestSellerCardOne(){
const productImage = document.querySelector('#card1_row1 img').getAttribute("src");
const productName = document.querySelector('#card1_row1 p').textContent;
const productCurrency = document.querySelector('#card1_row1 span').textContent;
const productPrice = document.querySelector('#card1_row1 span+span').textContent;
console.log(productImage, productName, productCurrency, productPrice)
let addToCardObject = {
img: productImage
,name: productName,
ProductCurrency: productCurrency,
price: productPrice,
}
addToCardArr.push(addToCardObject);
localStorage.setItem("addToCardData", JSON.stringify(addToCardArr))
window.location.reload();
}
function superSaverCart1(){
const productImage = document.querySelector('#card1_row2 img').getAttribute("src");
const productName = document.querySelector('#card1_row2 p').textContent;
const productCurrency = document.querySelector('#card1_row2 span+span+span').textContent;
const productPrice = document.querySelector('#card1_row2 span+span+span+span').textContent;
console.log(productImage, productName, productCurrency, productPrice)
let addToCardObject = {
img: productImage
,name: productName,
ProductCurrency: productCurrency,
price: productPrice,
}
addToCardArr.push(addToCardObject);
localStorage.setItem("addToCardData", JSON.stringify(addToCardArr))
window.location.reload();
}
function superSaverCart2(){
const productImage = document.querySelector('#card2_row2 img').getAttribute("src");
const productName = document.querySelector('#card2_row2 p').textContent;
const productCurrency = document.querySelector('#card2_row2 span+span+span').textContent;
const productPrice = document.querySelector('#card2_row2 span+span+span+span').textContent;
console.log(productImage, productName, productCurrency, productPrice)
let addToCardObject = {
img: productImage
,name: productName,
ProductCurrency: productCurrency,
price: productPrice,
}
addToCardArr.push(addToCardObject);
localStorage.setItem("addToCardData", JSON.stringify(addToCardArr))
window.location.reload();
}
function superSaverCart3(){
const productImage = document.querySelector('#card1_row3 img').getAttribute("src");
const productName = document.querySelector('#card1_row3 p').textContent;
const productCurrency = document.querySelector('#card1_row3 span+span+span').textContent;
const productPrice = document.querySelector('#card1_row3 span+span+span+span').textContent;
console.log(productImage, productName, productCurrency, productPrice)
let addToCardObject = {
img: productImage
,name: productName,
ProductCurrency: productCurrency,
price: productPrice,
}
addToCardArr.push(addToCardObject);
localStorage.setItem("addToCardData", JSON.stringify(addToCardArr))
window.location.reload();
}