Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Query Question Rate Topic   - - - - -

 

Posted 13 November 2019 - 11:32 AM #1

hi, i have question about query..

i want sorting product by average rating...

function for get average rating:

fn_discussion_get_average_object_rating($object_id, $object_type)

how change fn_get_product_data for sort by average rating?



 

Posted 13 November 2019 - 11:36 AM #2

i want sort product by average rating in category product page..



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19855 posts

Posted 13 November 2019 - 01:11 PM #3

There is no easy way to do it. It is required to create quite complex sql request when products are retrieved from database


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 

Posted 13 November 2019 - 01:44 PM #4

There is no easy way to do it. It is required to create quite complex sql request when products are retrieved from database

hi, tanks for answer

 

I did this after receiving the product ...
Products are stored in the array and have a key named average_rating.
I did this using sort array functions.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19855 posts

Posted 14 November 2019 - 05:50 AM #5

 

hi, tanks for answer

 

I did this after receiving the product ...
Products are stored in the array and have a key named average_rating.
I did this using sort array functions.

 

 

But it will not work with pagination


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11429 posts

Posted 15 November 2019 - 05:07 AM #6

Use the 'get_products' modify the fields and the sorting.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.