1 00:00:00,670 --> 00:00:01,330 Welcome back. 2 00:00:01,720 --> 00:00:06,340 So now let's continue working on the placing an order feature. 3 00:00:06,350 --> 00:00:13,810 So I told you that the first step is to get info and store stories in a database. 4 00:00:13,810 --> 00:00:14,650 So this is the step. 5 00:00:14,650 --> 00:00:15,910 This is getting the info. 6 00:00:16,360 --> 00:00:18,910 The second step is to get products from Garth. 7 00:00:19,420 --> 00:00:25,870 And this this this step is this gets products from from Garth, which is this. 8 00:00:26,620 --> 00:00:31,840 And then the third step is to issue new order and store order info in database. 9 00:00:31,840 --> 00:00:32,950 We've already done this. 10 00:00:32,950 --> 00:00:36,490 Let me copy this comment and added in the right place. 11 00:00:36,970 --> 00:00:45,880 So this is the this is the this is the line that is going to issue or get this is going to get the order 12 00:00:45,880 --> 00:00:51,370 from the database and storing the order is this this line of code is going to insert the order into 13 00:00:51,370 --> 00:00:51,880 the database. 14 00:00:52,390 --> 00:00:56,890 So the second step, let's say your second step is to issue a new order. 15 00:00:57,520 --> 00:00:59,950 The third step is to get products from the cart. 16 00:00:59,950 --> 00:01:00,880 I'm going to say here three. 17 00:01:01,630 --> 00:01:09,760 And then the fourth step is to store each single item in an order, the orders table. 18 00:01:09,760 --> 00:01:10,600 We have done that. 19 00:01:10,600 --> 00:01:13,750 Lady, copy this, lady, copy this. 20 00:01:16,050 --> 00:01:17,910 This comment added in the right place. 21 00:01:17,910 --> 00:01:26,010 So this line of good, this line of code is going to issue a new order and store and not this one. 22 00:01:26,010 --> 00:01:28,620 Actually this one. 23 00:01:30,100 --> 00:01:32,530 This one store made me copy it. 24 00:01:34,830 --> 00:01:35,430 Store. 25 00:01:35,700 --> 00:01:41,830 This line of code this line of code is going to store each single item in item table. 26 00:01:42,690 --> 00:01:46,080 And this is getting the data from the session. 27 00:01:47,730 --> 00:01:49,030 And the fourth. 28 00:01:49,440 --> 00:01:52,590 The fifth is to remove everything from the cart. 29 00:01:53,040 --> 00:02:01,350 And this this step should be delayed for now because we need to remove everything from the cart. 30 00:02:01,710 --> 00:02:05,790 Only after user makes a after you as a completes payment. 31 00:02:05,810 --> 00:02:08,940 So I'm going to say you delay the delay. 32 00:02:10,570 --> 00:02:12,910 Until payment. 33 00:02:14,520 --> 00:02:15,150 He's done. 34 00:02:16,940 --> 00:02:19,880 So it's up to you if you want to delete everything from the card. 35 00:02:20,360 --> 00:02:21,080 You can do that. 36 00:02:21,080 --> 00:02:24,810 But I wouldn't recommend doing that because the user has not paid yet. 37 00:02:24,830 --> 00:02:32,570 After user completes payment, we can remove everything from the card and finally is to inform user 38 00:02:32,990 --> 00:02:34,880 whether everything is fine or not. 39 00:02:35,420 --> 00:02:37,280 And if everything's fine. 40 00:02:37,670 --> 00:02:38,030 Which. 41 00:02:38,180 --> 00:02:38,510 Which. 42 00:02:38,510 --> 00:02:39,050 In this. 43 00:02:39,950 --> 00:02:41,330 In this case, everything is fine. 44 00:02:41,840 --> 00:02:44,780 We need to take the user to the payment page. 45 00:02:45,260 --> 00:02:47,740 So the fifth step is to remove everything from card. 46 00:02:47,750 --> 00:02:48,710 I'm going to delay this. 47 00:02:49,190 --> 00:02:56,090 However, if you want to, to delete everything from the card, you can use the on set function. 48 00:02:56,300 --> 00:03:00,140 You can use the unset and then pass the session. 49 00:03:01,540 --> 00:03:06,970 Session and then card is as we move everything from the cards like this, this line of code. 50 00:03:07,060 --> 00:03:07,960 Very, very simple. 51 00:03:08,500 --> 00:03:10,590 However, again, I wouldn't recommend doing that. 52 00:03:10,660 --> 00:03:12,370 So I'm going to keep this card like here. 53 00:03:12,760 --> 00:03:18,580 I'm going to keep this code right here, and I'm not going to remove everything from the card and they'll 54 00:03:18,580 --> 00:03:19,630 use a complete statement. 55 00:03:20,260 --> 00:03:26,620 And here the sixth step is to inform user whether a payment was successful or not and take user to the 56 00:03:27,610 --> 00:03:28,750 to the payment page. 57 00:03:28,750 --> 00:03:33,220 So in order to take the user to a payment page, we need to use the header. 58 00:03:34,330 --> 00:03:34,810 Hey there. 59 00:03:39,900 --> 00:03:40,500 Hey there. 60 00:03:41,570 --> 00:03:42,260 Location. 61 00:03:47,590 --> 00:03:50,560 Hey, they're on location and then the payment page. 62 00:03:50,950 --> 00:03:52,540 So I'm going to create a page called. 63 00:03:54,170 --> 00:03:55,130 Payment. 64 00:03:57,040 --> 00:03:58,020 That BHP. 65 00:03:59,090 --> 00:04:04,650 And I'm going to attach here a, I guess parameter. 66 00:04:04,670 --> 00:04:05,570 I'm going to say order. 67 00:04:07,500 --> 00:04:08,250 Start us. 68 00:04:09,420 --> 00:04:10,280 Is equal to. 69 00:04:11,620 --> 00:04:12,280 Order. 70 00:04:13,650 --> 00:04:14,180 Least. 71 00:04:15,260 --> 00:04:16,130 Successfully. 72 00:04:20,020 --> 00:04:27,970 And you can add this good in if statement after you check after you check this excuse, you can do this 73 00:04:27,970 --> 00:04:35,410 or you can leave it here because if something went wrong, the code will will essentially break and 74 00:04:35,920 --> 00:04:37,510 the rest will not be executed. 75 00:04:37,510 --> 00:04:47,050 So if something goes wrong, we we can we can use if statement with this excuse, for example, we can 76 00:04:47,050 --> 00:04:50,560 say if something goes wrong here at this point. 77 00:04:51,790 --> 00:05:01,180 We can we if if this is wrong, if this is false, we can take the user to another place. 78 00:05:01,190 --> 00:05:06,400 But I'm not going to I'm not going to complicate because for now, I'm going to keep the code very simple. 79 00:05:06,400 --> 00:05:11,290 And then later we can add more code as we move on. 80 00:05:11,740 --> 00:05:14,920 So this step is to take the user to the payments page with this parameter. 81 00:05:15,190 --> 00:05:21,370 So we need to display the payment button so that the user can complete the payment. 82 00:05:21,760 --> 00:05:24,100 So I'm going to create a new page here called Payment. 83 00:05:26,150 --> 00:05:26,980 That HP. 84 00:05:28,480 --> 00:05:32,680 And the code for this page is going to be very similar to other pages. 85 00:05:33,430 --> 00:05:41,050 For example, it's going to be similar to the checkout, but I'm not going to display anything but a 86 00:05:41,050 --> 00:05:44,050 button just about in with the payment information. 87 00:05:44,470 --> 00:05:48,760 So I'm going to copy the code from the checkout page and then I'm going to paste it into the payment 88 00:05:48,760 --> 00:05:51,700 that me and in the payment that BGP. 89 00:05:52,030 --> 00:05:58,030 What I'm going to do is that first I'm going to close down this filter because I'm not going to work 90 00:05:58,030 --> 00:05:59,710 on the filter that is going to be the same. 91 00:06:00,520 --> 00:06:04,450 And I'm going to close down also the navigation bar. 92 00:06:05,410 --> 00:06:07,300 And in between, we have the check out. 93 00:06:07,300 --> 00:06:10,930 Instead of check out, I'm going to say payment, payment. 94 00:06:11,590 --> 00:06:14,230 And here I'm going to remove many things. 95 00:06:14,710 --> 00:06:20,590 So I'm going to remove I'm going to remove this for actually, we we just need to remove this for I'm 96 00:06:20,590 --> 00:06:21,670 going to remove this form. 97 00:06:23,610 --> 00:06:28,800 For now and I'm just going to display here payment. 98 00:06:31,090 --> 00:06:31,660 Be. 99 00:06:32,910 --> 00:06:33,510 Ment. 100 00:06:34,410 --> 00:06:43,140 And here in this dance, I'm just going to say I'm just going to say B and then I'm going to display 101 00:06:43,140 --> 00:06:43,920 the total. 102 00:06:44,340 --> 00:06:50,010 I can't remember the total amount is stored again is stored in the session. 103 00:06:50,310 --> 00:06:54,820 So, so here I'm going to say Echo and then I'm going to echo the session. 104 00:06:55,680 --> 00:06:57,930 I'm going to say Echo and then session. 105 00:06:59,030 --> 00:07:00,290 And what do we want to. 106 00:07:00,560 --> 00:07:01,310 We want to equity. 107 00:07:01,310 --> 00:07:01,790 Total. 108 00:07:02,630 --> 00:07:03,510 Total amount. 109 00:07:03,530 --> 00:07:08,090 I'm going to take you total and then semicolon and forget the dollar sign. 110 00:07:08,720 --> 00:07:10,880 And before the dollar sign, I'm just going to say. 111 00:07:13,160 --> 00:07:13,940 Don't tell. 112 00:07:15,260 --> 00:07:15,860 Payment. 113 00:07:18,520 --> 00:07:22,300 And then semicolon and then dollar sign. 114 00:07:22,780 --> 00:07:25,400 And of course, you can display whatever you want to display. 115 00:07:25,420 --> 00:07:30,910 But I would recommend just keeping everything simple and just display this go to total amount. 116 00:07:30,910 --> 00:07:33,160 And then we need to display also an input. 117 00:07:33,550 --> 00:07:38,560 And that input is going to have a first class. 118 00:07:38,560 --> 00:07:44,710 I'm going to take less end and I'm going to say value and the value is. 119 00:07:47,860 --> 00:07:49,540 Complete payment or proceed. 120 00:07:50,710 --> 00:07:51,970 Pay now or pay now? 121 00:07:51,980 --> 00:07:52,990 Let's say pay now. 122 00:07:54,190 --> 00:07:58,180 And I'm going to also say, do I submit? 123 00:07:59,370 --> 00:07:59,880 Time. 124 00:08:01,600 --> 00:08:03,280 Types a met. 125 00:08:04,600 --> 00:08:05,570 And that's it. 126 00:08:05,590 --> 00:08:07,060 I'm going to be working on this later. 127 00:08:07,570 --> 00:08:11,260 And before this thing, there is a couple of things I need to fix. 128 00:08:11,680 --> 00:08:18,820 The first thing is that in the place ordered at BHP, you'll find that the payment that BHP is not in 129 00:08:18,820 --> 00:08:25,510 the same directory as the please underscore order that BHP therefore would need to say that that. 130 00:08:26,050 --> 00:08:36,340 And then for slash because we need to go back or go out of the of the server because the lease or that 131 00:08:36,340 --> 00:08:38,470 BHP is inside the server folder. 132 00:08:38,860 --> 00:08:45,010 And if we just say payment without done that, it is going to try to find the payment that BHP in the 133 00:08:45,280 --> 00:08:49,720 silver folder and it's not going to find it and we are going to get an error. 134 00:08:50,050 --> 00:08:57,910 So we need to say that, that in order to go back and then we will be able to access the payment or 135 00:08:57,910 --> 00:08:59,650 we can move the payment. 136 00:08:59,650 --> 00:09:01,780 You can move the payment to the server. 137 00:09:01,780 --> 00:09:02,500 Let's move. 138 00:09:03,490 --> 00:09:05,170 Let's move the payment to the server. 139 00:09:05,170 --> 00:09:08,680 If you want to keep things, just keep it like this. 140 00:09:08,680 --> 00:09:10,390 I don't want to confuse you right now. 141 00:09:10,780 --> 00:09:16,990 So here, don't forget that and therefore slash payment that BHP, another thing that they want to do 142 00:09:16,990 --> 00:09:21,550 is that in the payment that BHP at the top at the top here. 143 00:09:22,820 --> 00:09:24,230 You need to hear. 144 00:09:24,230 --> 00:09:25,320 We don't need to hear this. 145 00:09:25,340 --> 00:09:25,570 Good. 146 00:09:26,480 --> 00:09:29,900 We just want to display the payment page so we don't need this. 147 00:09:30,230 --> 00:09:32,750 Let me remove this code for now. 148 00:09:33,290 --> 00:09:34,910 The only code that we want is. 149 00:09:34,910 --> 00:09:35,780 Is the session. 150 00:09:36,200 --> 00:09:39,110 So we just need to say, session, start here. 151 00:09:39,110 --> 00:09:41,000 We just need to say session start. 152 00:09:41,660 --> 00:09:43,340 So you need to say session start. 153 00:09:43,340 --> 00:09:48,860 And then you can hear say echo and then total payment. 154 00:09:49,100 --> 00:09:50,780 And by the way, you can display the message. 155 00:09:50,820 --> 00:09:53,480 Let me show you the message that you can display. 156 00:09:53,480 --> 00:09:56,270 You can simply the message got passed from the place order. 157 00:09:56,630 --> 00:09:57,440 So the place order. 158 00:09:57,440 --> 00:10:04,130 I said, your order status is equal to ordered, placed successfully, successfully. 159 00:10:04,730 --> 00:10:12,260 You can place this message by by accessing the get parameter so you can use, say, B2B and then. 160 00:10:13,580 --> 00:10:16,850 And then you can say echo, echo. 161 00:10:16,850 --> 00:10:22,520 And then you can echo the get get a dollar sign and then get. 162 00:10:23,650 --> 00:10:27,640 Dollar sign here and then get. 163 00:10:28,970 --> 00:10:37,940 And then order, status order or their score status and that's it. 164 00:10:37,980 --> 00:10:38,990 You can display it here. 165 00:10:39,080 --> 00:10:42,230 And don't forget the dollar sign limit. 166 00:10:42,230 --> 00:10:43,880 Click on file Invincible. 167 00:10:44,420 --> 00:10:46,490 And let me now head on over to the browser artist. 168 00:10:46,910 --> 00:10:50,900 So let's add something to the cart and start the process from from the beginning. 169 00:10:50,900 --> 00:10:55,250 So I'm going to click on buy now and we should have this product in the cart. 170 00:10:55,400 --> 00:10:57,620 I already have this product in the cart, by the way. 171 00:10:58,130 --> 00:11:00,500 So let me check out and place an order. 172 00:11:01,100 --> 00:11:02,840 Let me fill out this form quickly. 173 00:11:06,370 --> 00:11:07,900 So I filled out this form limit. 174 00:11:07,900 --> 00:11:10,480 Click on place order and see what's going to happen. 175 00:11:10,900 --> 00:11:15,970 So if you click on this order, as you can see, you are going to get your order placed successfully 176 00:11:15,970 --> 00:11:19,830 and then total payment is this amount and then pay now button. 177 00:11:20,440 --> 00:11:27,730 So we just need to fix here the visa and I'm going to say text center, tech center because they want 178 00:11:27,730 --> 00:11:28,780 to center these things. 179 00:11:29,260 --> 00:11:40,330 And I also want to say here BTN primary within PRI my for now just for now and I can change it later. 180 00:11:40,340 --> 00:11:41,110 Let me refresh. 181 00:11:41,950 --> 00:11:47,560 And as you can see, I'm going to get this message order placed successfully and I want to remove the 182 00:11:47,560 --> 00:11:49,150 quotes from the order status. 183 00:11:49,150 --> 00:11:54,570 So here in the last order, we need to remove this double cross. 184 00:11:54,630 --> 00:11:57,820 I'm going to remove this and I'm going to remove this. 185 00:11:58,630 --> 00:12:00,880 And I should. 186 00:12:02,850 --> 00:12:04,390 Leave me remove this as well. 187 00:12:04,400 --> 00:12:07,490 I'm going to remove this and I'm going to remove this as well. 188 00:12:07,490 --> 00:12:12,320 And let me refresh and as you can see, we have here order placed successfully total payment is this 189 00:12:12,680 --> 00:12:15,950 and then pay now about it so payment I'm going to be working. 190 00:12:16,190 --> 00:12:20,270 What I wanted to tell you is that I'm going to be working on payment later because it's going to take 191 00:12:20,270 --> 00:12:20,810 a lot of time. 192 00:12:20,810 --> 00:12:23,090 So I'm going to be working on payment later. 193 00:12:23,540 --> 00:12:28,520 But for now, we just need to know that the last step is that is payment. 194 00:12:28,520 --> 00:12:30,950 So we, we added the product to cart. 195 00:12:30,950 --> 00:12:32,390 We place the order in the database. 196 00:12:32,390 --> 00:12:34,910 Everything's fine except for being so payment. 197 00:12:34,910 --> 00:12:41,660 We just need to work on it later and for now we need to work on other things and complete other things 198 00:12:42,050 --> 00:12:43,550 until we are done. 199 00:12:43,550 --> 00:12:45,350 And then I'm going to be working on payment.