Skip to content

Commit

Permalink
Add template for inserting product into cart on DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
w3dd1e committed Nov 19, 2023
1 parent bcb3d1a commit 82bbe30
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions front/js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,38 @@ let cartStoredProduct = Object.keys(sessionStorage);
let cartStoredQtys = Object.values(sessionStorage);
let product ={};
let productID = "";



let newProductCard = `
<article class="cart__item" data-id="${product.id}" data-color="${product.color}">
<div class="cart__item__img">
<img src="${productData[product.id].imageUrl}" alt="${productData[product.id].altTxt}">
</div>
<div class="cart__item__content">
<div class="cart__item__content__description">
<h2>Name of the product</h2>
<p>Green</p>
<p>€42.00</p>
</div>
<div class="cart__item__content__settings">
<div class="cart__item__content__settings__quantity">
<p>Quantity : </p>
<input type="number" class="itemQuantity" name="itemQuantity" min="1" max="100" value="42">
</div>
<div class="cart__item__content__settings__delete">
<p class="deleteItem">Delete</p>
</div>
</div>
</div>
</article>
`;

cartList.insertAdjacentHTML("beforeend", newProductCard);
};






0 comments on commit 82bbe30

Please sign in to comment.