Patrick64 / reefine

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

has_active_subfilters issues when sub sub filters #3

Closed benoitlemay closed 3 years ago

benoitlemay commented 4 years ago

If you have sub sub filters.. {if has_active_subfilters} WILL BE FALSE{/if} on main parent even if there's a {filters_3} enable.. Ex,: 3 depth sub filters.. ss-reefine ss-reefine1

Patrick64 commented 4 years ago

Thanks, I'll check it out. Are you using a reefine theme or is it in template?

benoitlemay commented 4 years ago

Hi,

I started from a theme.. i can send you my files (file's theme are attached)..  and you can "play" with the live site. .

wpgcanada.com/en/products

Benoit Lemay GriffMédia 418.998.6481

On 2020-10-20 08:17, Patrick Woodcock wrote:

Thanks, I'll check it out. Are you using a reefine theme or is it in template?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Patrick64/reefine/issues/3#issuecomment-712807966, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUKJARBC7DWUNKM2VLHALDSLV5V7ANCNFSM4SWUEDNA.

benoitlemay commented 3 years ago

Any news regarding the problem?

Thanks

Benoit Lemay GriffMédia 418.998.6481

On 2020-10-20 08:17, Patrick Woodcock wrote:

Thanks, I'll check it out. Are you using a reefine theme or is it in template?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Patrick64/reefine/issues/3#issuecomment-712807966, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUKJARBC7DWUNKM2VLHALDSLV5V7ANCNFSM4SWUEDNA.

Patrick64 commented 3 years ago

@benoitlemay Hi. I tried to recreate this but it's working ok for me. Can you post the {exp:reefine} template code you're using?

Patrick64 commented 3 years ago

@benoitlemay Are you sending attachments via email? I don't think they come through on git.hub You'll need to go to the issue here https://github.com/Patrick64/reefine/issues/3

benoitlemay commented 3 years ago

wpg-reefine.zip Sorry.. there's the files.. 1 template and my theme..

Patrick64 commented 3 years ago

@benoitlemay Thanks. The theme looks ok so not sure what's causing it. I couldn't get the theme to work locally though. Can you make an minimal working example and I'll have a look.

Patrick64 commented 3 years ago

One other thing to try - you can switch the theme to "shop" instead and see if the issue is occurring there too.

benoitlemay commented 3 years ago

If i may... Is there a way,when we it the back button of the browser (with the ajax method) to get to the last "state "? I mean the last selected filters.. for now after selecting few filters, when i click the back button I'm sent to the previous page Thanks Benoit Lemay 418.998.6481 On November 3, 2020 10:13:17 Patrick Woodcock notifications@github.com wrote:

@benoitlemay Thanks. The theme looks ok so not sure what's causing it. I couldn't get the theme to work locally though. Can you make an minimal working example and I'll have a look. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Patrick64 commented 3 years ago

Sure. Check out the ajax javascript file in the theme here https://github.com/Patrick64/reefine/blob/master/themes/user/reefine/shop/ajax.js

All it does is add &ajax_request=1 to the url request which will make Reefine just return the content between the {exp:reefine} tags which is then loaded into the div. I imagine if you use window.history.pushState in there you can get it to record the current filters and then watch for a change in state when back button is pressed.

Patrick64 commented 3 years ago

@benoitlemay Did you have any luck with has_active_subfilters issue?

benoitlemay commented 3 years ago

No luck.. i tried to create a new website from scratch.. using no theme and still the same bug.. when you select only a sub-sub category

Rec_20201112 14.26.15.zip And the template code

{exp:reefine 
filter:categorie:type="tree"  
filter:categorie:category_group="1"
channel="chambres"
parse="inward"
url="/{segment_1}/{segment_2}/{categorie}/#reefine"}
<div class="reefine" id="reefine">
    <div role="search"><div class="reefine_search"> {search_groups} {filters}
            <form method="post" class="{filter_active_class}">
                <input type="hidden" name="XID" value="{XID_HASH}" /> <label
                    for="{group_name}">{label}</label> <input type="text"
                    id="{group_name}" name="{group_name}" placeholder="search"
                    value="{filter_title}" title="Search ({filter_quantity})" /> <input
                    type="submit" name="submit" value="Go" />
            </form>
            {/filters} {/search_groups} </div>
        <div class="reefine_sidebar">
            <div class="reefine_active_filters">
                <h3>Selected Criteria</h3>
                <ul>
                    {active_groups}
                    <li><strong><a class="remove-filter"
                            href="{clear_url}">{label}:</a></strong></li> {filters}
                    <li class="{filter_active_class}"
                        aria-selected="{filter_active_boolean}"><a href="{url}">{filter_title}
                            ({filter_quantity})</a></li>
                    <!-- {filter_min_value}{filter_max_value} -->
                    {/filters} {/active_groups}
                </ul>
                <p class="total_entries">{total_entries} items found</p>
            </div>
            <div class="reefine_filters">
                {tree_groups}
            <h6 class="text-uppercase text-spacing-60 group_{group_name} offset-top-10">{label}</h6>
                    <div class="text-subline" ></div>
                <div class="reefine_tree">                  
                    <ul>
                    {filters}
                        <li class="{filter_active_class} filter-id-{filter_id} {has_active_subfilters_class}">
                        <a href="{url}" aria-selected="{filter_active_boolean}" rel="nofollow">{filter_title} ({filter_quantity}) {filter_active_class}  ***<b>{has_active_subfilters_class}</b></a>
                            {subfilters_1}
                            <ul>
                            {filters_1}
                            <li class="{filter_active_class_1} filter-id-{filter_id_1} {has_active_subfilters_class_1}">
                            <a href="{url_1}" aria-selected="{filter_active_boolean_1}" rel="nofollow">{filter_title_1} <b>({filter_active_class_1})</b></a>
                                {subfilters_2}
                                <ul>
                                {filters_2}
                                <li class="{filter_active_class_2} filter-id-{filter_id_2} {has_active_subfilters_class_2}">
                                <a href="{url_2}" aria-selected="{filter_active_boolean_2}" rel="nofollow">{filter_title_2} <b>({filter_active_class_2})</b></a>
                                    {subfilters_3}
                                    <ul>
                                    {filters_3}
                                    <li class="{filter_active_class_3} filter-id-{filter_id_3} {has_active_subfilters_class_3}">
                                    <a href="{url_3}" aria-selected="{filter_active_boolean_3}" rel="nofollow">{filter_title_3} <b>({filter_active_class_3})</b> </a>
                                    </li>
                                    {/filters_3}
                                    </ul>
                                    {/subfilters_3}
                                </li>
                                {/filters_2}
                                </ul>
                                {/subfilters_2}
                            </li>
                            {/filters_1}
                            </ul>
                            {/subfilters_1}
                        </li>
                    {/filters}
                    </ul>
                </div>
            {/tree_groups}
            </div>
        </div>
    </div>
    <div class="reefine_entries" style="display:flex">
        {entries} {if entry_ids=='-1'}
        <p>No matching products found.</p>
        {/if} {exp:channel:entries entry_id="{entry_ids}"
        disable="categories|category_fields|member_data" dynamic="no"
        orderby="title" sort="asc" status="not closed" limit="8"
        paginate="yes"}
        <div class="reefine_product size_{size}" style="    border: 1px solid lightblue; padding: 10px; margin: 10px;">
            <div class="reefine_product_image">             
            </div>
            <div class="reefine_product_caption">
                <a href="#"
                    onclick="alert('You clicked ' + this.textContent);return false;">{title}</a>
                <div class="reefine_product_price">{size} {room_type}<br>{type_lit}</div>
            </div>
            <div class="reefine_product_links">
                <a href="#">Buy Now</a> | <a href="#">Read More</a>
            </div>
        </div>{/exp:channel:entries} {/entries}</div></div>{/exp:reefine}
Patrick64 commented 3 years ago

Thanks, I managed to recreate it so will see if I can find a fix.

benoitlemay commented 3 years ago

Thanks !! Benoit Lemay 418.998.6481 On November 15, 2020 18:15:59 Patrick Woodcock notifications@github.com wrote:

Thanks, I managed to recreate it so will see if I can find a fix. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Patrick64 commented 3 years ago

@benoitlemay I've just pushed a commit that should fix the issue. Let me know if it works or not.

benoitlemay commented 3 years ago

Hi Patrick.. It's better.. but not perfect/consistent.. check my screenshot.. let me know if it's possible to fix this or not.. Reefinev2.zip Many thanks for your time..

Patrick64 commented 3 years ago

@benoitlemay I've made another commit, hopefully this should fix it.

benoitlemay commented 3 years ago

Problem solved!!! Many thanks for your time

Benoit Lemay 418.998.6481 On November 30, 2020 12:51:40 Patrick Woodcock notifications@github.com wrote:

@benoitlemay I've made another commit, hopefully this should fix it. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Patrick64 commented 3 years ago

@benoitlemay Great, thanks for letting me know.