Skip Navigation

[Resolved] Filtering Archive and Pagination issue

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 60 replies, has 5 voices.

Last updated by Beda 5 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#1149155

Hello,
As you can see here, our "pubblicazioni" custom post type has a custom WP archive, which is correctly distinguishing between the different "tipo" taxonomy, whose possible values are "book" and "game":

hidden link

hidden link

Now, if you look at the filter form on the right of the page, what is shown when clicking on the single search fields are those values only relative to "games" or to "books" and this is fine: we want to preserve this distinction in the query results.

But there is a filtering problem from the pagination, since we only see those values (you can check on "Anno", or "Titolo" etc) that are present in the current page. We want to see ALL the possible cases and not to be limited by pagination.

Pagination is enabled as "manual transition and page reload" and "Which options to display in the form inputs" is set as "Show only available options for each input". We know we could set the later to "Always show all values for inputs", but that would mean losing the archive ability to separate results between "games" and "books", that - as stated above - we need to maintain.

#1149320

We know we could set the later to "Always show all values for inputs", but that would mean losing the archive ability to separate results between "games" and "books", that - as stated above - we need to maintain.
If you choose "Always show all values for inputs" and also add a tipo taxonomy filter in Search and Pagination settings for this WordPress Archive, then you can maintain the ability to separate results between games and books. Check out these two category archives I just created with custom search fields:
https://christiancox-22119-gswt-1.discover-wp.com/category/announcements/
https://christiancox-22119-gswt-1.discover-wp.com/category/featured/

You could use CSS to hide this search field if you don't want to display it to your visitors.

#1149812

Hello,
We tried to:

- Set "Always show all values for inputs"

- Add a "tipo" taxonomy filter in Search and Pagination:

<label>[wpml-string context="wpv-views"]Tipi[/wpml-string]</label>
[wpv-control-post-taxonomy taxonomy="tipo" type="select" url_param="wpv-tipo"]

But now we have values from both Games and Books. As an example, the author "De Rosa Margot" only writes books, but does not produce games, so in "Games" she should not appear.

#1150122
Screen Shot 2018-11-20 at 4.30.42 PM.png

Please look here:
hidden link

In the Autore field, there is no De Rosa Margot ( see the screenshot attached ).

So it seems to be working correctly...am I misunderstanding something?

#1150497

You're right, sorry. We had temporarily re-nabled "Show only available options for each input" and thats means results from the current page.

Now, if you take a look again, we switched back to "Always show all values for inputs". We have results from all the pages, but mingling games and books.

#1150636

Thank you, I understand better now. May I log in to see how you have this WordPress Archive configured? Private reply fields are enabled here.

#1150847

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Elan,

If so since its in the same archive, publications then you've won't be able to enable all the items and then just have it list out the items for the item for which the archive is currently displaying.

This is because its the same taxonomy but different terms so i'm assuming that the posts themselves have these options but some options are not checked based on the taxonomy that is assigned correct?

Thanks,
Shane

#1151305

Hello,
Thanks to both of you, but I'm not sure I'm understanding correctly the last question...

Anyway, if possible, we would prefer to go trough the ticket with a single supporter. Since we started with Christian Cox, would it be a problem if we continued with him? In case, could Christian tell us what he needs to know to proceed with the debugging of the issue?

#1151373

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

You're welcomed to wait, however Christian won't be back until sunday since he is currently on holiday.

Thanks,
Shane

#1153708

Hello,
We're still in need of assistance for this issue. Maybe Christian is back and could continue to guide us?

#1154025

Hi, I'm back and I'll continue working on this. I don't know exactly why this problem is happening, because it's not behaving this way on my own local tests. In my local tests, the results from all pages are reflected in taxonomy select fields. I will create a clone of your site so I can take a closer look, then update you shortly.

#1154071

Sorry, I'm having a difficult time creating a clone of this site. None of my cloning software seems to work well on this server. Is it possible for you to create a database dump file and upload it so I can work from that copy? I will activate private reply fields here so you can share a download link privately.

#1154834

Okay thank you. I imported this database file and saw these SQL errors on import:

[ERROR in query 2791] Table 'studiogiochi_com_wflivetraffichuman' already exists
[ERROR in query 4519] Multiple primary key defined

I ignored those errors and continued my import. Then I installed the latest versions of WPML and Toolset plugins and activated the default Twenty Seventen theme. I went to the game archive URL here:
mytestsite.com/en/pubblicazione/game/
The results are the same as your live site. So I clicked "CERCA" without making any filter selections. The page reloaded, and I am now at this URL:
mytestsite.com/en/pubblicazione/game/?wpv_view_count=19465&wpv_sort_orderby=field-wpcf-pubblicazioni-anno&wpv-tipo=game&wpv-wpcf-pubblicazioni-anno=&wpv-pubblicazione-titolo=0&wpv-pubblicazione-autore=0&wpv-pubblicazione-editore=0&wpv_post_search=&wpv_filter_submit=CERCA
Again, the results are the same as your live site.

Next, I chose the option "Show only available options for each input" and tried the same tests. The game archive URL has the same results, but when I clicked "CERCA" I am shown an error message at the top of the page:

WordPress database error: [Unknown column 'wpml_translations.language_code' in 'where clause']
SELECT s.id, st.status, s.domain_name_context_md5 AS ctx , st.value AS translated, st.mo_string AS mo_string, s.value AS original, s.gettext_context FROM studiogiochi_com_icl_strings s LEFT JOIN studiogiochi_com_icl_string_translations st ON s.id=st.string_id AND st.language='en' AND s.language!='en' WHERE s.context = 'default' LIMIT 1000 OFFSET 5000

I'm not sure if this is a problem related to the two SQL errors, or if it's occurring on your live site as well. Can you tell me if the same error message appears in your live site's logs? If you are not familiar with error logs, I can show you how to activate them temporarily. Go in your wp-config.php file and look for

define('WP_DEBUG', false);

Change it to:

define('WP_DEBUG', true);

Then add these lines, just before it says 'stop editing here':

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');

Then activate the option "Show only available options for each input" for this WordPress Archive. Go to the game archive page and click "CERCA". If the error is thrown on your site, this will create an error_log.txt file in your site's root directory. Please send me its contents. Once that is done, you can revert the changes you made to wp-config.php.

#1155376

Hello and thank you so much!

We enabled debugging and activated that option. This is the error:

"Unknown column 't.language_code' in 'where clause']
SELECT s.id, st.status, s.domain_name_context_md5 AS ctx , st.value AS translated, st.mo_string AS mo_string, s.value AS original, s.gettext_context FROM studiogiochi_com_icl_strings s LEFT JOIN studiogiochi_com_icl_string_translations st ON s.id=st.string_id AND st.language='it' AND s.language!='it' WHERE s.context = 'default' LIMIT 1000 OFFSET 5000"

So I gather it has something to do with WPML.

#1155455

About the errors during the import process, I suppose it's just a temporary issue, since mysqlcheck doesn't report any abnormality.