Thanks a lot! Please upload new videos everyday. We are waiting for your new uploads, thank you :)
@RizwanKhanDeveloper4 жыл бұрын
Sure everyday
@ethiopian_movie_new Жыл бұрын
i'm learning a lot of things bro you're insane
@RizwanKhanDeveloper Жыл бұрын
Thanks 😊
@habiburrehman007663 жыл бұрын
I have a problem, every thing is jsut fine items are adding to cart but item quantity is not updating when sending requests many times
@sonthanh18103 жыл бұрын
thank you for video tutorial
@fidellistaz7664 жыл бұрын
i think its more clear especially for less advanced developers if you start with the client side , so that we see and we will understand better what you are talking about , because now you are talking about things that are in thin air ,its hard to keep up atleast for beginners
@RizwanKhanDeveloper4 жыл бұрын
You have watched till this part just little of patience then after front end will begin and you are gonna love it
@fidellistaz7664 жыл бұрын
@@RizwanKhanDeveloper thank you ,I hope so ,
@RizwanKhanDeveloper4 жыл бұрын
Today is 15th August, Today is Independence of our Country, Happy Independence Day 🥳🥳🥳 Hit like if you are proud 🇮🇳 🇮🇳 🇮🇳
@MohammadBarghamadii2 жыл бұрын
Thank you so much, Dear Rizwan khan
@RizwanKhanDeveloper2 жыл бұрын
Most welcome
@aarshijethwa91122 жыл бұрын
I am not getting the user id in the postman req.user._id is not working. Please help
@PlayForFun0012 жыл бұрын
Thanks a lot I was stuck here
@JahidHasan-zl7om3 жыл бұрын
user error in adding cart items , Like you I also required it true , thats whay it showing me validator error
@rahultirkey79502 жыл бұрын
Do you store cartItems in localStorage when user not login & then your user login/signup you send the data to database?
@vgagaleski4 жыл бұрын
Amazing content! Keep up the good work!
@RizwanKhanDeveloper4 жыл бұрын
Thanks 😊
@mijael24304 жыл бұрын
great dude, amazing content and keep forward!!
@RizwanKhanDeveloper4 жыл бұрын
Mijael Arancibia thank you so much
@ShashiKumar-lf4tz2 жыл бұрын
Greate teaching way, and thans for this effort, I am facing one issue when I am accessing data of cart for increasing quantity then showing enent error means nit recognize object format of cart data how can solve it, please tell me
@itdevelopment45902 жыл бұрын
done❤
@sheetallalwani12904 жыл бұрын
we can take pdf as input? Or have to change img to doc?
@kebekebe22014 жыл бұрын
i'm proud of you , thanks
@RizwanKhanDeveloper4 жыл бұрын
Your welcome my friend
@kebekebe22014 жыл бұрын
@@RizwanKhanDeveloper can i ask you one somethings
@adityagoswami68813 жыл бұрын
controller/cart.js ( 22:33) In line number 16 what is the significance of _cart. and why execute the code ,Can anyone help ? Thank you ,your help is truly appreciated
@tanzimulhasib28333 жыл бұрын
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client please help
@bysinyor57094 жыл бұрын
Hi Dude. thank you for tutorial .)
@RizwanKhanDeveloper4 жыл бұрын
Happy to help
@tiny-thanos2 жыл бұрын
How to add quantity of a product it many products are already there, I am trying to do it but everytime I add it my entire cart gets empty and only that product is left with its updated quantity
@yashuarushed18773 жыл бұрын
To Impletement cart we can use another approach create cart array in the user model, instead of creating a seperate cart model for that, I think this approach will be better, what is your opinion. Can you also tell me some pros and cons of not using that approach
@RizwanKhanDeveloper3 жыл бұрын
Sounds good to me Pros : you can fetch the cart details along with user details Cons: payload might be large if you will have lots of item in your cart But overall it’s a good approach bro and you can do this type of thing only in mongodb not possible with relational database
@junangameplays32714 жыл бұрын
Amazing, thanks so much !
@komalsutar55514 жыл бұрын
Hello Rizwan, When can we have further uploads? Can you please share further videos' ASAP
Hello, thanks for the video. Something is incorrect in my code: when I add a product { "cartItems": { "product": "5fbf5d2cad96aaa75d3217bc", "quantity": 1, "price": 1452 } } It accepts to add the first product more than one, the second product is added once, if i try to add again the second product it clear old product from database. Can you help?
@mustafaalhm96222 жыл бұрын
you can use this if (item) { cart.cartItems.forEach(prod => { if(prod.product == product){ prod.quantity =prod.quantity + req.body.cartItems.quantity; cart.save(); res.status(200).json({cart}) } }); } else { Cart.findOneAndUpdate({ user: req.user._id }, { "$push": { "cartItems": req.body.cartItems } }) .exec((err, _cart) => { if (err) return res.status(400).json(err.message); if (_cart) return res.status(200).json({ _cart }); }) }
@MdShimul-xk9sz4 жыл бұрын
Thanks
@RizwanKhanDeveloper4 жыл бұрын
Your welcome ☺️
@arpitdamami76394 жыл бұрын
Hii Bro, in my case the quantity is showing 11 when send json second time
@RizwanKhanDeveloper4 жыл бұрын
Don’t worry just continue now we will work on cart again
@arpitnote57374 жыл бұрын
@@RizwanKhanDeveloper okay bro.. thanks
@m0hit_m3 жыл бұрын
Hello, Bro, I was also having the same problem so after an hour of finding error I got to know that in postman when I was giving JSON data I was providing quantity as a string rather than a number i.e "quantity": "1" rather than "quantity": 1 (correct)
@Eng.AwsNafea2 жыл бұрын
Greate content. Can I ask why you dont use async await ?
@RizwanKhanDeveloper2 жыл бұрын
No special reason I could have use async await. It’s upto you
@Eng.AwsNafea2 жыл бұрын
@@RizwanKhanDeveloper Thank you, It is a really amazing videos
@komalsutar55514 жыл бұрын
Can you please check for the below error?
@temuujinesukhei64454 жыл бұрын
Thank you for nice tutorial. I have problem. TypeError: Cannot read property 'product' of null at C:\Users\Xero\Desktop\mern-ecommerce\mern-back-end\src\controllers\cart.js:8:53 Also when i add to cart sometimes cartItem is shown null [ ]
@nathanwichman15034 жыл бұрын
Great tutorial! I have a question though. If you already have the cart from the db in the Cart.findOne, why do we need to do the Cart.findOneAndUpdate when we can just change that cart object returned from the findOne and then do cart.Save()? I did it this way after struggling to get it to work in the way you did it, and it seems to work fine. Is there any issue with this approach?
@RizwanKhanDeveloper4 жыл бұрын
You can share current code and your approach in WebScript.info so I will get an idea and let you know whats good or bad
@rasheed99472 жыл бұрын
save load the documment in the memory but update dont
@resha46532 жыл бұрын
i don't know why. but this doesn't work for me. User can not add product again. Error of duplicate id occur
@ashikurrahmanmunna54313 жыл бұрын
I have signed in with user account. But it is giving me user access denied message.
@obi.39654 жыл бұрын
hi brother how to use async await in add items to the cart .i tried a lot but i am not able to find the solution.
@RizwanKhanDeveloper4 жыл бұрын
Why do u need to use async await
@obi.39654 жыл бұрын
@@RizwanKhanDeveloper because in modern way, I should use async await or .then promises.
Great videos! but you are checking for existing items in carts and updating the quantity only. Suppose, the user has already added an item to the cart when the price was 10000 and if he again adding the same cart but now the price is 8000 then that might be the problem.
@RizwanKhanDeveloper4 жыл бұрын
Price will vary till checkout of the items and it’s not a problem it may increase or decrease before checkout ( place order ) but once order placed and confirmed then that will be the payable price regardless of change in price
@codinghubfree4 жыл бұрын
@@RizwanKhanDeveloper on now i got it. Thanks
@gloriamarquez59984 жыл бұрын
Excelente explicación, muchas gracias xD
@RizwanKhanDeveloper4 жыл бұрын
Gloria Márquez Thank you 😊 so much
@technoinfoworldwide23294 жыл бұрын
in flipkart, user doesnt need to login to put the product in cart section.how to implement in both way like users can login and put product in cart as well as without login,visitors can put product in cart without login? please share the logic
@RizwanKhanDeveloper4 жыл бұрын
Already implemented that feature now you are watching Api videos plz continue you will see very soon
@vuhoang41814 жыл бұрын
How to fix bug response will give old data ? Thanks u.
@bungmocuto67013 жыл бұрын
I can't see the video you fetch product, have you delete it? 😥
@sultanahmed22993 жыл бұрын
$set: { cartItems: { ...req.body.cartItems, quantity: item.quantity + req.body.cartItems.quantity, }, }, after sending response quantity stored as concat instead of sum (like if 22 or 11 instead of 4 or 2) why ??? can any one have any solutions
@RizwanKhanDeveloper3 жыл бұрын
Use parseInt(item.quantity) + parseInt(req.body.cartItems.quantity)
@sultanahmed22993 жыл бұрын
@@RizwanKhanDeveloper Thank you very much .
@sowmya.s26713 жыл бұрын
Hii, I am getting user access denied message . Please help How to solve this
@RizwanKhanDeveloper3 жыл бұрын
Ok we have two roles user and admin if you try access admin with user credentials then you will get access denied message
@csouvik213 жыл бұрын
I am feeling it one small error input can make you dance
@daveglad35544 жыл бұрын
Thanks ❤️👌🏽
@RizwanKhanDeveloper4 жыл бұрын
Your welcome buddy
@Pushkar-Apte4 жыл бұрын
Amazing videos just loved your teaching style also I'm facing this error lately Error: slugify: string argument expected Can you help me with this one?
@RizwanKhanDeveloper4 жыл бұрын
Can u show request payload
@Pushkar-Apte4 жыл бұрын
@@RizwanKhanDeveloper var fs = require("fs"); var request = require("request"); var options = { method: 'POST', url: 'localhost:2000/api/product/create', headers: { 'postman-token': '3cfe6301-f438-ea36-91f1-9ff7b4ba8db3', 'cache-control': 'no-cache', 'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW', authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZjZkZTFiYmU1YzAzMTFlYzBiZjE0OWEiLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2MDE1NTQwMDQsImV4cCI6MTYwMTU1NzYwNH0.qpcxi_RmdYlzYPPwwIsDoK8tH1OHt6oXTTnrtxd0jqg' }, formData: { 'name ': 'Samsung Galaxy M21 (Midnight Blue, 128 GB) (6 GB RAM)', quantity: '200', 'price ': '20000', description: ' 48MP (F2.0) Main Camera +8MP (F2.2) Ultra Wide Camera +5MP(F2.2) Depth Camera | 20MP (F2.2) front facing camera 16.21 centimeters (6.4-inch) FHD+ capacitive touchscreen with 2340 x 1080 pixels resolution 16M color support Memory, Storage & SIM: 4GB RAM | 64GB storage expandable up to 512GB| Dual SIM with dual standby (4G+4G) Android 10.0 operating system with 2.3GHz Exynos 9611-Octa Core processor 6000mAH lithium-ion battery', productPicture: { value: 'fs.createReadStream("16998176_10154218236780636_8472606700379293330_n.jpg")', options: { filename: '16998176_10154218236780636_8472606700379293330_n.jpg', contentType: null } }, category: '5f746b3479eb593b3c551574' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
@RizwanKhanDeveloper4 жыл бұрын
Slugify requires string argument here we are sending product name from request and we are converting name to slug using slugify so possibly you are not getting name properly
@Pushkar-Apte4 жыл бұрын
@@RizwanKhanDeveloper Thank you so much Rizwan Sir for your help means a lot also what could be the possible solution I tried different names and tried to convert the name to String as well
@RizwanKhanDeveloper4 жыл бұрын
Pushkar Apte First you console all data which is coming in request If you are getting name then are good to go
@sumitmourya84404 жыл бұрын
it also does not showing any error
@somyaranjankhatua77463 жыл бұрын
23:02
@mubasharafzal79734 жыл бұрын
Dear my qty update block is not working
@RizwanKhanDeveloper4 жыл бұрын
Share the piece of code which is not working in webscript.info
@mubasharafzal79734 жыл бұрын
@@RizwanKhanDeveloper thanks for reply { "cartItems":[ { "product": "5f6ddf82864fe30b68340ac4", "quantity":"1", "price": "7002" } ] } i am sending json this way in post man when i remove array [] working properly thanks
@mubasharafzal79734 жыл бұрын
please explain this
@RizwanKhanDeveloper4 жыл бұрын
Mubashar Afzal if this is a problem with code I will update it
@mubasharafzal79734 жыл бұрын
@@RizwanKhanDeveloper no problem its ok all
@babipinker90914 жыл бұрын
Hello, thank's for this tutorial, but i think you are losing taraçability if you update the same cart item like this
@RizwanKhanDeveloper4 жыл бұрын
Please continue it will be fixed in coming videos
@paulfurniturebapon15664 жыл бұрын
sir when i am adding first product to cart there is no issue but second time these error comes (node:7292) DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `useFindAndModify` option set to false are deprecated. See: mongoosejs.com/docs/deprecations.html#findandmodify (Use `node --trace-deprecation ...` to show where the warning was created)
@paulfurniturebapon15664 жыл бұрын
please help sir
@komalsutar55514 жыл бұрын
"error": { "driver": true, "name": "MongoError", "index": 0, "code": 11000, "keyPattern": { "slug": 1 }, "keyValue": { "slug": null } } } I dont understand how to resolve this error
@RizwanKhanDeveloper4 жыл бұрын
Slug value can’t be null
@apoorvbhushan67294 жыл бұрын
@Rizwan Khan can you reply fast
@pranaysuryavanshi37863 жыл бұрын
Getting an error Can't read property _id
@Lokeshjitta Жыл бұрын
{ "error": { "index": 0, "code": 11000, "keyPattern": { "slug": 1 }, "keyValue": { "slug": null } } } broo how to avoid this error