*

Miller

  • ****
  • 141 posts
premium ads random not working
« on: March 20, 2019, 12:46:33 PM »
premium ads are displayed in random order in search results

after install cache plugin not working premium ads random

How to solve this?

function cust_all_premiums_ontop_random() {
    $mSearch =  Search::newInstance();
    $query_elements = (array) json_decode($mSearch->toJson());

    $mSearch->addField(sprintf("(SELECT RAND() FROM %st_item i2 WHERE %st_item.pk_i_id = i2.pk_i_id AND %st_item.b_premium = 1) AS rand_premiums",  DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX));
    $mSearch->order("rand_premiums DESC, " . $query_elements['order_column'], $query_elements['order_direction']);
}

osc_add_hook('search_conditions', 'cust_all_premiums_ontop_random');

*

MB Themes

Re: premium ads random not working
« Reply #1 on: March 20, 2019, 12:54:03 PM »
@Miller
They cannot as you want to cache :)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Miller

  • ****
  • 141 posts
Re: premium ads random not working
« Reply #2 on: March 20, 2019, 02:58:05 PM »
I want to work premium ads randomly

*

MB Themes

Re: premium ads random not working
« Reply #3 on: March 20, 2019, 03:00:02 PM »
@Miller
Then disable cache, but even that I am not sure if premium loop is shuffling premium listings.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots