30. Multivendor ecommerce in laravel 8 | product filter (II)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to part 30 in this part 30 i will filter i will do the two two things first i will sort the product where it says like this way i will sort the product and next is the remaining part like last time we did a product category filter and i will do in this video is music price filter and other things okay so let's get into the code now where is the sorting here last time we did a filter like this but i will show so you here in here with it like this way but now i will do another way i will teach you in another way you can try and this way as well in here but i will do the next way so first of all i copy copy this let's copy this and paste in here okay now if you are refresh here if you refresh here then there are some certain now here is the id sort by and we need to [Music] function here with this dot form dot submit function right so this will submit the value hello in here in swap filter okay so let's go in the glitter filter section here first of all i will if i click here okay let me rephrase it and if you click here why this is not a clickable or change the name of the id here okay we close the form in here so we need to write okay we need to we don't need to close the form in here so [Music] we need to wrap with here right let's skip some style if you refresh here now [Music] okay there is design we need to wrap with row okay so let's do this if you refresh yeah it's good and if you click here lower dryer it's now okay fine now here in the same way i will create here category filter by sort by url let's create that and here we will check in the same way if not empty empty the data with sort by yeah that's name is same with the with the name of this one okay so if this is not empty sort by equals to equals to that data and we will append in here with how can we append just add dot and sort the wire so now if you refresh and click here yeah this is append here sort by price ascending [Music] now in let's go to here let's again go to here and check if the not empty get with sortify with the same name and here we will check if this is not empty i mean the value is not empty then we will run the inside code the inside code is with the same what is the product category plural category with the same let's copy this one and add here [Music] by okay you can do outside here and in here [Music] okay we don't need this one so we will remove okay and also we don't need pagination here [Music] right now we need to do what i can do status is true and offered by ascending fine so let me check here total i'm get the pagination for the total value so if the price is ascending it's working now if you go here price is higher to lower prices descending yeah price is also descending here all are working here alphabetically yeah it's all alphabetically right and if you add here so let me close all here right now sorted by gates order by there is a problem in sort by we will do it in here if you do this way there is no error and if you click here wait a minute some issues so what maybe this is we will use this products in here okay does not exist so thank exists total nine nine products what's the problem sort by okay then one little return here right otherwise finally click on this one and in the software and this is working fine the problem in here problem is in here so if you click here price is ascending status is true order by okay passing it is okay fine if you remove this one and hit enter it should not become here default sort why default sort is coming here selected this one if you click here still default sort sort by what is theater get started by let's run everything with if and this one click here 27 fine if you sort with lower to higher okay order by does not exist okay why order by does not exist in here title ascending so it also doesn't exist okay okay okay okay now problem is solve what i did is mean i make this relation to status to active only active products are shown now in here i did this way you can see here i remove else if everything and only if condition is used and here pagination i did the pagination and else part i did this way and if you refresh here and click here till so nine products right and here i did a lower to higher append 9 product and it will go to the lower to higher all right if you check this one there are now 36 items and if you check here lower to higher then the value is lower to higher and if you go to the next yeah it's lower dryer but one problem is here we need to use we need to select the that one it will refresh so how can we solve that it's very easy just go here in the value stop here we can do [Music] use a if condition here and if not empty what not empty get with start by is not empty and we use get get sorted by is if this is equals to value its value is price ascending if these are true then we will select it otherwise and if right let me check one more time if in this condition okay if this condition till that and get with that value selecting otherwise as okay there is a song problem here if dollar get okay i think this one okay so it's a lower to higher selected right in the same way you can do let's do let's do here and final one paste here and here title descending there is a copy paste copy paste paste so now if you click here i have to lower higher price to lower price with these two ballots if you click here there are 59 okay and higher to lower so if you check another one it will go to 83 it is really with i have to learn okay that's fine okay now let's do it the filter by price yeah there are the static values in here okay so let me change some design here because because here in the button there is a margin then no let's keep margin jv okay margin zero line height let's keep it zero okay so let me refresh it fine so our currency is in dollar right now in pizza you may change the currency value as well or in later videos i will do the currency value here as well so first of all i will create the maximum price and lower price in the helper function helpful for example we did created we recreate a last time okay so in here public static function with minimum price create one function here it will return floor will return return the smallest value if the value is like one point three then it will convert to one so here floor with product model with mean minimum value of what offer price over price [Music] okay and now let's do the maximum price maximum price with max product max okay [Music] okay now let's go here and call the data min with alpha function helper with max minimum maximum price data unit is dollar okay here also give the helper with [Music] okay and here also sodium minimum price and here maximum price so let's refresh here the minimum price is 103 and maximum price is 999 you can change it in this way so that's fine okay now in the next let's give the value here here i will write the input input main value okay now what its type is submit type is submit and here we keep the name with price underscore range okay and [Music] that's it and let's go here and in the filter the filter section price filter okay and in the price filter let me create one variable price range url equals to this one and if if let's click empty with dollar no with data price range is not empty then we will append in here to append dot equals to we will get the url name what and we will keep and price is equals to equals to good data of price range so that's fine let's do the price range if you refresh here let me cut it here now empty because we have not passed the value so we're so so so so so in here it should be hidden okay hidden we will pass the value value if if an empty dollar get [Music] yes empty dollar underscore kit press this one and we need to close nf and if and we will print the value here with a dollar get and with the price price now if you repress here now it's in still empty empty and we will give the value id okay now why we need to keep the we need to keep the value here with the script script tag okay so how can we keep that value determine data max so we need to give here one id and let's keep the id name slider retains okay and in the js we will do let's go here and write one scripts price slider and in here write a js script js is script with take care if the ready function here and check here if dollar width that slider slider range dot length is greater than zero then we will write the code here so let's make a constant variable maximum price and let's here we have the price should be in the in desired so parts in parts end [Music] we have the dollar with slider range slider range that data of max yeah that is 999 okay so that's fine you know that data max we have the data max value here data max and we have also determined value so you can do in the same way with minimum minimum price minimum okay and now let variable i will write the price range okay in the price range i will create a minimum price and append minimum price dash maximum price okay minimum price and maximum price that that's fine if you print here price range then it will store the 100 103 to 999 okay so now we need to create a id id here now the next one is in here let's create the id id with price friends i'll create the presence value here id here so and then let's check it if dollar price range dot length is greater than zero and and value it's not outside it's inside here and a dollar price range dot value we will write price presence variable in the presence variable the price range dot value and that trim trim function okay and in the price with price range that is split with okay and let's go here and let that dollar slider slider function and with that range true minimum and will be minimum value max value will be max will be max value and value will be priced [Music] event with ui and here dollar with i will i will create a here i'll create here input input text head only i will be amount okay so let's go ahead one all right and also we need to input we need to add the value in the hidden either input which is ideal price range let's duplicate price range with value ui plus testimony that's fine so now let's let's let's let's make some changes here the input tag with 50 percent none okay and in here we will show the dollar how can we print the dollar just add dollar if you write dollar here will it work no it will not work so let me take dollars will it work yeah it will work plus right and and and and and here let's make some style style border it's zero and and test helper max price and and also to paint the dollar dollar okay that's fine if you click here the price value is good now let's go to the controller what is the controller index controller and let me go in here [Music] if not empty get price range and then we will explode that price which price if you click here okay that price we will explode let's do in the variable explode with what we need to explode by dash because here shifted by this dollar if it said [Music] price of zeroth index there is index and and it is numeric price with zero zero then what will be dollar price zero will equal will be equals to floor minimum value of okay is it okay okay we don't need this we need one this one and let's duplicate one here one equals two another still c value and now offer price our price is third price okay so if you refresh now the price range is there if you if your value is 700 put it to tonight and if you write here okay we forgot to add add in here with that present so if you your value is 790 to 999 then [Music] until there is a feature let me check here price okay price on the screens no it's balanced price writing the wrong name here okay yeah so if you hit enter there is a error imagination to keep here today okay still problem let's return the query function where between prices price pressing it too well purpose to well what is the problem dollar price fascinated [Music] where between that price and it needs to return the list of products items items two items what how this is working if you write from here 500 products and also we need to write here where status is active right 200 266 products from 100 to 999 price so if you write here 818 support to 999 and how many products 28 products okay what head value is refreshed okay fine how can we make that value so let's go ahead and stop it we will we will show the value minimum value and maximum value here and instead of that we can do one more thing my keys what i will do is i will check if if if a dollar gets ready if it has if this is not empty with a dollar you can get price name if this is not empty then we will return what and we will check also here if empty get with price we need to explode write a psp code price equals to explode with this dollar okay and here we will print the value what value will print okay that's for one and here we will do the same same thing for the maximum value maximum price okay same number of products okay that's fine now if you have the empty then we have the the so now one more thing we need to do is we need to print the dollar dollar here let's print dollar okay if you want to so the products from 3 to 343 these are the products 64 products but in here there is some problem so problem is 60 percent width okay now let me test from this start if a user go to this sub page and he wants to see the category in that category there are nine products available and if i want from lower to higher price okay there is another problem we are facing another i think so what might be the problem okay okay okay we got nine problem with ascending to descending from here and lowered higher [Music] remove okay hello to higher if you go here then lower to higher and if you print one link in that age print from there only one product there is one product and let's suppose if you filter from the price 103 to 259 there are 49 products and if you sort these two in alphabetically ascending order there is ascending order with 49 products okay it's too long video so i will do other filters like you can do the brand filter like this way in the same way otherwise if you need a help i will do in the next video so thank you so much for watching this video see you in the next video
Info
Channel: Coding with Prajwal
Views: 1,653
Rating: undefined out of 5
Keywords: advance ecommerce series in laravel, multivendor ecommerce in laravel, ecommerce, coding with prajwal, product filter in laravel, laravel project in 2021, latest laravel project, complete ecommerce tutorial
Id: p_3REFDbAls
Channel Id: undefined
Length: 66min 18sec (3978 seconds)
Published: Sun Mar 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.