$query error in popular products function

Hi,
I've been pulling my hair out trying to figure out why my popular products were not displaying total sales count descending. It seemed to be somewhat random.

I found this code in template_functions.php => mp_popular_products:

The custom query has this parameter to order the display of popular products: &orderby=meta_value, where mp_sales_count => meta_value.

After researching the wp codex I found this: https://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters

I changed order by to &orderby=meta_value_num

My popular products are now properly displaying most sales descending.

Is there another cause for this display order issue?

Thought I would pass it on for explanation and possible fix in a future release.

Merv (lzw8bk)

  • Vaughan
    • Support/SLS MockingJay

    Hi @lzw8bk

    thanks for posting on the forum.

    I am not sure of another way, But I will flag the developer for some feedback & to make him aware of this fix.

    Thanks for the information, If you require any further assistance, please let us know.

    also, is that an amateur radio callsign? LZW8BK?

    thanks.

  • lzw8bk
    • WPMU DEV Initiate

    Thanks Vaughn
    Not a call sign. My first user id from the corp I worked for back in the mid 1980's. Kept it for historic and sentimental reasons and automatic on the keyboard for many years. One more thing I don't have to think about.

    Look forward to developer feedback on the finding.
    Merv (lzw8bk)

    PS: Lots of points for debugging are appreciated!!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.