Patrick64 / reefine

ExpressionEngine addon that filters and searches entries
MIT License
5 stars 1 forks source link

Refinee not working with dropdown pricing #7

Closed bijendraps closed 2 years ago

bijendraps commented 2 years ago

We are using refinee module and our requirement is that we want to Search in field by dropdown manner like in price field

We want to give value in a range in the dropdown(1-200, 201-300).

So please let me know how we can achieve this and send me the code.

Patrick64 commented 2 years ago

So you want to create a select and add some javascript that submits the range in a form. You can do something like this (note this code is untested)

{number_range_groups}  
<h3 class="group_{group_name}">{label}</h3>  
{filters}  

<form method="post" class="number_range" >  
<input type="hidden" name="XID" value="{XID_HASH}" />  
<input type="hidden"  id="{group_name}_min" name="{group_name}_min" value="0"/>
<input type="hidden"  id="{group_name}_max" name="{group_name}_max" value="100"/>
<select onchange="a=JSON.parse(this.value);document.getElementById('{group_name}_min').value = a[0];document.getElementById('{group_name}_max').value = a[1];this.form.submit()">
    <option value="['','']">Any Price</option>
    {if filter_min_value < 100}
    <option value="[0,100]" {if filter_max==100}selected{/if}>$0-100</option>
    {/if}
    {if filter_min_value < 200 and filter_max_value > 100}
    <option value="[100,200]"  {if filter_max==200}selected{/if}>$100-200</option>
    {/if}
    {if filter_min_value < 300 and filter_max_value > 200}
    <option value="[200,300]"  {if filter_max==300}selected{/if}>$200-300</option>
    {/if}
</select>
</form>  

{/filters}  

{/number_range_groups}  
bijendraps commented 2 years ago

Ok thanks Patrick I will look it

From: Patrick Woodcock @.*** Sent: Friday, March 4, 2022 8:01 PM To: Patrick64/reefine Cc: Bijendra Singh; Author Subject: Re: [Patrick64/reefine] Refinee not working with dropdown pricing (Issue #7)

So you want to create a select and add some javascript that submits the range in a form. You can do something like this (note this code is untested)

{number_range_groups}

{label}

{filters}

{/filters}

{/number_range_groups}

— Reply to this email directly, view https://github.com/Patrick64/reefine/issues/7#issuecomment-1059211455 it on GitHub, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBJT7DCW2DZAWMUBHLC76TU6INBFANCNFSM5O5OUNTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ABBJT7GFSXS4NZZA2E4B35TU6INBFA5CNFSM5O5OUNTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOH4RERPY.gif Message ID: @.***>

Patrick64 commented 2 years ago

I just updated the code above to add selected on the options so it selects the correct item on load

bijendraps commented 2 years ago

OK

From: Patrick Woodcock @.*** Sent: Saturday, March 5, 2022 4:41 PM To: Patrick64/reefine Cc: Bijendra Singh; Author Subject: Re: [Patrick64/reefine] Refinee not working with dropdown pricing (Issue #7)

I just updated the code above to add selected on the options so it selects the correct item on load

— Reply to this email directly, view https://github.com/Patrick64/reefine/issues/7#issuecomment-1059744428 it on GitHub, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBJT7HC2HEN43U6OWIWBGDU6M6OBANCNFSM5O5OUNTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ABBJT7GX6GIF2WN26WXCHRLU6M6OBA5CNFSM5O5OUNTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOH4VGVLA.gif Message ID: @.***>