This is astonishing, absolutely astonishing. Instructor speaks very well, good pace and very understandable. Code is well written and everything is explained well. You really do learn alot from this course.
@academind8 жыл бұрын
Again, many thanks for this great feedback, it really means a lot to me! :)
@dhanashreedeshpande71005 жыл бұрын
You have mentioned wrong spelling of toggle , but still its working in your video, Whereas at my end, for the same code, it does not show drop down. Action Reduce by 1 Reduce All
@edwinchp4 жыл бұрын
I am using Laravel 7 and this still works! It's awesome. You are awesome. Thanks dude :)
@mrzink91802 жыл бұрын
I see that when you press add to cart the page doesnt refresh, however when I do it, the page refreshes. Any clue how I can fix that and make it not refresh after I add something to the cart?
@MeAsh7684 жыл бұрын
It is great toutorial the explanation is very easy anf frequently understandable before this i was tens how to make cart and many thinks rolling in my mind but after watching your toutorial its clear now really it is best tutorial and you are best teacher thank-you much love from india 😃
@bipensawden60747 жыл бұрын
Can you please include the tutorial for delete and update of particular product also? Thanks in advance :)
@geraldyvancabarrubias61963 жыл бұрын
sir do you have a video for update cart?
@SazaYT4 жыл бұрын
So when i added my first item, lets name it "chicken"..and then i try to add 'beef' in the basket as well, what will happen is the qty of chicken will go to 2 instead off adding the beef. Something must be wrong in my Basket.php class. Any ideas?
@yoonastk30427 жыл бұрын
if i quite the localhost..nd return back the cart 1 is there..how can i clear it?
@dhanashreedeshpande71005 жыл бұрын
Drop down is not working. What may be the reason? I have coded everything exactly similar to your video. Using Laravel 5.7...Plz help...
@rikimarusaintpreux84488 жыл бұрын
HI Sir is there any chance to reset the number of shopping carts ? cause when i started to use different user the value doesnt change thanks a lot
@andreeamaria81084 жыл бұрын
Hello! How can I display the image of the product in my cart? I tried to introduce the image path in shopping-cart.blade.php but it doesn't work ..
@mauri29robayo8 жыл бұрын
If I have 100 items. I add the 99 item to the cart => the page of the shopping cart will be reloaded and it shows me again the firsts products and not the 99 product. How can I do so that after adding an item the page reloads and goes exactly where the 99 item was? Thanks a lot
@kainushia10736 жыл бұрын
when i press ADD TO CART i get this NotFoundHttpException in RouteCollection.php line 161: please help
@haytham67766 жыл бұрын
in the getCart function i got Undefined variable: oldCart as error even tho it works in in getAddcart() i don't know why ?and by the way why did you type 'as'=>'product.shoppingCart' and not shop.shoppingCart
@arslanjaved56257 жыл бұрын
after adding span into this file, no item is incrementing. Suggestion pleaase. Table cart {{ Session::has('cart') ? Session::get('cart')->totalQty : ''}}
@tutorialsviewers13817 жыл бұрын
items no not increasing in badge . I had checked for many time but could no fix . why ??? please suggest........
@rohailbutt42234 жыл бұрын
Hello Sir , How can i delete an item from a session ????
@LouisPierreBeatsChan5 жыл бұрын
Functionality of it is fine but why does my page constantly refresh upon adding an item to the shopping cart? Doesn't necessarily change anything but the problem is that... that seems wrong and it doesn't do that for you :/
@oldnewsongs9447 жыл бұрын
I would like to sent data to the session.How to do with ajax?
@guruzone22887 жыл бұрын
HI, How to make coupons for this ? What are the tables/columns needed?
@danieldixon43475 жыл бұрын
Could any show the if statement instead of the span
@dp4dileep8 жыл бұрын
how can i remove item from cart ?
@majidshah22533 жыл бұрын
how remove ?
@05571865588 жыл бұрын
When I click the items the quantity is not increment I followed you code line by line
@CindyK95 жыл бұрын
Me too : ( . . . Have you by chance already fixed this problem? Because now I'm also stuck at this course.
@HansenHermanto7 жыл бұрын
hey i got an error Undefined variable: products (View: F:\xampp\htdocs\TugasUAS esources\views\shop\shopping-cart.blade.php) how to solve this, please reply
@shem23828 жыл бұрын
hey, how did you learn all of this is this taught on the job because i was told development is learning while on the job. were u shown these things by others or working with a group of developers?? i never could get great resources on building eCommerce platforms etc. if u have any suggestion im all ears.
@academind8 жыл бұрын
Actually I learned all that on my own, though of course I used it in many projects and improved my skills, learned new things etc whilst working on such projects.
@shem23828 жыл бұрын
Mindspace I want to get into the web development industry as a back end developer. Any advice. And how can one manage merchandise in terms of the qty of a particular shirt and keeping inventory on a whole up to date. so when the user purchases an item it shows how much of the product is left for other customers to see. do u think this is a feature that is necessary. my apologize for asking a million questions
@muhammadherry1854 жыл бұрын
sorry I have watched and followh this tutorial then I got an error in my shopping-cart.blade.php like this "Invalid argument supplied for foreach()",so how I can fix this error.PLEASE HELP ME SIR thx
@yashonathreddy18108 жыл бұрын
i Love the way you have paced the tuts ...thank you soo much
@academind8 жыл бұрын
Awesome to hear this, thanks a lot for this great feedback! :)
@SashenMe7 жыл бұрын
How does "Reduce All" button work?
@vinceduderino98078 жыл бұрын
Hi, I'm new to your channel and I would like to thank you for those tutorials. But I've got a question/observation : Shouldn't we inject the Cart as a dependency ? The constructor of the Cart would verify if the session exists, to hydrate the object, and then the controller would only have to care about adding/removing a product, and call the method to save the Cart into the session ? " $this->cart->add([........])->save() "
@academind8 жыл бұрын
Hi Vince, I'm happy to hear that you're liking it! You are right, injecting the Cart would be a great solution. But it's also a bit more advanced (since you need to register it with a ServiceProvider) and even though it's certainly not difficult to do, I tried to not make this tutorial too complicated.
@discoboy15008 жыл бұрын
Awesome video as usual, I was wondering tho At 4:32second why do we create a new cart and add the old cart in it, I mean it doesn't look like it does anything
@academind8 жыл бұрын
Thanks for your great feedback. I get your point. I'm doing this to ensure that we will always have a valid cart and I don't have to manage its state (as I simply re-create it every time)
@mohamedamjad75948 жыл бұрын
awesome , keeping rocking with laravel :D (Y) , notice a issue with Session, After a customer adding an item to his cart, by admin item deleted from database, even the item deleted, item will be available in session so deleted item will be available in cart, so customers may try to purchase deleted items too,, how can solve this
@joemelkinposadas22187 жыл бұрын
i have a problem how to resolve this issue in shopping-cart blade " Invalid argument supplied for foreach() "
@howto057 жыл бұрын
did you fix this
@puji75634 жыл бұрын
???
@ahmedhussin57047 жыл бұрын
why you didn't create cart table and make a relationship with users to fetch users product from his cart
@azeezadio19328 жыл бұрын
this is the error am getting after clicking shopping cart "Invalid argument supplied for foreach() " /Sites/Shop/storage/framework/views/6b3cbb896316c71cc7625e2b1a78d16da3bc4f09.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'products' => null, 'totalPrice' => '0')) in and also invalid argument supplied, i have spent a whole day trying to debug
@academind8 жыл бұрын
Did you compare the problematic code with mine (link in video description)? Maybe a tiny typo or something like that.
@azeezadio19328 жыл бұрын
thanks soooo much....the problem was in my Cart class, my constructor was suppose to have double underscore, i kept only one ....i works well now...moreover, your videos have been really helpful
@azeezadio19328 жыл бұрын
my cart numbers still shows after have logged out, until i clear in session in views...how do i solve this issue
@enricoperez91478 жыл бұрын
try this: change the getLogout function inside the UserController.php like so, public function getLogout(Request $request) { Auth::logout(); $request->session()->forget('cart'); return redirect('/'); } what this does is that it removes the session cart.
@azeezadio19328 жыл бұрын
thanks soo much ...it worked
@kallaldeveloper90728 жыл бұрын
Invalid argument supplied for foreach() (View: /home/ubuntu/workspace/resources/views/shop/shopping-cart.blade.php) Every time this error shows when I clicked on shooping cart
@ahmedmagdy62987 жыл бұрын
you may but $this->$items and this is wrong you need to make it $this->items
@raginipatlolla32536 жыл бұрын
bro did u get this
@agungmaliki3605 жыл бұрын
How to reduce item in the shopping card?
@ashrafsaleh86547 жыл бұрын
You are great Developer and your explain is great
@academind7 жыл бұрын
Thanks so much!
@AdrianMorenoGarcia8 жыл бұрын
Can I use this tutorial for a real shopping project in production, there is not legal problem or something like that from the author?
@academind8 жыл бұрын
You can do this BUT keep in mind: This is an tutorial. It's NOT optimized for security or performance. It might miss some crucial features you need in a real shop. So you will have to dive deeper into it, build up upon it on your own. I also do of course not take any legal or other responsibility.
@AdrianMorenoGarcia8 жыл бұрын
Thank you, for your reply, i´ll take note from your advices!
@raginipatlolla32536 жыл бұрын
Every tutorial listener stucked here.
@MAHOSSAN15 жыл бұрын
Can you please upload the complete code because some of the user like me facing some problems with code
@pasanglama4175 жыл бұрын
for the undefined variable products error in public function getCart(){ if(!Session::has('cart')){ return view('shop.shopping-cart'); } $oldCart = Session::get('cart'); $cart = new Cart($oldCart); return view('shop.shopping-cart', ['products' => $cart->items, 'totalPrice' => $cart->totalPrice]); } You may have missed the ! before Session in the if condition
@TheBasiru8 жыл бұрын
Hey am having a problem because when I do it, it tells me that I invalid argument for foreach
@academind8 жыл бұрын
Sounds like your variable doesn't get passed correctly from Controller to view. Make sure data is fetched and passed (posdible typos in variable names?) correctly.
@TheBasiru8 жыл бұрын
sorry for bothering you but that's is fixed but now i get this: Invalid argument supplied for foreach()
@TheBasiru8 жыл бұрын
hey is there by any chance you can make a video for email verification and activation after a different video. Also i was still not able to fix the previous video
@academind8 жыл бұрын
Regarding the invalid argument: That's the same error you initially posted, right? See my answer regarding this, you may also have a syntax error in your @foreach loop (=> Syntax i @foreach($elements as $element)) Regarding your suggestion: I'll see what I can do, but for the near future, I have no such plans. Definitely might be something I'll have a look at in a few months
@TheBasiru8 жыл бұрын
+Mindspace thank you very much, you are best, you were right, it was a syntax error.
@euphoria31486 жыл бұрын
why dropdown isn't working in my case. I tried everything.Plz Help.....
@dhanashreedeshpande71005 жыл бұрын
Same problem I have got. I am using Laravel 5.7
@majidshah22533 жыл бұрын
sir totalprice not working sir what i do now?
@MAHOSSAN15 жыл бұрын
When I click the items the quantity is only increment once why ?
@leonardvictorio56165 жыл бұрын
public function getAddToCart(Request $request, $id) { $product = Product::find($id); $cart = Session::has('cart') ? Session::get('cart') : null; if(!$cart) { $cart = new Cart($cart); } $cart->add($product, $product->id); Session::put('cart', $cart); // dd($request->session()->get('cart')); return redirect()->route('get-index'); } Try this modified code; this works on me.
@MAHOSSAN15 жыл бұрын
@@leonardvictorio5616 what was laravel version did you use ?
@MAHOSSAN15 жыл бұрын
@@leonardvictorio5616 Thank you but the code you have , this is only increase the value once but when the ad to cart button clicked twice . Its showing errors Call to undefined method App\Cart::items()
@leonardvictorio56165 жыл бұрын
@@MAHOSSAN1 I'm using Laravel 6. Regardless of the version, the codes should work the same.
@leonardvictorio56165 жыл бұрын
@@MAHOSSAN1 Mine works perfectly fine, i can add multiple times if i want to and even when i click on the button twice. Check your functions on your controller, you must have missed something.
@irfiali1996 жыл бұрын
how to edit cart, have you video on that?
@irfiali1996 жыл бұрын
sorry, its last tutorial video, i skip that,
@yashonathreddy18108 жыл бұрын
Iam getting an error saying Undefined Variable $products line 9 or 8 (whatever ) in shopping-cart.php
@academind8 жыл бұрын
Maybe you're not passing it from your controller? Or a typo in the name (either in the view or in the controller)
@jatinparekh20945 жыл бұрын
hello sir, can you help me for solved "Invalid argument supplied for foreach()"
@CindyK95 жыл бұрын
Put the foreach code inside another if statement that checks whether the $products is of type array? So @if(is_array($products) ...foreach code here... @endif. Hope it helps
@haritong36873 жыл бұрын
@@CindyK9 I have the same error could you please help?
@CindyK93 жыл бұрын
@@haritong3687 check if the variable in your foreach code is actually of type array or not. I found out that mine was not an array but an object. Check if $product isof type array like Jatin Parekh described above
@haritong36873 жыл бұрын
@@CindyK9 Thank you finally solved it.
@FaisalArif778 жыл бұрын
Awesome tutorials as always. Following your angular2 CLi tutorials also, I have a query to ask you. how to reduce /remove specific item from shopping cart? i tried Session::forget('cart',['items'=>$id]) but it deleted my whole cart. can u please describe this functionality.? I am fan of your level of describing each and every thing. :) (y) good work . Keep it up.
@academind8 жыл бұрын
I will shows this in one of the later videos :)
@FaisalArif778 жыл бұрын
i have done this on my own by constantly searching working from 3 hours. :( u should check this our bro, in Cart.php file. public static function remove($item,$id){ if(Session::has('cart')){ $cart=Session::get('cart'); $products=$cart->items; if(array_key_exists($id,$products)){ if($products[$id]['qty']>1){ $cart->totalQty--; $cart->totalPrice=$cart->totalPrice-$item->price; $products[$id]['qty']--; $products[$id]['price']-=$item->price; }else { unset($products[$id]); $cart->totalQty--; $cart->totalPrice = $cart->totalPrice - $item->price; } } $newCart=new Cart($cart); $newCart->totalQty=$cart->totalQty; $newCart->totalPrice=$cart->totalPrice; $newCart->items=$products; return $newCart; } } // and using this as per add function but calling it as static. in productController $cart=Cart::remove($product,$product->id); Session::put('cart', $cart);
@FaisalArif778 жыл бұрын
thanks for your efficient help dear :) Keeeeep it up. You just explore things in very beautifull way.
@academind8 жыл бұрын
Thanks so much! :)
@mohdsuhailin84035 жыл бұрын
I am getting this error Undefined property: App\Cart::$items how to solve it?? plz reply
@danieldixon43475 жыл бұрын
make it is define in the controller
@gabrielstarling5268 жыл бұрын
Hey, im writting a bot for discord using node js, im currently writing it with notepad++ but so far i was only able to make him do simple things like respond to a command with a string, for example "!hi" would give you "hello there". I'd like to incorporate functions to it, for example, if i said "!list", i want it to give me a list from 1 to 10, which is easy in java using "for", but if i write the "for" in notepad++ and then run the bot with it it says "unexpected token 'for' " in my command prompt and the bot doesn't work... Could you tell me how i can incorporate java functions like that to a bot? Ps: thanks for the vids, they are awesome :)
@gonzalopolo95208 жыл бұрын
ty again, I'm building my father's shop page, and this is just exactly what I need. I'd like to know if you will implement some kind of search bar, to wait for your explanation in the next videos, or look for it somewhere else Thank you again!
@academind8 жыл бұрын
Hi Gonzalo, I'll focus on the checkout process next and thereafter I'll see what to add. I'm very happy that you're enjoying the videos! :)
@amjadiqbal53536 жыл бұрын
your source code on github is totally blank , can you tell me the reason
@academind6 жыл бұрын
Maybe you picked the wrong branch? Make sure to choose the correct one
@amjadiqbal53536 жыл бұрын
one more thing , i was adding product on my product using ajax request without reloading the page , but ajax post request not work all the times , it send back an 500 internal server Error , thats why i try to copy your code , but your code is only adding one item on the cart , because session()->put() over riding my next product item , so that's why i am only getting 1 product in my cart every time
@FlaFans7 жыл бұрын
Hi Max, where is the project code? I downloaded gitHub but it is not complete!
@academind7 жыл бұрын
It is - make sure to pick the right branch
@FlaFans7 жыл бұрын
hmmmm ... nice! I found! Could you make a playlist of a laravel classified website? Thank you from Brazil
@mikechannie7 жыл бұрын
This is a great tutorial. Im going to buy your tutorials on udemy soon. I have a problem as a lot of people here below. I am using laravel 5.3, but the amount of the shoppingcart is not increasing. Can you help ?
@academind7 жыл бұрын
I'll be happy to welcome you on Udemy, too. There could be many reasons for this issue but that's why I do provide my code (link in video description, choose the right branch) for download. By comparing it to yours, you should be able to find out what goes wrong and what causes this behavior.
@yevgenletin55318 жыл бұрын
I have problem When I click shopping card happening server internal error:500
@mdhemelrana82828 жыл бұрын
sir, please complete this series as soon as possible. i'm waitting your next videos. pls pls pls.....
@academind8 жыл бұрын
I'll keep the videos coming, but it takes some time, sorry ;)
@TheAekalam7 жыл бұрын
the quantity does not increment,,plz what is the wrong?
@nontonulang48526 жыл бұрын
help me. how to remove item in cart ?
@abdelilahamanzou46986 жыл бұрын
did you solve this issue
@pranavpawar77928 жыл бұрын
I'am getting the error as: Undefined index: title (View: C:\xampp\htdocs\Projects\laravel\project esources\views\shop\shopping-cart.blade.php).... Please Help!!!!
@Hal-co8wc7 жыл бұрын
Did you add this"@extends('layouts.master')" above the page?
@sheerasai59486 жыл бұрын
check your product model and see what you have named for the product title
@guruzone22887 жыл бұрын
Cant people hack with JavaScript and change price of product and get into payment page?
@academind7 жыл бұрын
The frontend (JS) can only be tricked, that's why you should always validate/ check inputs on the backend, too.
@umerrasheed35 жыл бұрын
video is edited suddenly start working as a Ajax request even he is call route directly
@alessagelespi17818 жыл бұрын
Very high quality lessons. I would like to see more new videos in your performance
@academind8 жыл бұрын
There are plenty of videos to come, I'm happy that you're liking my content :)
@keithcarrillo82386 жыл бұрын
If your cart quanity is not incrementing make sure you have all three things checked #1 the view is passing the id #2 do the same for the route they're both in his last video. #3 Make sure the product controller looks something like this in 5.5 or higher. namespace App\Http\Controllers; use App\Product; use Illuminate\Http\Request; use App\Http\Requests; use App\Cart; class ProductController extends Controller { public function getIndex() { $products = Product::all(); return view('shop.index')->with('products', $products); } public function getAddToCart(Request $request, $id){ $product = Product::find($id); $oldCart = $request->session()->has('cart') ? $request->session()->get('cart') : null; // ^^^ The session code was throwing my code off. I know now I can use $request->session()->has('cart') $cart = new Cart($oldCart); $cart->add($product, $product->id); $request->session()->put('cart', $cart); return redirect()->route('product.index'); } }
@arturofloresmontalvo96187 жыл бұрын
I have this error does anyone have the solution? Invalid argument supplied for foreach() (View: /var/www/html/TPShop/resources/views/shop/shopping-cart.blade.php)
@puji75634 жыл бұрын
Hello did you fix it?
@PerryPalmtree6 жыл бұрын
Where is 'cart' defined and what is the actual value of that whole thing? {{Session::has('cart') ? Session::get('cart')->totalQty : ""}}
@Z005995 жыл бұрын
The cart defined in the productController, you have to use the Cart object as well
@ishraqemanjur53148 жыл бұрын
hey max ,can you provide the full source code of that project ??
@academind8 жыл бұрын
You can find a link to the full source code in the video description.
@ishraqemanjur53148 жыл бұрын
in github link , its not full
@academind8 жыл бұрын
Sure it is, make sure to pick the right branch.
@ishraqemanjur53148 жыл бұрын
tnx mate
@dumiduchannel56848 жыл бұрын
I really like this tutorial, very helpful to me. thank you :) But I have problems when I implement it into laravel 5.3 But when I click add to cart button, totalQty not want to change, what's the solution? And I think I've been with that I did my model: public function add($item, $id) { $storedItem = ['qty' => 0, 'price' => $item->price, 'item' => $item]; if ($this->items) { if (array_key_exists($id, $this->items)){ $storedItem = $this->items[$id]; } } $storedItem['qty']++; $storedItem['price'] = $item->price * $storedItem['qty']; $this->items[$id] = $storedItem; $this->totalQty++; $this->totalPrice += $item->price; } my controller: public function getAddToCart (Request $ request, $ id) { $ Product = Product :: find ($ id); $ OldCart = Session :: has ( 'cart')? Session :: get ('cart'): null; $ Cart = new Cart ($ oldCart); $ Cart-> add ($ product, $ product-> id); $ Request-> session () -> put ('cart', $ cart); return redirect () -> route ('toko.index'); } and my header: {{Session :: has ( 'cart')? Session :: get ('cart') -> totalQty: ''}}
@sidheart5147 жыл бұрын
i think you forget to push your data to github i didn't find any file u have created its blank laravel 5.2
@sidheart5147 жыл бұрын
i already did
@shahrukh6317 жыл бұрын
For all of those who are having trouble in items 'qty' increment, it is because of dd() function. I dont know why its working on laravel 5.2 but its certainly is not working on 5.4. For more details checkout this answer at stack stackoverflow.com/questions/23917409/laravel-session-data-not-sticking-across-page-loads Instead of dd(), do 1. temporarily comment out return statement 2. instead of dd() use var_dump or print_r 3. after you are satisfied that session is working, uncomment the return statement.
@amjadc8 жыл бұрын
I spent 5 hours on only single error. Looked at the whole code and re wrote everything. In the end I found that I was only missing ')' this bracket =D
@academind8 жыл бұрын
Always annoying things like these ;-) Happy to hear you were able to resolve it! :)
@vinodivv29177 жыл бұрын
Invalid argument supplied for foreach() ...anyone help me............laravel 5.3
@howto057 жыл бұрын
did you fix this?
@sultanworks32414 жыл бұрын
@@howto05 i have same problem
@ethanwang49176 жыл бұрын
Haha, I can get that feeling, each time the modified app directly and properly run, it likes I win the lottery
@noumanmayo26017 жыл бұрын
Invalid argument supplied for foreach() (View: C:\xampp\htdocs\shopping-car esources\views\shop\shopping-cart.blade.php)
@howto057 жыл бұрын
did you fix this
@AhmedElhadyEG8 жыл бұрын
Source Code not complete !
@academind8 жыл бұрын
Yes it is, pick the right branch
@janardhanreddy69006 жыл бұрын
please respond for comments Session value is not responding
@academind6 жыл бұрын
You can always download my source code (link in video description, make sure to pick the right branch there). This should allow you to narrow down where your code differs and what's causing the issue
@shakinahazmansa7 жыл бұрын
hey guys. if you guys have the same problem as me on increment quantity on the shopping cart, you could try to change the $oldCart and Session. somehow i dont know why or whats the reason of changing the codes make it work. try to view my codes and try to apply it okay. BTW im using Laravel 5.4. change in your ProductController.php the // is the codes from the tutorial i comment it so that you can know which one that i change. Good luck! public function getAddToCart(Request $request, $id){ $product = Product::find($id); $cart = Session::has('cart') ? Session::get('cart') : null; //$cart = new Cart($oldCart); if(!$cart) { $cart = new Cart($cart); } //$product = $product->id; $cart->add($product, $product->id); Session::put('cart', $cart); //$request->session()->put('cart', $cart); //var_dump($request->session()->get('cart')); return redirect()->route('products.index'); }
@rezagunawan2317 жыл бұрын
thanks it works
@joemelkinposadas22187 жыл бұрын
how to change need help pls reply;
@sitta2411386 жыл бұрын
thank it works (Laravel Framework 5.5.33)
@thereportserverid51968 жыл бұрын
Thank you so much for make awesome tutorial.
@academind8 жыл бұрын
Great to hear you liked it!
@7footballvideos2206 жыл бұрын
you're amazing heeeeeeey, thanks maaaaaaaaaan
@jonarendra5 жыл бұрын
nice tutorial.. thanks...
@academind5 жыл бұрын
Thank you Putu!
@janardhanreddy69006 жыл бұрын
Great tutorial....
@academind6 жыл бұрын
Thank you Janardhan :)
@GravityGamingCo8 жыл бұрын
the model the cart model confused me a little bit on how you are storing everything. I know how sessions work and such but this is just confusing me. Get tutorial series as always though!
@academind8 жыл бұрын
I hope the confusion will go away once you see in action a bit more. Basically the model simply is an abstraction of the shopping cart and should be able to handle new items as well existing shopping carts being passed into it.
@mehtabhabib8 жыл бұрын
#awesome... many thanks for the tutorials... you are doing an amazing job mate... :-)
@academind8 жыл бұрын
Many, many thanks for those very kind words Mehtab, I'm happy that this is helpful to you! :)
@joemelkinposadas22187 жыл бұрын
I cant solve it :( and i'm so exhausted
@sultanworks32414 жыл бұрын
ErrorException Invalid argument supplied for foreach() (View: F:\server\htdocs\yii\yumypizza esources\views\shop\shopping-cart.blade.php)
@sultanworks32414 жыл бұрын
Help?
@sultanworks32414 жыл бұрын
on line 15 @foreach($products as $product)
@moroccanfirst2363 жыл бұрын
@if(!empty($products) @foreach($products as $product) //code here @endforech @endif
@yashonathreddy18108 жыл бұрын
@foreach( $products as $product) {{ $product['qty'] }} {{ $product['item']['title'] }} {{ $product['price'] }} this is what iam doing in view
@pranavpawar77928 жыл бұрын
Hi, yashonath reddy.... I'am getting the error in shopping-cart.blade.php as follows: Undefined index: title (View: C:\xampp\htdocs\Projects\laravel\project esources\views\shop\shopping-cart.blade.php)..... Please See if you can solve it!!!!
@yashonathreddy18108 жыл бұрын
check your database table and verify the column name "title"
@pranavpawar77928 жыл бұрын
Thanks for your response.... I have done as you said... but, the error still persists,I have also cross-checked with the code from the video.... but, still its not rectified... The error appears when I write the following code in shop.blade.php -> {{ $product['item']['title'] }}... see the 4th line of your code above... Please see again and thanks in advance
@yashonathreddy18108 жыл бұрын
pranav pawar....I got to see what your doing in controller
@pranavpawar77928 жыл бұрын
ya surely.... I'am pasting the code here and see where I've mistaken. The code under ProductController.php is as follows:
@yashonathreddy18108 жыл бұрын
public function getCart(){ if (Session::has('cart')){ return view('shop.shoppingcart'); } $oldCart = Session::get('cart'); $cart = new Cart($oldCart); return view('shop.shoppingcart', ['products' => $cart->items, 'totalPrice' => $cart->totalPrice]); } this is the method in controller
@Velasco6226 жыл бұрын
The number of items in my cart was sometimes not updating when adding a new product, but I fixed it by adding: Session::save(); to getAddToCart(), right after I call Session::put('cart', $cart); Apparently, Session::put() doesn't save right away: stackoverflow.com/questions/23917409/laravel-session-data-not-sticking-across-page-loads here's the entire function: public function getAddToCart(Request $request, $id) { $product = Product::find($id); $oldCart = Session::has('cart') ? Session::get('cart') : null; $cart = new Cart($oldCart); $cart->add($product, $product->id); Session::put('cart', $cart); Session::save(); return redirect('/products'); }
@pawan97025 жыл бұрын
Thanks
@sauliussaulys80356 жыл бұрын
to solve foreach problem delete $cart = new Cart($oldCart); from ProductControler.php and change $Cart to $oldCart
@sauliussaulys80356 жыл бұрын
Great that helps
@sauliussaulys80356 жыл бұрын
thx, broooooooo
@shahrukh6317 жыл бұрын
As for all those having this error Undefined index: title Its because of foreach It should be like this foreach($products->items as $product) The rest of the code is same.
@haritong36873 жыл бұрын
Im having an error to foreach please help
@joemelkinposadas22187 жыл бұрын
pls reply :(
@raginipatlolla32536 жыл бұрын
please respond
@yoonastk30427 жыл бұрын
when i click product..not increment cart item..my product name are so diffrent..plz help..