*

p206ab

  • **
  • 9 posts
Show sold listings last
« on: November 06, 2021, 10:41:53 AM »
Hello,

I would like to keep listings marked as sold in the categories, but not to disturb visitors, I would like to show them at the end, behind all active ads.
Anyone knows where the sorting function is? I'm using Beta theme, which has a separate table for sold column.

Thanks in advance.
Best regards

*

MB Themes

Re: Show sold listings last
« Reply #1 on: November 06, 2021, 06:38:05 PM »
I do not think you will be able to do like universal solution that would work with other sort options.
Only one that comes to my mind is to change it in default sorting only
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

osclassic

  • ***
  • 34 posts
Re: Show sold listings last
« Reply #2 on: November 06, 2021, 11:03:06 PM »
I have thought about this for a long time too to keep sold listings and shown them at the end of pages, and would be interested in some way to accomplish this.

*

MB Themes

Re: Show sold listings last
« Reply #3 on: November 08, 2021, 11:00:32 AM »
I would try something like this (it is for Delta theme):
Code: [Select]
function mb_sort_by_premium() {
  Search::newInstance()->addJoinTable( DB_TABLE_PREFIX.'t_item_delta.fk_i_item_id', DB_TABLE_PREFIX.'t_item_delta', DB_TABLE_PREFIX.'t_item.pk_i_id = '.DB_TABLE_PREFIX.'t_item_delta.fk_i_item_id', 'LEFT OUTER' );
  Search::newInstance()->order(sprintf("coalesce(%st_item_delta.i_sold, 0) ASC, dt_pub_date DESC", DB_TABLE_PREFIX), '');
}

if(Params::getParam('sOrder') == '') {
  osc_add_hook('search_conditions', 'mb_sort_by_premium');
}
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots