Skip Navigation

[Resolved] Sort by numeric field not working following WP-Types upgrade

This support ticket is created 7 years, 3 months 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 15 replies, has 3 voices.

Last updated by emilyT 7 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#563834
view-screen.png

I am trying to:

I've got a website which has been running Types and Views for some years now. It is an estate agent site, with a view showing property listings sorted by Price, which is a custom numeric field. Up until recently this has worked fine but for the last few months we've found that upgrading the Views plugin breaks the sort order.

I have created a copy of the site to troubleshoot.

Link to a page where the issue can be seen:
The original view can be seen here hidden link
And I've just created a new view with just title and price to see if creating it afresh helped (it didn't): hidden link

I expected to see:
A list of properties sorted by price ascending - so starting with the cheapest.

Instead, I got:
It looks like instead they are displaying chronologically by date of post - starting with the oldest.

#563961

Hello, I see the example you've provided and I would like to help get this working correctly again. Could you please follow these troubleshooting steps first to help pin down the source of the problem?
- Temporarily disable all plugins except Types and Views, then activate a default theme like Twenty Seventeen. If you need to use a plugin like Maintenance Mode to hide the site from users while making your changes that's fine. If the problem is resolved, please reactivate your theme and plugins one by one until the conflict is revealed.
- If the problem was not resolved by deactivating theme and plugins, look for the shortcode that adds this View onto the site in a Content Template or custom Page. Add the attribute cached="off" to the View shortcode and review the results. For example:

[wpv-view name="your-view-slug" cached="off"]

Let me know the results of these tests and we can go from there.

#564621

Hi Christian

Thanks for getting back to me. As I've got a copy of the site to work on I can safely try any troubleshooting without breaking the live site.

I've followed your instructions:
1. The only plugins activated are Types and Views
2. The site is running the Twenty Fifteen theme
3. I've added the cached off to the shortcode:

[wpv-view name="All Properties - by Price" cached="off"]

You can see the results here: hidden link
As you can see the sort order by price field still isn't working.

Thanks again for your help. I'll look forward to your further advice.
Best wishes, Emily

#564824

Okay thanks, the next thing I would like to try is to update the format of your Loop Output code. The preferred syntax now is as follows:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
			<div class="property">
                            ...
                        </div>
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Please update your Loop code to use wpv-items-found and wpv-no-items-found. If this still doesn't fix the sorting, I'll need to take a closer look in wp-admin. Please provide those login credentials in the private reply fields here.

#565199

Hmmm, not seeing anything obviously wrong. I turned on debug mode temporarily and it seems like the sorting settings for this View are being overridden somehow - usually this indicates another plugin or theme file altering queries. That's strange since your other theme and plugins are disabled. I'll create a clone of your site so I can install it locally and run some additional tests. Please stand by and I will update you shortly.

#565214
Screen Shot 2017-08-30 at 9.41.50 AM.png
Screen Shot 2017-08-30 at 9.34.59 AM.png

What can you tell me about the wprc tables and columns in your database? See the attached screenshots.

#565247

Actually, you can disregard that question for now. I need to reach out to my 2nd tier support team for a bit more clarification on this. Everything seems to be set correctly, but your sorting selections are not being respected for some reason I can't quite grasp. Thanks for your patience while I ask for some additional help, please stand by.

#565251

Hi Christian

Thanks for following this up. Let me know if you need me to look at anything.

Best wishes, Emily

#565574

After a bit more investigation, our team has found that some of the Property Fields group data seems to be corrupted in the database, and resaving the Property Fields field group is the reccommended fix. Please go to Toolset > Post Fields and edit the Property Fields field group. Click "Save Field Group" - no changes are required. Then review the results on the front-end. Let me know if the problem is not resolved.

#565791

Hi Christian

Thanks for getting back to me. I've tried resaving the Property Fields as you've suggested, but unfortunately it hasn't made a difference: hidden link

Is there any other way we can fix the corrupted data?

Best wishes, Emily

#566560

Shane
Supporter

Languages: English (English )

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

Hi Emily,

As Christian is currently on vacation, I will be handling his queue.

Since as mentioned the information could be corrupt the best plan to validate this and ensure that its not a bug is to recreate the view from scratch and see if the sorting works there.

Please try this and let me know.
Thanks,
Shane

#566726

Hi Shane

Thanks for taking this on. Now, this is interesting. Before asking for help I had tried creating a new view but it had the same problem.

I've now created another one (just property name and price) and replaced the existing view with it here: hidden link
And that looks like it's working!

So, I'm guessing the answer is resaving the property fields and then creating a new view.

I will see if I can now follow this through and get the live site updated and working as it should. Is it ok if I leave this ticket open for the moment? As soon as I'm confident I've got this sorted I'll update to show it's resolved.

Best wishes, Emily

#566861

Shane
Supporter

Languages: English (English )

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

Hi Emily,

Thanks for updating me on this issue. The ticket will remain open for at least 30 days, however you will get some periodic reminders when an update is needed.

Thanks
Shane

#568707

Just a quick note to keep this open a little longer. I should have finished my testing by the end of the week, so I will close then if successful.

#568797

Shane
Supporter

Languages: English (English )

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

Hi Emily,

Sure just post as soon as you can.

Thanks,
Shane