sito web:Ultimi Home Appliances Price in Bangladesh 2022-PriceBD. Retesoddisfare
Pricebd-smartphonereview,news,specificationsAllCategoriesMobilePhoneUnofficialPhoneOfficialPhoneTabletFeaturePhoneElectronicsLaptopWatchSearchChoosecategoryforsearchAllMobileElectronicsAccessoriesLoginHomeBrandsLaptopPhoneWatchNewsReviewContact(adsbygoogle=window.adsbygoogle||[]).push({});LatestProductsMeizuMblu21DisplaySize:6.75inchesMainCamera:13MP,(wide)Battery:4900mAhRam:4GBSamsungGalaxyA165GDisplaySize:6.7inchesMainCamera:Triple50MP,(wide)Battery:5000mAhRam:4GB,8GBTeslaPiDisplaySize:6.7inchesMainCamera:12MP1080pBattery:5000mAhLi-PoRam:16GBRAMSamsungGalaxyS24FEDisplaySize:6.6inches,110.2cm2PrimaryCamera:Triple50MP,(wide)BatteryCapacity: 4700mAhRam: 8GBItelP55PlusDisplaySize:6.6inchesPrimaryCamera: 50MPBatteryCapacity:5000mAhRam:4GB,8GBHP250G8Corei311thGenProcessor:IntelCorei3-1115G4Display:15.6"FHDCamera:WebCamHPTrueVisionHDRAM:4GBDDR4HuaweiPocket2DisplaySize:6.94inches,111.9cm2PrimaryCamera:Triple50MP,(wide)BatteryCapacity:4520mAh RAM:12GB,16GBSamsungGalaxyS24PlusModel:GalaxyS24+DisplaySize:6.7inches,110.2cm2 PrimaryCamera:50MP,f/1.8,24mm BatteryCapacity:4900mAhRam:12GB XiaomiRedmiNote135GDisplaySize:6.67inches,107.4cm2PrimaryCamera:Triple108MP,(wide)BatteryCapacity:5000mAhRam:6GB,8GBSamsungGalaxyS24DisplaySize:6.6inches.PrimaryCamera:Triple50MP,(wide)BatteryCapacity:4000mAhRam:8GB TecnoSpark20CDisplaySize:6.6inches,104.6cm2PrimaryCamera:Dual50MP,(wide)BatteryCapacity:5000mAhRam: 4GB,8GBWaltonNEXGN71PlusDisplaySize:6.6inchesPrimaryCamera:Dual:52MP,(wide)BatteryCapacity:5050mAhRam:9GBVivoV30LiteDisplaySize:6.67inches,107.4cm2PrimaryCamera: Triple64MP,(wide)BatteryCapacity:4800mAhRam:12GBZTEBladeA54DisplaySize:6.6inches,104.6cm2PrimaryCamera: 13MP,(wide)BatteryCapacity:5000mAhRam:4GBTCLTab10LDisplaySize:10.1inches,295.8cm2PrimaryCamera: 2MPBatteryCapacity:4080mAhRam:2GBSamsungGalaxyWatchActive2DisplaySize:1.4inches,6.3cm2PrimaryCamera:N/ABatteryCapacity:340mAhBatteryRam:768MB,1.5GBTCLTab8DisplaySize:8.0inches,185.6cm2PrimaryCamera: 5MPBatteryCapacity:4080mAhRam:2GBMotorolaMotoTabG70DisplaySize:11.0inches,344.4cm2PrimaryCamera:13MPBatteryCapacity:7700mAhRam:4GBOppoPadDisplaySize:11.0inches,350.9cm2PrimaryCamera:13MPBatteryCapacity:8360mAhRam:6GB,8GBSamsungGalaxyWatchActive2AluminumDisplaySize:1.4inches,6.3cm2PrimaryCamera:N/ABatteryCapacity:340mAhBatteryRam:768MB(adsbygoogle=window.adsbygoogle||[]).push({});SubscribeformoreupdateSubscribetothemailinglisttoreceiveupdatesonpromotions,newarrivalsanddiscount.Subscribepricebd.netBrandNewsReview©2024pricebd.net|AllRightReservedGetInTouchContact737info@pricebd.netAllStarttypingandpressEntertosearchSearchProductNameHomeMenClothingTopsHoodies(23)Description:Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlaboreetdoloremnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariatur.$100.00OriginalPrice:$120.00Discount:15%Se:$20SkuInformation:ailability:InStockOnly:50leftProductVariants:ailableColor:HeatherGreyBlackWhiteailableSize:Male2XLMale3XLKids4Kids6Kids8Kids10Kids12FemaleSmallMaleSmallFemaleMediumMaleMediumFemaleLargeMaleLargeFemaleXLMaleXLShare:Quantity:43;45;AddtocartJaScriptisdisabledinyourbrowser.PleaseenableJaScriptinyourbrowserorupgradetoaJaScript-capablebrowser.#app{display:none;}window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+newDate;ga('create','UA-XXXXX-Y','auto');ga('send','peview')//InstantiateEasyZoominstancesvar$easyzoom=$('.easyzoom').easyZoom();//Setupthumbnailsexamplevarapi1=$easyzoom.filter('.easyzoom--with-thumbnails').data('easyZoom');$('.thumbnails').on('click','a',function(e){var$this=$(this);e.preventDefault();//UseEasyZoom's`swap`methodapi1.swap($this.data('standard'),$this.attr('href'));});//Setuptogglesexamplevarapi2=$easyzoom.filter('.easyzoom--with-toggle').data('easyZoom');$('.toggle').on('click',function(){var$this=$(this);if($this.data("active")===true){$this.text("Switchon").data("active",false);api2.teardown();}else{$this.text("Switchoff").data("active",true);api2._init();}});$("#product2").select2({placeholder:"SearchforProduct",allowClear:true});//Note:WemustuseattowriteJaScriptbecausethisfilehasa.phpextension//UsingjQueryforthewebsiteFRONTsection:$(document).ready(function(){//SortingFilterWITHOUTAJAX(usingHTMLandjQuery)infront/products/listing.blade.php//SortingFilterWITHAJAXinfront/products/listing.blade.php.Checkajax_products_listing.blade.php(whichis'include'-edbylisting.blade.phppe)$('#sort').on('change',function(){//selectingtheboxinlisting.blade.phpvarsort=$('#sort').val();//Gettheboxvalueofthe'sort'nameHTMLattributevarurl=$('#url').val();//Getthefieldvalueofthe'url'nameHTMLattribute($urlispassedfromlisting()methodinFront/ProductsController.phptoview(lising.blade.php))//Sendallthe'fabric'DynamicFiltervalues(the':checked'checkboxesfieldsvaluesinfilters.blade.php)alongwiththeSortingFilters'sort'varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//SendalltheDynamicFiltervaluesDYNAMICALLY(the':checked'checkboxesfieldsvaluesinfilters.blade.php)alongwiththeSortingFilters'sort'//WhenaSortingFilterisclicked,getalltheDynamicFilters'sfiltervaluestosendthemtoowiththeAJAXcall,alongwithsortandurl//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(alltheotherfiltervaluesalongwithcurrentjQueryselectedfilter)infilters.blade.php//getthefiltervaluesarrayoffilterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodtype:'Post',data:{//wepassthe'sort'(SortingFilter),'url'variablesalongwiththeallDynamicFilters'svaluesDYNAMICALLY//WhenaSortingFilterisclicked,sendalltheDynamicFilters'sfiltervaluestoowiththeAJAXcall,alongwithsortandurl//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)sort:sort,url:url,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);},error:function(){alert('Error');}});});//operateDynamicFiltersstaticallyusingthefirstway(forthe'fabric'filteronly)://Checkget_filter()functioninthisfileandthelisting()methodinFront/ProductsController.php//Wewillneedtosendthe'url'and'sort'toincludethemtoojustlikewedidwiththeSortingFilterfunctionabove(inthisfile)(alongwithsending'fabric')//operateDynamicFiltersDYNAMICALLYusingtheSECONDway(forALLfilters)://Checkget_filter()functioninfront/js/custom.jsandthelisting()methodinFront/ProductsController.php//Wewillneedtosendthe'url'and'sort'toincludethemtoojustlikewedidwiththeSortingFilterfunctionabove(inthisfile)(alongwithsending'fabric')//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.core').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.processor').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.ram').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/jsUltimi Home Appliances Price in Bangladesh 2022-PriceBD. Rete/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.rom').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.network').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#urUltimi Home Appliances Price in Bangladesh 2022-PriceBD. Retel').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.battery_capacity').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.product_color').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.laptop_ram').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.hdd').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.ssd').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//getalltheactive/enabledfiltersfromdatabase($productFilterscomesfromthefartopofthisfile)//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.l_display_size').on('click',function(){//selectthe'fabric'filter(whichisgenerateddynamicallyfromtheforeachloop)infilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselectedfilter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'fabric'filtervalueslike:['cotton','polyester']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENANYFILTER'SFILTERVALUEISCLICKED,SENDTHECLICKEDFILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselectedfilter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.filter)selectorwouldselectthefiltervaluesofONEfilterONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['red','green']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//Size,price,color,brand,…arealsoDynamicFilters,butwon'tbemanedliketheotherDynamicFilters,butwewillmaneeveryfilterofthemfromthesuitablerespectivedatabasetable,likethe'size'Filterfromthe`products_attributes`databasetable,'color'Filterand`price`Filterfrom`products`table,'brand'Filterfrom`brands`table//First:the'size'filter(from`products_attributes`databasetable)//WHENthe'size'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'size'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.size').on('click',function(){//selectthe'size'filterinfilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENthe'size'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'size'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'size'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENthe'size'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'size'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'size'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.size)selectorwouldselectthe'size'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'size'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//Size,price,color,brand,…arealsoDynamicFilters,butwon'tbemanedliketheotherDynamicFilters,butwewillmaneeveryfilterofthemfromthesuitablerespectivedatabasetable,likethe'size'Filterfromthe`products_attributes`databasetable,'color'Filterand`price`Filterfrom`products`table,'brand'Filterfrom`brands`table//Second:the'color'filter(from`products`databasetable)//WHENthe'color'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'color'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.color').on('click',function(){//selectthe'color'filterinfilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENthe'color'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'color'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'color'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['red','green',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENthe'color'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'color'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//seUltimi Home Appliances Price in Bangladesh 2022-PriceBD. RetendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'color'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.color)selectorwouldselectthe'color'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'color'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//Size,price,color,brand,…arealsoDynamicFilters,butwon'tbemanedliketheotherDynamicFilters,butwewillmaneeveryfilterofthemfromthesuitablerespectivedatabasetable,likethe'size'Filterfromthe`products_attributes`databasetable,'color'Filterand`price`Filterfrom`products`table,'brand'Filterfrom`brands`table//Third:the'price'filter(from`products`databasetable)//WHENthe'price'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'price'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.price').on('click',function(){//selectthe'price'filterinfilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'price_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENthe'price'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'price'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'price'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENthe'price'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'price'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'price'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.price)selectorwouldselectthe'price'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'price'filtervalueslike:['small','medium']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});//Size,price,color,brand,…arealsoDynamicFilters,butwon'tbemanedliketheotherDynamicFilters,butwewillmaneeveryfilterofthemfromthesuitablerespectivedatabasetable,likethe'size'Filterfromthe`products_attributes`databasetable,'color'Filterand`price`Filterfrom`products`table,'brand'Filterfrom`brands`table//Fourth:the'brand'filter(from`products`and`brands`databasetables)//WHENthe'brand'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'brand'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!$('.brand').on('click',function(){//selectthe'brand'filterinfilters.blade.phpvarurl=$('#url').val();//fromtheboxinlisting.blade.phppe(which,inturn,includesfilters.blade.phppe)varsort=$('#sortoption:selected').val();//selectthe:selectedelementONLYwhichis:selectedinlisting.blade.php(which,inturn,includesfilters.blade.php)(like'brand_highest','name_z_a',...)///jquery/sel_input_selected.asp//.text()/jquery/html_text.asp//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)varsize=get_filter('size');//getallthe':checked'checkboxes(the'size'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'size'filterlike['small','medium',...]asanARRAY//get_filter()isinfront/js/custom.jsvarcolor=get_filter('color');//getallthe':checked'checkboxes(the'color'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'color'filterlike['red','blue',...]asanARRAY//get_filter()isinfront/js/custom.jsvarprice=get_filter('price');//getallthe':checked'checkboxes(the'price'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'price'filterlike['1000-2000','2000-5000',...]asanARRAY//get_filter()isinfront/js/custom.jsvarbrand=get_filter('brand');//getallthe':checked'checkboxes(the'brand'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'brand'filterlike['Concrete','Adidas',...]asanARRAY//get_filter()isinfront/js/custom.js//WHENthe'brand'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'brand'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varcore=get_filter('core');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varprocessor=get_filter('processor');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varram=get_filter('ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varrom=get_filter('rom');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varnetwork=get_filter('network');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varbattery_capacity=get_filter('battery_capacity');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varproduct_color=get_filter('product_color');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varlaptop_ram=get_filter('laptop_ram');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varhdd=get_filter('hdd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varssd=get_filter('ssd');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js//Anewseparatelooptogetalltheotherremainingfilters'values,alongwiththecurrentjQueryselected'brand'filter//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)varl_display_size=get_filter('l_display_size');//getallthe':checked'checkboxes(the'fabric'filtervalues)infilters.blade.php//getthefiltervaluesarrayof'fabric'filterlike['cotton','polyester',...]asanARRAY//get_filter()isinfront/js/custom.js$.ajax({headers:{'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')},//X-CSRF-TOKEN:larel.com/docs/9.x/csrf#csrf-x-csrf-tokenurl:url,//thiswillhitthelisting()methodinFront/ProductsController.php//e.g./men(thisurlhitstheDynamicRoutesinweb.phpusingaforeachloop('ProductsController@listing'))//checktheweb.phpforthisrouteandchecktheProductsControllerforthelisting()methodmethod:'Post',data:{//WHENthe'brand'FILTER'SFILTERVALUEISCLICKED,SENDTHECLICKED'brand'FILTER'SFILTERVALUESALONGWITHTHEOTHERFILTERS'FILTERVALUESTOO!!(Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js))//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)core:core,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)processor:processor,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ram:ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)rom:rom,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)network:network,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)battery_capacity:battery_capacity,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)product_color:product_color,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)laptop_ram:laptop_ram,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)hdd:hdd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)ssd:ssd,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)//Anewseparatelooptosendalltheotherremainingfilters'valuesintheAJAXcall,alongwithsendingthecurrentjQueryselected'brand'filter'svalues//WehetoloopoverthemainfiltershereAIN,otherwisethe$(.brand)selectorwouldselectthe'brand'filtervaluesONLY,andwouldignorethefiltervaluesofalltheotherfilterse.g.Withouttheforeachloop,itwouldselectthe'brand'filtervalueslike:['Concrete','Adidas']butwouldignoreanotherfilterlike'sleeve'filterandignoreitscheckedvalueslike:['fullsleeve','halfsleeve'].Tip:Removetheforeachloopandchange$filtersto$filterandchecktheconsole(Don'tforgettoconsole.log(filter)insidetheget_filter()functioninfront/js/custom.js)l_display_size:l_display_size,//NotethatfabricisanARRAYofthefiltervalues(like['cotton','polyester',...])ofthe'fabric'filter//sendtheSortingFiltersvalues(sort)alongwiththeDynamicFiltersvalues('fabric'DynamicFiltervalues)url:url,sort:sort,size:size,color:color,price:price,brand:brand},success:function(data){$('.filter_products').html(data);//inlisting.blade.php},error:function(){alert('Error');}});});});