316
316
.fa-brands .fa-x-twitter : hover {
317
317
color : # 181e20 !important ;
318
318
}
319
+ .wishBtn {
320
+ font-family : var (--ff-poppins );padding : 10px 20px ;
321
+ background-color : rgb (196 , 74 , 74 );
322
+ color : white;
323
+ border : none;
324
+ border-radius : 5px ;
325
+ cursor : pointer;
326
+ margin-top : 5px ;
327
+ }
328
+ .menu_items .items {
329
+ background-color : # f2f2f2 ;
330
+ box-shadow : 0 0 10px rgba (224 , 224 , 252 , 0.678 );
331
+ border : 1px solid rgb (186 , 186 , 201 );
332
+ margin : 50px 10px ;
333
+ height : 416px ;
334
+ width : 230px ;
335
+ border-radius : 10px ;
336
+ text-align : center;
337
+ font-family : "Bree Serif" , serif;
338
+ /* transition: 0.5s ease-in-out; */
339
+ }
319
340
</ style >
320
341
</ head >
321
342
@@ -427,7 +448,7 @@ <h3 style="font-family: var(--ff-philosopher);">Phonograph</h3>
427
448
< button class ="butt add-to-cart-button " data-product-id ="1.01 " data-product-name ="Phonograph "
428
449
data-product-price ="10.20 " style ="font-family:var(--ff-philosopher); "> Order Now</ button >
429
450
430
- < div class ="star-rating ">
451
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
431
452
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
432
453
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
433
454
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -446,7 +467,7 @@ <h3 style="font-family: var(--ff-philosopher);">Radio</h3>
446
467
< p style ="font-family: Garamond; "> $10.20</ p >
447
468
< button class ="butt add-to-cart-button " data-product-id ="1.02 " data-product-name ="Radio "
448
469
data-product-price ="10.20 " style ="font-family:var(--ff-philosopher); "> Order Now</ button >
449
- < div class ="star-rating ">
470
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
450
471
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
451
472
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
452
473
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -466,7 +487,7 @@ <h3 style="font-family: var(--ff-philosopher);">Television</h3>
466
487
< p style ="font-family: Garamond; "> $10.20</ p >
467
488
< button class ="butt add-to-cart-button " data-product-id ="1.03 " data-product-name ="Television "
468
489
data-product-price ="10.20 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
469
- < div class ="star-rating ">
490
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
470
491
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
471
492
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
472
493
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -485,6 +506,7 @@ <h3 style="font-family: var(--ff-philosopher);">Movie Screen Carpet</h3>
485
506
< p style ="font-family: Garamond; "> $10.20</ p >
486
507
< button class ="butt add-to-cart-button " data-product-id ="1.04 " data-product-name ="Movie Screen Carpet "
487
508
data-product-price ="10.20 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
509
+ < button class ="wishBtn "> Add to Wishlist</ button >
488
510
< div class ="star-rating ">
489
511
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
490
512
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
@@ -507,7 +529,7 @@ <h3 style="font-family: var(--ff-philosopher);">Toys</h3>
507
529
< p style ="font-family: Garamond; "> $10.20</ p >
508
530
< button class ="butt add-to-cart-button " data-product-id ="1.05 " data-product-name ="Toys "
509
531
data-product-price ="10.20 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
510
- < div class ="star-rating ">
532
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
511
533
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
512
534
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
513
535
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -526,7 +548,7 @@ <h3 style="font-family: var(--ff-philosopher);">Puppet Show</h3>
526
548
< p style ="font-family: Garamond; "> $10.20</ p >
527
549
< button class ="butt add-to-cart-button " data-product-id ="1.06 " data-product-name ="Puppet Show "
528
550
data-product-price ="10.20 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
529
- < div class ="star-rating ">
551
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
530
552
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
531
553
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
532
554
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -545,7 +567,7 @@ <h3 style="font-family: var(--ff-philosopher);">Marbles</h3>
545
567
< p style ="font-family: Garamond; "> $10.20</ p >
546
568
< button class ="butt add-to-cart-button " data-product-id ="1.07 " data-product-name ="Marbles "
547
569
data-product-price ="10.20 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
548
- < div class ="star-rating ">
570
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
549
571
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
550
572
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
551
573
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -564,7 +586,7 @@ <h3 style="font-family: var(--ff-philosopher);">Drinks</h3>
564
586
< p style ="font-family: Garamond; "> $10.20</ p >
565
587
< button class ="butt add-to-cart-button " data-product-id ="1.08 " data-product-name ="Drinks "
566
588
data-product-price ="10.20 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
567
- < div class ="star-rating ">
589
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
568
590
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
569
591
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
570
592
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -595,7 +617,7 @@ <h3 style="font-family: var(--ff-philosopher);">Telephone</h3>
595
617
< p style ="font-family: Garamond; "> $5.10</ p >
596
618
< button class ="butt add-to-cart-button " data-product-id ="2.01 " data-product-name ="Telephone "
597
619
data-product-price ="5.10 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
598
- < div class ="star-rating ">
620
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
599
621
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
600
622
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
601
623
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -614,7 +636,7 @@ <h3 style="font-family: var(--ff-philosopher);">Pager</h3>
614
636
< p style ="font-family: Garamond; "> $5.10</ p >
615
637
< button class ="butt add-to-cart-button " data-product-id ="2.02 " data-product-name ="Pager "
616
638
data-product-price ="5.10 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
617
- < div class ="star-rating ">
639
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
618
640
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
619
641
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
620
642
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -633,7 +655,7 @@ <h3 style="font-family:var(--ff-philosopher);">Camera</h3>
633
655
< p style ="font-family: Garamond; "> $5.10</ p >
634
656
< button class ="butt add-to-cart-button " data-product-id ="Snacks " data-product-name ="Camera "
635
657
data-product-price ="5.10 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
636
- < div class ="star-rating ">
658
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
637
659
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
638
660
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
639
661
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -653,7 +675,7 @@ <h3 style="font-family: var(--ff-philosopher);">Type Writer</h3>
653
675
< button class ="butt add-to-cart-button " data-product-id ="2.04 " data-product-name ="Type Writer "
654
676
style ="font-family: Garamond; " data-product-price ="5.10 "
655
677
style ="font-family: var(--ff-philosopher); "> Order Now</ button >
656
- < div class ="star-rating ">
678
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
657
679
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
658
680
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
659
681
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -677,7 +699,7 @@ <h3 style="font-family: var(--ff-philosopher);">Cross Bow</h3>
677
699
< p style ="font-family: Garamond; "> $15.80</ p >
678
700
< button class ="butt add-to-cart-button " data-product-id ="3.01 " data-product-name ="Cross Bow "
679
701
data-product-price ="15.80 " style ="font-family:var(--ff-philosopher); "> Order Now</ button >
680
- < div class ="star-rating ">
702
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
681
703
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
682
704
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
683
705
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -696,7 +718,7 @@ <h3 style="font-family: var(--ff-philosopher); font-size: 25px">Catapult</h3>
696
718
< p style ="font-family: Garamond; "> $15.80</ p >
697
719
< button class ="butt add-to-cart-button " data-product-id ="3.02 " data-product-name ="Catapult "
698
720
style ="font-family: var(--ff-philosopher); " data-product-price ="15.80 "> Order Now</ button >
699
- < div class ="star-rating ">
721
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
700
722
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
701
723
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
702
724
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -715,7 +737,7 @@ <h3 style="font-family: var(--ff-philosopher);">Sedan Chair</h3>
715
737
< p style ="font-family: Garamond; "> $15.80</ p >
716
738
< button class ="butt add-to-cart-button " data-product-id ="3.03 " data-product-name ="Sedan Chair "
717
739
data-product-price ="15.80 " style ="font-family: var(--ff-philosopher); "> Order Now</ button >
718
- < div class ="star-rating ">
740
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
719
741
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
720
742
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
721
743
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -733,7 +755,7 @@ <h3 style="font-family:var(--ff-philosopher);">Palsnkin</h3>
733
755
< p style ="font-family: Garamond; "> $15.80</ p >
734
756
< button class ="butt add-to-cart-button " data-product-id ="3.04 " data-product-name ="Palsnkin "
735
757
data-product-price ="15.80 " style ="font-family:var(--ff-philosopher); "> Order Now</ button >
736
- < div class ="star-rating ">
758
+ < button class =" wishBtn " > Add to Wishlist </ button > < div class ="star-rating ">
737
759
< button class ="star-button " onclick ="rateItem(this, 1) "> < i class ="fas fa-star "> </ i > </ button >
738
760
< button class ="star-button " onclick ="rateItem(this, 2) "> < i class ="fas fa-star "> </ i > </ button >
739
761
< button class ="star-button " onclick ="rateItem(this, 3) "> < i class ="fas fa-star "> </ i > </ button >
@@ -989,7 +1011,49 @@ <h4 style="font-family: var(--ff-philosopher);color: hsl(304, 14%, 46%);">Follow
989
1011
< script src ="cart.js "> </ script >
990
1012
< div class ="gtranslate_wrapper "> </ div >
991
1013
< script > window . gtranslateSettings = { "default_language" :"en" , "detect_browser_language" :true , "wrapper_selector" :".gtranslate_wrapper" } </ script >
992
- < script src ="https://cdn.gtranslate.net/widgets/latest/float.js " defer > </ script >
1014
+ < script src ="https://cdn.gtranslate.net/widgets/latest/float.js " defer >
1015
+ </ script >
1016
+ < script >
1017
+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
1018
+ let WishlistButtons = document . querySelectorAll ( '.wishBtn' ) ;
1019
+
1020
+ WishlistButtons . forEach ( function ( Wish ) {
1021
+ Wish . addEventListener ( 'click' , function ( event ) {
1022
+ if ( event . target . classList . contains ( 'wishBtn' ) ) {
1023
+ var item = event . target . closest ( '.items' ) ;
1024
+ var itemName = item . querySelector ( 'h3' ) . textContent ;
1025
+ var itemPrice = item . querySelector ( 'p' ) . textContent ;
1026
+
1027
+ // Retrieve existing wishlist items from localStorage
1028
+ var Wishlists = JSON . parse ( localStorage . getItem ( 'Wishlists' ) ) || [ ] ;
1029
+
1030
+ // Check if the item already exists in the wishlist
1031
+ var itemExists = Wishlists . some ( function ( wishlistItem ) {
1032
+ return wishlistItem . name === itemName ;
1033
+ } ) ;
1034
+
1035
+ if ( itemExists ) {
1036
+ // If the item exists, show a prompt that it already exists
1037
+ alert ( "This item is already in your wishlist." ) ;
1038
+ } else {
1039
+ // If the item doesn't exist, add it to the wishlist
1040
+ var newWish = { name : itemName , price : itemPrice } ;
1041
+ Wishlists . push ( newWish ) ;
1042
+
1043
+ // Save updated wishlist back to localStorage
1044
+ localStorage . setItem ( 'Wishlists' , JSON . stringify ( Wishlists ) ) ;
1045
+
1046
+ alert ( "Item added to Wishlist successfully" ) ;
1047
+
1048
+ // Redirect to the wishlist page
1049
+ window . location . href = "wishlist.html" ;
1050
+ }
1051
+ }
1052
+ } ) ;
1053
+ } ) ;
1054
+ } ) ;
1055
+
1056
+ </ script >
993
1057
</ body >
994
1058
995
1059
</ html >
0 commit comments