Thank you for this tutorial, it helped me a lot with creating my cart by the use of methods that you showed ;) It took me more hours because I didn't want to copy and paste but create my own logic, so I'm glad you explained everything clearly.
cartCost = parseInt(cartCost); isnt converting the string to a number and rather shows nan and the a number and when you add a item it just adds the number on instead of adding the 2 numbers together
no the code in the video works. I just hadn't cLeared my local storage and refreshed my page. After doing that it worked just like it worked for Telmo. The only thing is that my cart isn't displaying as his, even though I copied all his naming conventions and layouts. My items and prices and qnty in the cart, there all display vertically and not horizontally.
@@henry_sparks Yes I managed to come right, I spoke to my mentor and he says we shouldnt use a map to display items in the cart which makes no sense because the map works in this case
For anyone who's had trouble adding the cost in the local storage (I'm not sure if this will help), make sure you check your spelling. It took me a while to find out that I misspelled "cartCost", where I accidentally used "cartcost" instead. Same with "inCart", I accidentally used "incart" a couple of times.
Hi ! I love the video series too ! Question : Hello, I would like to know how to do so that when you click on the button, you display a message that says "Your item has been added to the cart", "Continue your purchases or go to th cart"?
5:06 cartCos, it didn't show me the price instead it shows a NULL value. After I clicked on the button couple of times, it keep giving the price value that does not according to the product price in the javascript
Your video made me subscribe. your teaching is very honest and clear. Thank you for this wonderful series. i really learned alot. May i suggest a tutorial. product variance options selector. with some complicated features. Such as choice of color changes the status of product sizes and quantity...etc.. nevertheless this series was great for me. thanks again
Hey Telmo, is it just me or there is gap between part 2 and part 3? You have a lot more code in third video then in second... Anyways great stuff and keep up the good work!
Hi Matija, there shouldn't be any extra code, if you pay close attention you will see that the code should be the same from the previous video, I'm glad you are enjoying the series 😊
Hey guys you are right!! I forgot to add the 2nd video, sorry about that, I just uploaded it, and added it tot he playlist!!! Really sorry and thank for letting me know :)
Hey... I'm having an error in third part of the video. Uncaught TypeError: Cannot read properties of undefined (reading 'inCart') Could you please help me out what could have gone wrong in my code?
HEY ! How do you do for difference products in your "let products = [" ? Because I use items on differents pages and when I inspect, it only recognized the first item, can you help me please ? Thank a lot to you
hey guys im struggling with this part i cant get my incart items to add up function setItems(product){ let cartItems=localStorage.getItem('productsInCart'); cartItems = JSON.parse(cartItems); if(cartItems != null) { if(cartItems[product.tag] == undefined){ cartItems = { ...cartItems, [product.tag]: product } } cartItems[product.tag].inCart += 1; } else{ product.inCart= 1; cartItems = { [product.tag]: product
Do not do as he does. Do this: const Products = document.querySelectorAll(".products") for (var i=0; i < Products.length; i++) { console.log(Products); }
So hey guys. Maybe some of you guys are having this problem like I did, that the console shows you null value in the log. Which is fine, because what you need is the key and the value to be registered in the local storage. But if you had the problem like the first clicked showed null value or 0 value in both log and the localstorage, it is simple. Just do this: let cartCost = 0;
if(cartCost != null){ cartCost = localStorage.getItem('totalCost'); if(cartCost != null){ cartCost = parseInt(cartCost); localStorage.setItem("totalCost",cartCost + products.price); }else{ localStorage.setItem("totalCost", products.price); } } It still shows me null in log, but the value in local is not. Have a nice day!
@@ragumathnisha816 Hey... I'm having an error in third part of the video. Uncaught TypeError: Cannot read properties of undefined (reading 'inCart') Could you please help me out what could have gone wrong in my code?
How do you get all the pictures the same size? I am using pictures from unsplash and if I use rem's to change the sizes in css, the details and buttons disappear.
Hi Marijune, you need to make sure all your images are the same size and aspect ratio, then if they are too big just control their size with Css, using the width property
@@theonewhowill4903 the the problem is with that onload function expect this all other things are correct even I commented that part now image's and other information are showing in Cart page but when we refresh the page the value show on Cart button turn out to be 0
For those who having the cartCost adding error (eg: 50 + 50 = 5050) try this :
{
name: 'junior-tiempo',
tag: 'shoe1',
price: 50,
@ 5:49 When I click on 'add cart' for the first time the console displays:
My cartCost is null
Object (instead of string)
...how can i fix it
savior
@Sithum Lahiru thank you,it's help
it worked!!!
THANK YOU SO MUCH
Thank you for this tutorial, it helped me a lot with creating my cart by the use of methods that you showed ;) It took me more hours because I didn't want to copy and paste but create my own logic, so I'm glad you explained everything clearly.
cartCost = parseInt(cartCost); isnt converting the string to a number and rather shows nan and the a number and when you add a item it just adds the number on instead of adding the 2 numbers together
Hi did you manage to get past that problem?
no the code in the video works. I just hadn't cLeared my local storage and refreshed my page. After doing that it worked just like it worked for Telmo. The only thing is that my cart isn't displaying as his, even though I copied all his naming conventions and layouts.
My items and prices and qnty in the cart, there all display vertically and not horizontally.
@@henry_sparks Yes I managed to come right, I spoke to my mentor and he says we shouldnt use a map to display items in the cart which makes no sense because the map works in this case
@@nicholasdiogo5513 Hi thanks. If you're not supposed to use map to display the cart items the what approach should one use?
@@nicholasdiogo5513 Same!!, but what is the solution???
Loving this class ....makes me refresh ..love the way you explain....sure I am gona follow you
Awesome, thank you Santosh :)
the first time I click on the add to cart 'My cartCost is NaN' but will work after the first products been added to the cart, any solutions?
Did you find any solutions for this?
For anyone who's had trouble adding the cost in the local storage (I'm not sure if this will help), make sure you check your spelling. It took me a while to find out that I misspelled "cartCost", where I accidentally used "cartcost" instead. Same with "inCart", I accidentally used "incart" a couple of times.
Hi ! I love the video series too ! Question : Hello,
I would like to know how to do so that when you click on the button, you display a message that says "Your item has been added to the cart", "Continue your purchases or go to th cart"?
Obrigada professor, conteudo incrivel!!
De nada Elisa, espero que tenhas gostado :)
fir those who are getting error in total cost just write.
console.log("my cartcost is ":product.price)
@ 5:49 When I click on 'add cart' for the first time the console displays:
My cartCosst is null
Object (instead of string)
the same ...how can i fix it???
did you find a solution to the problem?
Did anyone find the solution?
same for me
what is the solution for this
@@10pranjalsapkale69 did u figure it out???
I am totally loving this. You are awesome.
Thank you so much!
Links to ABOUT page and CART page are not clickable
help ASAP please
Nice tutorial and helpful for us
5:06 cartCos, it didn't show me the price instead it shows a NULL value. After I clicked on the button couple of times, it keep giving the price value that does not according to the product price in the javascript
for me it shows the type of - my cart cost is --> object
it should be string as per the video
please help me...🔍
Your video made me subscribe. your teaching is very honest and clear. Thank you for this wonderful series. i really learned alot. May i suggest a tutorial. product variance options selector. with some complicated features. Such as choice of color changes the status of product sizes and quantity...etc.. nevertheless this series was great for me. thanks again
Nice tutorial
I want to be able to remove a product from my cart page please I need a link that explains that
Jus Awesome....I learnt loads and loads of things......How can I ever thank you....:D
Hi Pinky, You're very welcome! You can always buy the full course with discount
Hey Telmo, is it just me or there is gap between part 2 and part 3? You have a lot more code in third video then in second... Anyways great stuff and keep up the good work!
Hi Matija, there shouldn't be any extra code, if you pay close attention you will see that the code should be the same from the previous video, I'm glad you are enjoying the series 😊
@@Telmosampaio look at the end of part 2 and the beginning of part 3. There is alot of new code, looks like you missed an episode :(
Hey guys you are right!! I forgot to add the 2nd video, sorry about that, I just uploaded it, and added it tot he playlist!!! Really sorry and thank for letting me know :)
Thank you Telmo Sampaio...
Hey... I'm having an error in third part of the video.
Uncaught TypeError: Cannot read properties of undefined (reading 'inCart')
Could you please help me out what could have gone wrong in my code?
( 8:12 ) total cost is showing 1515 it's not adding the cost
could you make or maybe you have how to integrate google calendar with website?
HEY ! How do you do for difference products in your "let products = [" ?
Because I use items on differents pages and when I inspect, it only recognized the first item,
can you help me please ?
Thank a lot to you
MUITOOOOOOOOOOO OBRIGADO, VOCÊ É 10!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Excellent course
10/08/2020
omygosh ily I really needed this tutorial!
Does this code work for prices with decimals?
Please my images aren't showing any solution?
hey guys im struggling with this part i cant get my incart items to add up
function setItems(product){
let cartItems=localStorage.getItem('productsInCart');
cartItems = JSON.parse(cartItems);
if(cartItems != null) {
if(cartItems[product.tag] == undefined){
cartItems = {
...cartItems,
[product.tag]: product
}
}
cartItems[product.tag].inCart += 1;
} else{
product.inCart= 1;
cartItems = {
[product.tag]: product
Do not do as he does. Do this:
const Products = document.querySelectorAll(".products")
for (var i=0; i < Products.length; i++) {
console.log(Products);
}
For which part of code in the video ?
@ 5:49 When I click on 'add cart' for the first time the console displays:
My cartCost is null
Object (instead of string)
...how can i fix it
@@kryptonwest9059 yeah i also need the solution for this
So hey guys.
Maybe some of you guys are having this problem like I did, that the console shows you null value in the log.
Which is fine, because what you need is the key and the value to be registered in the local storage.
But if you had the problem like the first clicked showed null value or 0 value in both log and the localstorage, it is simple.
Just do this:
let cartCost = 0;
if(cartCost != null){
cartCost = localStorage.getItem('totalCost');
if(cartCost != null){
cartCost = parseInt(cartCost);
localStorage.setItem("totalCost",cartCost + products.price);
}else{
localStorage.setItem("totalCost", products.price);
}
}
It still shows me null in log, but the value in local is not.
Have a nice day!
It worked for me..Thanks a lot :)
@@ragumathnisha816
Hey... I'm having an error in third part of the video.
Uncaught TypeError: Cannot read properties of undefined (reading 'inCart')
Could you please help me out what could have gone wrong in my code?
Good Stuff!
Thanks
How do you get all the pictures the same size? I am using pictures from unsplash and if I use rem's to change the sizes in css, the details and buttons disappear.
Hi Marijune, you need to make sure all your images are the same size and aspect ratio, then if they are too big just control their size with Css, using the width property
Im getting this error
cartfun.js:60 Uncaught TypeError: Cannot set property 'textContent' of null
on cart console
@@theonewhowill4903 What to do know 😂
I tried everything it's still not working the problem is with onload function
@@theonewhowill4903 the the problem is with that onload function expect this all other things are correct even I commented that part now image's and other information are showing in Cart page but when we refresh the page the value show on Cart button turn out to be 0
Please provide github link
my totalCost is not showing up in the local storage
let cartCost = localStorage.getItem('totalCost');
if ( cartCost === null){
localStorage.setItem('totalCost', product.price);
} else {
cartCost = parseInt(cartCost);
localStorage.setItem('totalCost', cartCost + product.price);
}
It’s not adding the price for me what could be the problem?
same here answer me if you found any solutions
let cartCost = localStorage.getItem('totalCost');
if ( cartCost === null){
localStorage.setItem('totalCost', product.price);
} else {
cartCost = parseInt(cartCost);
localStorage.setItem('totalCost', cartCost + product.price);
}
Siddhesh.B. Kukade still not working instead of adding it its concatenating the numbers
Problem with cartCost. why?
It works for me!! WHy??
@@Telmosampaio It's a random problem?!
Actually i have a question to ask : are there any random problems in the programming word ?
👍👍👍👍
You are Bad UA-cam You dont't provide source code
my cart button still zero else i refresh the page ! can you help me to know way?