Skip to content

Commit

Permalink
Merge pull request #134 from raghavasrujan/Shopping-cart-bug
Browse files Browse the repository at this point in the history
Shopping cart bug
  • Loading branch information
Akshay6890 authored May 24, 2022
2 parents 8cfc0f5 + fa8a9a2 commit 00a3c4e
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .idea/Book-Recommendation-Analysis.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions bookstore/static/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ setTimeout(()=>{
// for add to cart

$(document).ready(function(){
$('#wishlist').text(localStorage.length)
$('#wishlist').text(localStorage.length-1)

$('#add-to-cart').click( ()=>{

Expand Down Expand Up @@ -79,12 +79,12 @@ $(document).ready(function(){
localStorage.setItem(product_id,JSON.stringify(sa))

console.log(localStorage.getItem(product_id))
$('#wishlist').text(localStorage.length)
$('#wishlist').text(localStorage.length-1)
$('#add-to-cart').text("Added to cart")

})
$('#logout-user').click(()=>{
localStorage.clear();
// localStorage.clear();
console.log("Session Data Cleared..")
})

Expand All @@ -109,12 +109,24 @@ $(document).ready(function(){
</table>`)

for(let i=0;i<localStorage.length;i++){
// let product_name=localStorage.key(i);
//
// let price = JSON.parse(localStorage.getItem(product_name))[0]
//
// let quantity = JSON.parse(localStorage.getItem(product_name))[1]
let product_name=localStorage.key(i);

let price = JSON.parse(localStorage.getItem(product_name))[0]

let quantity = JSON.parse(localStorage.getItem(product_name))[1]
p = localStorage.getItem(product_name)
if (product_name == "theme")
{
i += 1
product_name=localStorage.key(i);
}

p = localStorage.getItem(product_name)
let price = JSON.parse(p)[0]


let quantity = JSON.parse(p)[1]

let html_content =`<tr>
<td>${product_name}</td>
Expand Down
Binary file added flask_session/008c39e669051ed9f03f773ef0f5089a
Binary file not shown.
Binary file added flask_session/0b5a7bf727e21eefefb28f55c884453d
Binary file not shown.
Binary file added flask_session/13103ebbebdac5325e8365198aa6f879
Binary file not shown.
Binary file added flask_session/145069174625f9e1f03ecb60e2f81e5a
Binary file not shown.
Binary file added flask_session/2029240f6d1128be89ddc32729463129
Binary file not shown.
Binary file added flask_session/3b42e5dcdf0b0bf564db461682ee28ba
Binary file not shown.
Binary file added flask_session/968783f753282ac14b2fd9976703ec8e
Binary file not shown.

0 comments on commit 00a3c4e

Please sign in to comment.