Sir what a way of teaching, I really appreciate it!
@SharmaCoder11 ай бұрын
Thank you mate
@thuydungtrinh8544 Жыл бұрын
hi sir, i see you click on category name then it return to category page (at 19:04), how can I do that?
@SharmaCoder Жыл бұрын
I have shown tht in one of my previous videos. Basically it is an tag and the href should be the category page url.
@IssOu-hw3eh Жыл бұрын
your code please
@IssOu-hw3eh Жыл бұрын
@@SharmaCoder sis how to resolve 405 error please
@yagoobali89783 жыл бұрын
Hi sir, I faced a problem. When I add to cart, it tell me the post method is not support it for this route why I applied every single thing after you. The problem is the post method is not support for this route please please help me
@SharmaCoder3 жыл бұрын
Show me your code of the route you created.
@SharmaCoder3 жыл бұрын
Change that to Route::post('addtocart',... )
@IssOu-hw3eh Жыл бұрын
@@SharmaCoder how to resolve this error please 405 method not allowed
@noxigen7678 Жыл бұрын
when I click add to cart, I get error 405 (Method Not Allowed), can you help please? @Sharma Coder
@najsw Жыл бұрын
di you get the solution ?
@IssOu-hw3eh Жыл бұрын
@@najsw di you get the solution ?
@Eliptik_2 жыл бұрын
Hey sir, when i press add to cart I have error 404, the route in web.php and in the ajax are the same (in ajax I have the /) add-to-cart
@SharmaCoder2 жыл бұрын
404 error is when the url you have given in the ajax is not found in the web.php Just check with that once..
@Eliptik_2 жыл бұрын
@@SharmaCoder I already fixed, removing the slash in the ajax code. But now I have "405" error becuase the method POST is not supported.
@youssradebbali31352 жыл бұрын
@@Eliptik_ solution please?
@najsw Жыл бұрын
@@Eliptik_ do you get solution for this ?
@rotimiidowu68482 жыл бұрын
please what could be the cause of this error on this part 22 am getting the below error please help me The GET method is not supported for this route. Supported methods: POST.
@mohamedlaaroussi15432 жыл бұрын
good job but just one think if you put the route(/add_to_card)in side the middleware the allert (login to continue is dosent work because the access to this route we need to login.
@cloudeweb2 жыл бұрын
Good tutorial! Just a doubt... usually is not need to login for add to cart. Is which way should be made it, considering that user relation is not exists? I Could create an cookie with a random token and save in a column for example 'user_id_temp' for not logged user and after logged assign user_id? thanks!
@SharmaCoder2 жыл бұрын
We can do it that way. But if the user visits the website after a month, (assuming he cleared browser cookies and cache) he wont find the product in his cart. Also if the user doesn't visit the website using the same device, he will again not be able to view his cart items. So by storing the cart items in database, the user is more likely to purchase the product. Even if he comes back after months, his cart items will still be there. You can still build it that way, but i prefer storing it in the database with the user_id.
@rashedbahnasi20162 жыл бұрын
@@SharmaCoder hello mr sharma i got thid error in consol: Error handling response: TypeError: Cannot read properties of undefined (reading 'direction') at l (chrome-extension://aggiiclaiamajehmlfpkjmlbadmkledi/contentscript.js:26:89552) at chrome-extension://aggiiclaiamajehmlfpkjmlbadmkledi/contentscript.js:35:36
@usmanarif91912 жыл бұрын
Hello, I am confused that why you are not using sessions for cart functionality? Is it good for performance point of view to make entry in cart table?
@SharmaCoder2 жыл бұрын
You won't get your cart data if you login from other devices. Once session expires, even the same device will not display the cart items. So you lose sales if you don't store it in db. If you have storage issues, clear the cart after 30 days of inactivity.
@usmanarif91912 жыл бұрын
Thanks for reply But still have confusion. if there are multiple users which are adding products in cart, on every entry in cart table wouldn't become reason load on server? For multiple devices your work is great but I just want to know that is it standard way or is there any other way too for this cart module?
@balddog4702 жыл бұрын
@@usmanarif9191 i think it depends on your preference. In my country, the biggest ecommerce website uses Sharma Coder's approach.
@voskilltheentertainer25642 жыл бұрын
hi sharma i am having a bug whereby the product_id remain the same in all products i have followed every bit of the tutorial.kindly help
@kakaisaac Жыл бұрын
Hi Good job what if i want to add to cart before logging in and then after log in that cart still exists
@IssOu-hw3eh Жыл бұрын
show me your code please
@thetiagothebest2 жыл бұрын
Hey sir, when i press add to cart I have error 405 (Method Not Allowed)
@SharmaCoder2 жыл бұрын
What method have you created the route? Get or Post?
@thetiagothebest2 жыл бұрын
@@SharmaCoder This is my route Sir, Route::post('addtocart',[CartController::class, 'addProduct']);
@SharmaCoder2 жыл бұрын
Show me your Ajax code.
@thetiagothebest2 жыл бұрын
@@SharmaCoder I have already solved it by putting the url in the ajax request as follows: "{{url('/addtocart')}}". Thanks for your attention.
@littleerror65012 жыл бұрын
@@thetiagothebest bro can you share the code here
@ahmedabdallah87812 жыл бұрын
mr sharma if i may i am following your steps and it gives me The GET method is not supported and i copied the code for the $ajax
@SharmaCoder2 жыл бұрын
In the ajax, make it as method: "post"
@ahmedabdallah87812 жыл бұрын
@@SharmaCoder same as in the web.php when it comes to route thx sir
@IssOu-hw3eh Жыл бұрын
@@ahmedabdallah8781 how to resolve this error please 405 method not allowed
@ismaelseck3 жыл бұрын
hi sir i need your help jquery doesn't works and when i click on add to cart button i ain't got reaction
@SharmaCoder3 жыл бұрын
Place the jQuery script on top and try. Also check the console for errors.
@khadija523 жыл бұрын
Is it working now?
@ismaelseck2 жыл бұрын
@@khadija52 yeah that’s okay now
@ismaelseck2 жыл бұрын
@@SharmaCoder thanks you very much 🙏🏾
@youssradebbali31352 жыл бұрын
@@ismaelseck code source please ?
@kyawswarthein40323 жыл бұрын
sir i have am working the same style flow to add qty in the cart but it won't work
@SharmaCoder3 жыл бұрын
Check if you have added the jquery in the top of all the other scripts.
@kyawswarthein40323 жыл бұрын
@@SharmaCoder I have already put it on the top but it won't work sir
@anselmus.r2 жыл бұрын
how i fix this? SQLSTATE[42S22]: Column not found: 1054 Unknown column 'prod_id' in 'where clause' (SQL: select exists(select * from `carts` where `prod_id` = 4 and `user_id` = 1) as `exists`)"
@donaldmjbart-williams31443 жыл бұрын
The alert message is not working. $.ajax({ method: "POST", url: "/add-to-cart", data: { 'product_id': product_id, 'product_qty': product_qty, }, success: function (response) { alert(response.status); } }); });
@trixolian2 жыл бұрын
swal
@IssOu-hw3eh Жыл бұрын
@@trixolian show me your code please
@chandeletdoris62342 жыл бұрын
Thanks sir for your tutorials,
@IssOu-hw3eh Жыл бұрын
your code please
@aartimaurya7855 Жыл бұрын
Sir my url is not right in ajex
@IssOu-hw3eh Жыл бұрын
how to resolve this error please 405 method not allowed
@ReemRamzi2 жыл бұрын
You're the best instructor, thank you.
@IssOu-hw3eh Жыл бұрын
your code please
@renzj53223 жыл бұрын
Sir, how about using keyup?
@ngocthienpham21972 жыл бұрын
why when i press the add to cart button it just goes in "Login to Continue"
@SharmaCoder2 жыл бұрын
Have you logged in before adding to cart?
@ngocthienpham21972 жыл бұрын
@@SharmaCoder no I haven't done that function yet
@ngocthienpham21972 жыл бұрын
@@SharmaCoder I don't need to login, what should I do?
@SharmaCoder2 жыл бұрын
Then directly add it to your cart.
@ngocthienpham21972 жыл бұрын
@@SharmaCoder Where do I need to fix to be able to do so
@mohamedali87083 жыл бұрын
I have 401 (Unauthorized) error , can you help me please
@SharmaCoder3 жыл бұрын
You might have created to add-to-cart Route in the "Auth" middleware.. Just put it outside the "auth" middleware and that should work.
@mohamedali87083 жыл бұрын
@@SharmaCoder thanks a lot its working fine now
@SharmaCoder3 жыл бұрын
You're welcome.
@m_artistry76962 жыл бұрын
@@SharmaCoder I have same error I did it but it's not working kindly help me please
@youssradebbali31352 жыл бұрын
@@mohamedali8708 solution please???
@Adilkhan-lh4tq2 жыл бұрын
best sir .thank you
@IssOu-hw3eh Жыл бұрын
your code please
@BucurIonNiculae2 жыл бұрын
This series of tutorials is amazing. You learn so much from it.
@IssOu-hw3eh Жыл бұрын
your code please
@ismaelseck2 жыл бұрын
Hello Sharma I’ve followed your tuto until the end and I realise that increment and decrement buttons don’t work on mobile devices. They only work on PC
@SharmaCoder2 жыл бұрын
Clear your browser cache or try to open it in incognito mode. It works.
@ismaelseck2 жыл бұрын
@@SharmaCoder I’m not in local mode, I’ve hosted the project
@SharmaCoder2 жыл бұрын
I meant the mobile's browser.
@nandopookey9195 Жыл бұрын
Thank you so much sir
@IssOu-hw3eh Жыл бұрын
your code please
@kyawswarthein40323 жыл бұрын
sir it show me internal server error (500)
@ahmedabdallah87812 жыл бұрын
did you fix this problem i am having the same problem !!
@shantanusharma27142 жыл бұрын
have you solved the problem?
@robertsonanghag6133 Жыл бұрын
i have the same problem sir did you fix this problem sir?
@IssOu-hw3eh Жыл бұрын
@@robertsonanghag6133 how to fix this problem
@IssOu-hw3eh Жыл бұрын
@@robertsonanghag6133 make this in CartController if(Cart::where('prod_id',$product_id)->where('user_id',Auth::user()->id)->exists()){
@tuanphamvan6552 жыл бұрын
very good video this is what i was looking for thank you!
@SharmaCoder2 жыл бұрын
Glad it helped..
@IssOu-hw3eh Жыл бұрын
your code please
@donaldmjbart-williams31443 жыл бұрын
This is the route Route::middleware(['auth'])->group(function(){ Route::post('add-to-cart',[CartController::class, 'addProduct']); });
@SharmaCoder3 жыл бұрын
Keep the add to cart Route outside the auth middleware..
@shiromaroo23982 жыл бұрын
Why user_id, prod_id ... is string
@Code7s3 жыл бұрын
may force with you
@IssOu-hw3eh Жыл бұрын
code source please
@nguyen_hieu_8463 Жыл бұрын
401 (Unauthorized) error , can you help me please!!! @Sharma Coder
@SharmaCoder Жыл бұрын
Put the add-to-cart route outside the auth middleware in the web.php.
@nguyen_hieu_8463 Жыл бұрын
@@SharmaCoder thank you
@najsw Жыл бұрын
@@SharmaCoder i dont understand sir, how to put outside of the auth?
@IssOu-hw3eh Жыл бұрын
@@nguyen_hieu_8463 show me your code please
@toddmcmannus4031 Жыл бұрын
I am struggling with this part. POST localhost:8000/add-to-cart 500 (Internal Server Error) This is my error. Route::post('/add-to-cart',[CartController::class,'addProduct']);
@najsw Жыл бұрын
do you get the solution ?
@IssOu-hw3eh Жыл бұрын
@@najsw make this in CartController if(Cart::where('prod_id',$product_id)->where('user_id',Auth::user()->id)->exists()){
@IssOu-hw3eh Жыл бұрын
make this in CartController if(Cart::where('prod_id',$product_id)->where('user_id',Auth::user()->id)->exists()){
@aartimaurya7855 Жыл бұрын
Localhost/add_to_cart but my right url localhost/example-app/add_to_cart
@rashedbahnasi20162 жыл бұрын
i have this problem message: "Method Illuminate\Auth\SessionGuard::cheak does not exist.",…} exception: "BadMethodCallException" file: "/var/www/html/vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php" line: 113
@rashedbahnasi20162 жыл бұрын
@Sharma Coder
@SharmaCoder2 жыл бұрын
You misspelled check as cheak.
@rashedbahnasi20162 жыл бұрын
@@SharmaCoder tysm❤
@rashedbahnasi20162 жыл бұрын
@@SharmaCoder why response->json not work with me?
@rashedbahnasi20162 жыл бұрын
@@SharmaCoder can i change it to session?
@rashedbahnasi20162 жыл бұрын
sry mr.sharma but i have another problem exception: "Illuminate\\Database\\QueryException" file: "/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php" line: 760