Sorting not working on WooCommerce products (2.4.2)
-
Hi –
Noticed today that the sorting appeared to be no longer working. Using the plugin (2.4.2) to sort/reorder products within categories on my WooCommerce store. Spent ages testing locally and online. Starting looking at template and WooCommerce files to see how WooCommerce creates it’s loops…
Anyhow, downgrading to an older version of the reorder plugin (randomly downgraded to 2.1.1) fixed the issue.
Just thought I’d mention this in case it helps. Otherwise love the plugin, it’s super useful!
Thanks
- This topic was modified 4 years, 11 months ago by tictok.
-
Anyhow, downgrading to an older version of the reorder plugin (randomly downgraded to 2.1.1) fixed the issue.
that’s really odd. Could you provide me with some clues?
I am wroking on a WooCommerce project right now, so when I get a change I will test the plugin on the products page to see if I can reproduce this issue.
Hi there,
Sorry – not really much more info I can give you.
Updated my plugins, including yours, and noticed the re-ordering wasn’t working on the front end. In WP admin, the plugin appeared to be working fine, but the re-order didn’t appear on the front of my site. I used the options in your plugin to reset and delete old re-ordering etc and tried again, but it still didn’t work. Removing and re-installing the plugin didn’t help either. Turned off and reset site caching but that didn’t make any difference.
I tried both locally (NGINX) and on live server (Litespeed) but the problem appeared on both. I only use your plugin to re-order woo products within categories, so don’t know if the issue affects other post types too.
Not 100% sure if the issue was caused by the newest update, or if it was already problematic (i.e. could’ve already been broken).
I read your notes about how the re-order plugin doesn’t work if the query uses a non standard loop (e.g. get_posts), so checked things my end. I’m using my own theme, but it uses the standard WooCommerce template parts and loop for product archives.
For my store, as it’s quite important that products are displayed in a specific order within different categories, so as a temp fix decided to roll back to an older version of your plugin which worked. (In this case 2.1.1, although admit there are probably newer 2.1.x versions that work –?will try later and report back).
Not much new info there, but haven’t tried to troubleshoot any further.
Happy to help if I can.
Thanks
noticed the re-ordering wasn’t working on the front end.
the ony way this can happen is if the product retrieval is using get_posts() function which by default has its parameter suppress_filters set to true. THis will preent the plugin from hooking into the query process and reordering your retrieved posts.
the suppress_filter should be set to false in custom queries that use get_posts().
I read your notes about how the re-order plugin doesn’t work if the query uses a non standard loop (e.g. get_posts), so checked things my end. I’m using my own theme, but it uses the standard WooCommerce template parts and loop for product archives.
so if no get_posts() are used, then the next possible issue is the query itself. There was a small chnage to front-end query SQL in v2.2.1.
If you open the file,
wp-content/plugins/ReOrder-posts-within-categories/public/class-reorder-post-within-categories-public.php
and scroll to the line 120, you will see
$args .= "LEFT JOIN {$wpdb->postmeta} AS rankpm ON {$wpdb->posts}.ID = rankpm.post_id ";
can you change the line and remove the word LEFT, so that the line is,
$args .= "JOIN {$wpdb->postmeta} AS rankpm ON {$wpdb->posts}.ID = rankpm.post_id ";
and let me know if that fixes your frnot-end ordering
Hi – Further info and a few things I’ve learnt, just in case it helps:
I just setup a clean install of WP 5.3.2 and WooCommerce 3.8.1 running the default Twenty Twenty theme.
The only other plugin running apart from WooCommerce is your ‘ReOrder Posts within Categories’ plugin. Nothing else at all.
I next imported the sample WooCommerce product data so that there’s some products to test with.
In the admin there was a notice about ‘First of all, you need to save your settings for Re-order Posts in Categories…‘ However clicking the link shows the error message: ‘Sorry, you are not allowed to access this page‘. The notice disappears after navigating to your plugin settings via the Settings menu.
Initially, the most up to date version of your plugin didn’t do anything (didn’t change the order).
I downgraded incrementally through several versions of your plugin (resetting each time) until things worked as expected… all the way back to 2.2.1
I then started upgrading incrementally back up through the newer versions back up to 2.4.2
Things appeared to be work okay. HOWEVER, this was short lived.
I soon discovered that if ‘Product categories’ is not checked/ticked within your plugin settings, zero products are displayed when viewing a category on the front-end. (‘No products were found matching your selection.‘ is displayed instead).Only when ‘Product Categories’ is checked AND I have then navigated to the ‘Manually rant your “Products”‘ screen for the specific category (in this case ‘Accessories’) do any products appear within a category on the front end.
At this point re-ordering appears to work fine, both within the admin and for products displayed within the Accessorie category on the front-end.
HOWEVER, it only appears to work for a single category. Later selecting a different product category from the plugin dropdown (e.g. ‘Hoodies’ category), and re-ordering those products makes no difference to how the products within the ‘Hoodies’ categories are displayed on the front-end. The custom re-ording for the original ‘Accessories’ category remains intact.
So, things appear to be a bit glitchy in more recent versions of the plugin. In at least the latest version I can only re-order products in a single product category. Attempting to re-order products in other categories doesn’t work.
If you are trying to replicate, the category names I’ve mentioned are from the sample woocommerce product data.
Hope that helps a little if you
// EDIT – sorry, posted at the same time as you. Will reply after testing your suggestion about, although please read my notes above a fresh / default installation. Thanks
ok, that’s interesting, thanks for the detailed feedback I will run some tests of my own and come back to you on this.
can you change the line and remove the word LEFT, so that the line is,
$args .= “JOIN {$wpdb->postmeta} AS rankpm ON {$wpdb->posts}.ID = rankpm.post_id “;
and let me know if that fixes your frnot-end orderingSorry – I tried this, but doesn’t fix the issue.
As I’m trying to give you as much info as I can:
Further testing at my end (with a fresh WooCommerce with sample products, clean WordPress) seems to show that only the first product category can be sorted.
The plugin appears to have no affect on further product categories and the order of products within a category shown in the plugin admin doesn’t reflect the order on the front end (even before trying to custom re-order).
I’ve only tested with Woo products, so have no idea about other post-types.
Cheers
Further testing at my end (with a fresh WooCommerce with sample products, clean WordPress) seems to show that only the first product category can be sorted.
yes, I now better understand your issue, however, is this custom taxonomy being properly sorted when you downgrade to v2.1.1?
The plugin appears to have no affect on further product categories and the order of products within a category shown in the plugin admin doesn’t reflect the order on the front end (even before trying to custom re-order).
how do you query the custom taxonomy?
I’m using my own theme, but it uses the standard WooCommerce template parts and loop for product archives.
what standard tempalte part are you refferring to?
how do you query the custom taxonomy?
what standard tempalte part are you refferring to?
No custom queries or taxonomies on my part – just the product loop and templates that WooCommerce uses by default.
It’s a clean WP and Woo install using TwentyTwenty. (i.e no custom code, templates, functions or anything).
yes, I now better understand your issue, however, is this custom taxonomy being properly sorted when you downgrade to v2.1.1?
Not a custom taxonomy –?well, I guess technically it is, but it’s nothing I’ve added as it’s the default WooCommerce product category.
However yes, I’ve just re-tested, re-installed 2.1.1, pushed the button to delete all previous sorting data, re-ordered items and the sorting works just fine in 2.1.1
Not a custom taxonomy – well, I guess technically it is, but it’s nothing I’ve added as it’s the default WooCommerce product category.
HOWEVER, it only appears to work for a single category. Later selecting a different product category from the plugin dropdown
so you’re talking about a different category term, not a different category!
Have you made sure you selected ‘yes’ for the manual ranking of your the category term that is not working? By default it is ‘no’ and this would allow you to rank your products in the dashabord but the front-end would not show your manual ranking.
so you’re talking about a different category term, not a different category!
Yes, sorry, should’ve probably me more accurate describing the taxonomies and terms.
Have you made sure you selected ‘yes’ for the manual ranking of your the category term that is not working? By default it is ‘no’ and this would allow you to rank your products in the dashabord but the front-end would not show your manual ranking.
Yes, I’d spotted the default was ‘No’. Checked and double checked that I selected ‘yes’.
Tell you what, if it helps, my test install was hosted locally so I’ve put it online somewhere and will pass you the admin details. You can see for yourself. Will send you a message once the DNS has propagated.
Many thanks
Tell you what, if it helps, my test install was hosted locally so I’ve put it online somewhere and will pass you the admin details. You can see for yourself. Will send you a message once the DNS has propagated.
oh good. Send me the details to vrata at syllogic dot in
Hi Aurovrata,
We are having a similar issue after upgrading WP to 5.3.2. On this site we have a custom post type category being reordered: https://nelsenpartners.com/?project_type=entertainment#portfolio. You can sort by project type, those are the categories. Here is a screenshot of the backend: https://www.dropbox.com/s/8x7oc1tejlkjhcj/screen%20shot%202019-12-19%20at%2010.57.21%20am.jpg?dl=0
I did the LEFT JOIN fix and also did not have success. Thanks so much for your help.dear @bistrostudio, its very important that each user start their thread in the support forum as your issue may not be related even if the symptoms appear the same.
So please post your issue on a different thread, thank you.
Several bugs fixes pertaining to WooCommerce setups where made in recent releases and having not heard back from you, I am assuming this issue now resolved.
I watch 3 video the instructions are the same. Seems to be an easy process but not working for me. I go to product category then click on the number then select sort I can move my products around with these. Then the video says refresh your website and see the new products rearranged. Mine are in the old order. I’m not seeing a saved or publish button? How do I make it stick? Thank you
- The topic ‘Sorting not working on WooCommerce products (2.4.2)’ is closed to new replies.