Jump to content

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

Sort By Bestselling Rate Topic   - - - - -

 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 838 posts

Posted 13 June 2019 - 08:55 PM #1

I have a page that displays BestSellers using:

"/index.php?dispatch=products.bestsellers"

Currently the Bestsellers page includes 149 products (selected by script, not admin defined).

 

Is there any way to change the sort order ON THAT PAGE ONLY so it's not sorted by the default sort order, but instead sorted by "Bestselling"?

 

There is no way to change the sort order for a product list other than to set a default value for the entire site. 

 

If I could make just the BestSellers page sort by "Bestselling" then the ACTUAL bestselling products would be at the top of the list and begin descending by their sales volume - which is what one expects to happen when you click a BestSellers link.

 

I'm open to writing modifications to the script but can't seem to riddle out where I add the code.


CS-Cart Ultimate ver 4.11.3


 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1352 posts

Posted 13 June 2019 - 09:40 PM #2

Hello

 

You can sort by popularity without major changes. See the file /app/addons/bestsellers/controllers/frontend/products.post.php
and add the line
 
$params ['sort_by'] = "popularity";
 
after the line $title = __ ("bestsellers");
 
I did not test it
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible


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

Posted 14 June 2019 - 05:38 AM #3

Popularity is not bestsellers. So the correct code will be

$params ['sort_by'] = "bestsellers";
$params ['sort_order'] = "desc";

(!) Not tested


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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 838 posts

Posted 14 June 2019 - 02:25 PM #4

Thank you gentlemen.

The solutions provided worked.

 

 

File: /app/addons/bestsellers/controllers/frontend/products.post.php
 
After the line $title = __ ("bestsellers");
Add the line:
 
$params ['sort_by'] = "bestsellers";
 
(do not include "$params ['sort_by'] = "desc";")

CS-Cart Ultimate ver 4.11.3


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

Posted 17 June 2019 - 05:19 AM #5

 

Thank you gentlemen.

The solutions provided worked.

 

 

File: /app/addons/bestsellers/controllers/frontend/products.post.php
 
After the line $title = __ ("bestsellers");
Add the line:
 
$params ['sort_by'] = "bestsellers";
 
(do not include "$params ['sort_by'] = "desc";")

 

 

I have corrected the code. The second parameter should be called sort_order instead of sort_by


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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Bart-PDX
  • Member
  • Members
  • Join Date: 12-Jun 17
  • 25 posts

Posted 23 October 2020 - 01:36 PM #6

This is a great little hack. I've changed it slightly to work on my On Sale page with the following code:

elseif ($mode == 'on_sale') {
        $title = __('on_sale');
        $params['on_sale'] = true;

	$params ['sort_by'] = "popularity";
        $params ['sort_order'] = "desc";
}

Although this displays how i want if i select a different sort option from the dropdown e.g. Sort Alphabetically the products aren't resorted.

 

Do you know why this might be?

 

I've tried the original code on the Bestsellers page and the same behavior happens.