1 00:00:00,810 --> 00:00:08,040 So I'm going to come to this page later because this lesson this up this page requires a lot of work 2 00:00:08,190 --> 00:00:09,090 place order. 3 00:00:10,080 --> 00:00:15,540 And before actually before working on this, we need to work on every important thing in the check out. 4 00:00:16,410 --> 00:00:20,850 We cannot allow the user to check out if if the card is empty. 5 00:00:21,270 --> 00:00:23,010 So let me explain what I mean. 6 00:00:23,370 --> 00:00:30,030 So if I go to the cart here and if I either product, but if I change my mind and remove that product 7 00:00:30,540 --> 00:00:35,790 and if I click on check out, it's going to take me to the checkout beach so the user will be able to 8 00:00:35,790 --> 00:00:40,980 check out even though there is nothing in the cart and this is a problem, this is about to fix this 9 00:00:40,980 --> 00:00:47,130 bug we need here in the checkout at the top, we need to check whether the card is empty or not. 10 00:00:47,130 --> 00:00:52,650 So we need to save HP and then we need to say, you going to check? 11 00:00:52,650 --> 00:00:56,760 We need to say session start and then we need to check this issue. 12 00:00:56,910 --> 00:00:57,720 I'm going to say if. 13 00:00:59,290 --> 00:00:59,710 If. 14 00:01:00,880 --> 00:01:02,350 He's not empty. 15 00:01:04,540 --> 00:01:05,230 Session. 16 00:01:08,590 --> 00:01:11,230 Garth if the session is not empty. 17 00:01:11,830 --> 00:01:20,800 And also we need to check if the user came to this speed through the checkout button or through an external 18 00:01:20,800 --> 00:01:21,100 link. 19 00:01:21,100 --> 00:01:29,320 So the user should come to the the check out page only from by clicking on this button. 20 00:01:29,680 --> 00:01:36,850 If a user comes through the check out page from an external link, we shouldn't allow this because this 21 00:01:36,850 --> 00:01:39,430 could pose a problem to our system. 22 00:01:40,000 --> 00:01:43,030 So we need to check this button. 23 00:01:43,030 --> 00:01:47,590 We need to check whether the user came to this page from the checkout or not, and that can be done 24 00:01:47,590 --> 00:01:49,210 using here. 25 00:01:49,210 --> 00:01:54,100 The is set is set, boss. 26 00:01:55,990 --> 00:01:56,530 Most. 27 00:01:58,130 --> 00:02:01,400 And then the name of the brand is Check Out. 28 00:02:03,350 --> 00:02:03,890 Check. 29 00:02:04,730 --> 00:02:09,920 And so if if these conditions are met, then. 30 00:02:10,880 --> 00:02:14,150 Let the user in. 31 00:02:15,020 --> 00:02:15,700 Ailes. 32 00:02:16,880 --> 00:02:17,510 Else. 33 00:02:19,590 --> 00:02:20,520 What we want to do. 34 00:02:22,290 --> 00:02:23,100 We need to. 35 00:02:24,170 --> 00:02:34,400 Send user to homepage because they cannot place an order if they don't have if the card is empty or 36 00:02:34,400 --> 00:02:39,230 if the they if they came to the page through an external link. 37 00:02:39,680 --> 00:02:43,700 So we need you to say hey there and then location. 38 00:02:46,640 --> 00:02:49,100 Index got BHP. 39 00:02:50,760 --> 00:02:52,470 Let me show you now what's going to happen. 40 00:02:52,890 --> 00:02:58,620 So now if I go back to the homepage, when you go to the homepage, now, let me add something to the 41 00:02:58,630 --> 00:02:58,890 card. 42 00:02:58,890 --> 00:03:00,540 See this product card. 43 00:03:01,410 --> 00:03:09,780 And if I click on checkout, I will be able to go to the checkout page because there is there is there 44 00:03:09,780 --> 00:03:12,330 is a product in the in the cart. 45 00:03:12,330 --> 00:03:13,200 There is a product. 46 00:03:13,800 --> 00:03:15,510 Obviously, there is a product in the cart. 47 00:03:15,540 --> 00:03:16,950 Let me show you that one more time. 48 00:03:17,370 --> 00:03:20,480 If you go through the card, there is a product in the cart. 49 00:03:20,490 --> 00:03:22,290 Obviously there is a product. 50 00:03:22,770 --> 00:03:26,490 But if I remove this product, let me remove this product. 51 00:03:26,490 --> 00:03:28,260 And now I don't have anything in the cart. 52 00:03:28,740 --> 00:03:29,730 The cart is empty. 53 00:03:30,360 --> 00:03:34,620 If you click on check out, I will be taking to the homepage. 54 00:03:34,680 --> 00:03:36,330 Let me show you that one more time. 55 00:03:36,870 --> 00:03:37,920 So let me go to the card. 56 00:03:37,920 --> 00:03:39,180 Let me add something to the cart. 57 00:03:40,610 --> 00:03:41,010 Alamy. 58 00:03:41,040 --> 00:03:42,260 Remove it from the cards. 59 00:03:42,320 --> 00:03:43,670 Let me remove this from the cards. 60 00:03:44,150 --> 00:03:45,460 Now there is nothing in the card. 61 00:03:45,470 --> 00:03:49,100 If I click on check out, I will be taking to the homepage.