Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhiupman568 committed Jun 7, 2024
0 parents commit b293451
Show file tree
Hide file tree
Showing 67 changed files with 27,034 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Flipkart clone is copy of Flipkart website and it's Static with features like add product to cart, remove from cart, increase quantity in cart, search product etc.
Technology used - : HTML 5, CSS 3, Javascript.


12 changes: 12 additions & 0 deletions assets/html/cart.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>FLIPKART CLONE-BY NIDHI UPMAN</title>
</head>
<body>

</body>
</html>
Binary file added assets/images/aj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/empty-cart-png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/empty_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/flipkartlogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/no_results_found.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/plus_b13a8b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slider1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slider2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slider3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slider4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slider5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slidersmall/slider1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slidersmall/slider2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slidersmall/slider3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slidersmall/slider5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/slider/slidersmall/slider6.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
176 changes: 176 additions & 0 deletions assets/javascript/cart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
window.addEventListener("load",initevents);
function initevents(){
loadProducts();
}
function loadProducts(){
if(localStorage.cartProducts){
var data = JSON.parse(localStorage.cartProducts);
obj.itemList = data;
printItems();
calculateTotal();
cartCount();
}
}
function cartCount(){
count = obj.cartCounter();
emp = document.getElementById("empt");
if(count != 0){
emp.style.display = 'none';
}
else if(count == 0){
emp.style.display = 'initial';
}
document.getElementById("counter1").innerHTML = count;
document.getElementById("counter").innerHTML = count;
}
function saveChanges(){
if(window.localStorage){
var json = JSON.stringify(obj.itemList);
console.log(json);
localStorage.setItem('cartProducts',json);
}
else {
alert("Localstorage not supported...");
}
}
function printItems() {
var rupee=document.getElementById("rupee").innerHTML;
var ul = document.getElementById("cartproduct");
ul.innerHTML = "";
obj.itemList.forEach(function(elem){
var li = document.createElement("li");
li.className = 'product';
li.setAttribute('title', elem.id);
// li.className = 'list-group-item product';
var p_name = document.createElement("span");
p_name.innerHTML = elem.name;
p_name.className = 'name';
var p_curr = document.createElement("span");
p_curr.innerHTML = rupee;
p_curr.className = 'curr';
var p_price = document.createElement("span");
p_price.innerHTML = elem.price;
p_price.className = 'pprice';
var p_image = document.createElement("img");
p_image.className = 'productImage';
p_image.setAttribute('src', elem.image);
var delete_button = document.createElement("button");
delete_button.innerHTML = "<i class='fas fa-trash'/> Remove";
delete_button.className = 'delbtn';
var plus_button = document.createElement("button");
plus_button.innerHTML = "<i class='fas fa-plus'></i>";
plus_button.className = 'plusbtn';
var quan_button = document.createElement("span");
quan_button.innerHTML = elem.quantity;
quan_button.className = 'quanbtn';
var minus_button = document.createElement("button");
minus_button.innerHTML = "<i class='fas fa-minus'></i>";
minus_button.className = 'minusbtn';
var div6 = document.createElement("div");
var div5 = document.createElement("div");
var div4 = document.createElement("div");
var div3 = document.createElement("div");
var div2 = document.createElement("div");
var div1 = document.createElement("div");
div1.className = 'div-img';
div2.className = 'div-text';
div2.setAttribute('title', elem.id);
div3.className = 'div-name';
div4.className = 'div-price';
div5.className = 'div-pm';
div6.className = 'div-rem';
div6.setAttribute('title', elem.id);
div5.setAttribute('title', elem.id);
div4.setAttribute('title', elem.id);
div1.setAttribute('title', elem.id);
div3.setAttribute('title', elem.id);
div1.appendChild(p_image);
div3.appendChild(p_name);
div4.appendChild(p_curr);
div4.appendChild(p_price);
div5.appendChild(minus_button);
div5.appendChild(quan_button);
div5.appendChild(plus_button);
div6.appendChild(delete_button);
div2.appendChild(div3);
div2.appendChild(div4);
div2.appendChild(div5);
div2.appendChild(div6);
li.appendChild(div1);
li.appendChild(div2);
ul.appendChild(li);
delete_button.addEventListener("click", deleteProduct);
plus_button.addEventListener("click", plusProduct);
for(var i = 0; i < obj.itemList.length; i++){
if(obj.itemList[i].quantity > 1)
minus_button.addEventListener("click", minusProduct);
// else
// window.alert("minimum quantity must be 1...");
}
})
}
function deleteProduct(){
var elem = event.srcElement;
elem = elem.parentElement;
elem = elem.parentNode;
console.log("Deleting", elem);
var id = elem.title;
obj.deleteItem(id);
printItems();
saveChanges();
calculateTotal();
cartCount();
}
function calculateTotal(){
var price = 0;
for(var i = 0; i < obj.itemList.length; i++){
price += parseInt(obj.itemList[i].price);
}
document.getElementById("total").innerHTML = price;
}
function plusProduct(){
var ele = event.srcElement;
ele = ele.parentElement;
ele = ele.parentElement;
var id = ele.title;
var com = 0;
for(var i = 0; i < obj.itemList.length; i++){
if( id == obj.itemList[i].id)
com = i;
}
console.log(com);
var n = obj.itemList[com].quantity;
var pri = obj.itemList[com].price;
pri = pri/n;
var pr = obj.itemList[com].price;
pr = pr+pri;
obj.itemList[com].price = pr;
n++;
obj.itemList[com].quantity = n;
printItems();
saveChanges();
calculateTotal();
}
function minusProduct(){
var ele = event.srcElement;
ele = ele.parentElement;
ele = ele.parentElement;
var id = ele.title;
console.log(ele);
var com = 0;
for(var i = 0; i < obj.itemList.length; i++){
if( id == obj.itemList[i].id)
com = i;
}
var n = obj.itemList[com].quantity;
var pri = obj.itemList[com].price;
pri = pri/n;
var pr = obj.itemList[com].price;
pr = pr-pri;
obj.itemList[com].price = pr;
n--;
obj.itemList[com].quantity = n;
printItems();
saveChanges();
calculateTotal();
}
2 changes: 2 additions & 0 deletions assets/javascript/jquery-3.3.1.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit b293451

Please sign in to comment.