1 00:00:01,150 --> 00:00:01,780 Welcome back. 2 00:00:02,260 --> 00:00:07,180 Now it's time to fix every a bug that we have in the car. 3 00:00:08,110 --> 00:00:14,470 And it's very important to fix this because we want users to have the best possible user experience. 4 00:00:14,890 --> 00:00:20,290 So the problem is that if you click now, if you go to the website initially and if you click on the 5 00:00:20,290 --> 00:00:25,660 cart, I allow users to be able to to go to the cart, even if there is nothing of the cart. 6 00:00:26,200 --> 00:00:29,230 And if there is nothing in the cart initially you will get this error. 7 00:00:29,740 --> 00:00:34,360 And this error is because the session has not been initialized. 8 00:00:35,380 --> 00:00:41,140 But later, if user add something to the cart and removes it from the cart, it would work and there 9 00:00:41,140 --> 00:00:42,160 will be no problem. 10 00:00:42,160 --> 00:00:50,110 This error would not occur because the reaction would be initialized, but it would be empty and there 11 00:00:50,110 --> 00:00:50,980 is no problem with it. 12 00:00:51,510 --> 00:00:58,930 So the problem is that we need to initialize this or we need to protect the execution of the session 13 00:00:59,410 --> 00:01:05,350 in case the session is not set and to do this here in the cart before using the session. 14 00:01:05,350 --> 00:01:12,370 As I told you, whenever we use a key variables in B2B, we need to check whether they are set or not. 15 00:01:12,790 --> 00:01:17,590 So here in this for each before we use the session, we need to say here. 16 00:01:18,600 --> 00:01:23,070 BHP and then AIF is set. 17 00:01:24,750 --> 00:01:25,470 Session. 18 00:01:26,640 --> 00:01:27,360 Session. 19 00:01:29,410 --> 00:01:29,950 Garth. 20 00:01:31,920 --> 00:01:32,550 And then. 21 00:01:36,650 --> 00:01:38,750 Kill him, rocket and then I'm going to close the beach. 22 00:01:38,750 --> 00:01:47,030 Be if that if this Asian court is set, then we execute the four each and display the products and then. 23 00:01:48,130 --> 00:01:57,040 At the end specifically here, I had a record here just just inside the table and above the. 24 00:01:58,280 --> 00:02:04,340 Above the above the tr here. 25 00:02:04,340 --> 00:02:06,080 What we need to do is that we need to close it. 26 00:02:06,620 --> 00:02:12,170 So to close it, we need to close it here because here we are actually, we are using it again. 27 00:02:12,170 --> 00:02:15,140 So let me here close it first. 28 00:02:15,140 --> 00:02:16,520 I'm going to close it here. 29 00:02:17,030 --> 00:02:17,950 We need to close it here. 30 00:02:17,960 --> 00:02:21,650 Link to save HP and then close the bracket. 31 00:02:22,460 --> 00:02:26,600 However, we need to create another protection here. 32 00:02:27,020 --> 00:02:30,440 So here we need to say we need to say if. 33 00:02:33,670 --> 00:02:34,870 BHP if. 34 00:02:36,360 --> 00:02:38,010 Is sex. 35 00:02:39,230 --> 00:02:40,940 If a set session. 36 00:02:42,430 --> 00:02:43,180 Session. 37 00:02:44,970 --> 00:02:45,660 The hotel. 38 00:02:47,020 --> 00:02:48,370 Then we display the total. 39 00:02:59,980 --> 00:03:07,720 However, it's better to say it because we don't want to be told the the total would be actually would 40 00:03:07,720 --> 00:03:08,250 be zero. 41 00:03:08,260 --> 00:03:10,630 There is no problem with it, but it's better to be consistent. 42 00:03:10,630 --> 00:03:14,450 So if the cart is empty, it means that the total is zero. 43 00:03:14,470 --> 00:03:18,250 We already took care of this so we can use cart or two. 44 00:03:18,520 --> 00:03:23,140 It's, it's, it's going to be the same because they are related in some way. 45 00:03:23,650 --> 00:03:26,080 If the cart is empty, it's going to be zero. 46 00:03:27,040 --> 00:03:29,470 Let me now refresh and show you that the air will be gone. 47 00:03:32,220 --> 00:03:36,120 So as you can see, the error is gone and it's perfect now it's perfect. 48 00:03:36,780 --> 00:03:41,430 And another thing that we need to do is that, as you can see, if you refresh, you will get this air. 49 00:03:41,430 --> 00:03:47,730 And this air is because we have this on display twice and we need to remove this and start from here. 50 00:03:48,240 --> 00:03:53,580 And it's it's better to add this issue and start at the head. 51 00:03:54,330 --> 00:03:55,740 So let me open up the header. 52 00:03:56,370 --> 00:03:58,680 Let me open up the header in the layouts. 53 00:03:59,070 --> 00:04:02,370 We have the header and in the header we need to add the session. 54 00:04:02,370 --> 00:04:05,820 We already have the session so we don't have any problems here. 55 00:04:06,240 --> 00:04:10,650 If you you should remove it from here and added in the header because the ending will be included in 56 00:04:10,650 --> 00:04:12,900 every single page, almost in every single page. 57 00:04:13,650 --> 00:04:18,320 And you can even here include the, include the server connection. 58 00:04:18,330 --> 00:04:25,680 You can say you got that event server connection in case you just want to make sure that the server 59 00:04:25,680 --> 00:04:31,010 connection will, will always be here or you can include it in every single file you want. 60 00:04:31,020 --> 00:04:36,330 So it's up to you to do this or to include it in every single file that uses it. 61 00:04:37,230 --> 00:04:39,480 Let me now refresh and show you that the error will be gone. 62 00:04:39,480 --> 00:04:47,040 So as you can see, there is no air, so there is no air and the air will not be there at all. 63 00:04:47,250 --> 00:04:53,850 So it has been removed and every single page now works perfectly and our website is just perfect.