This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

questions

  • *****
  • 319 posts
Premium items order on homepage
« on: March 08, 2023, 08:12:08 AM »
Dear all

The premium items on home-page are show as follows - 12 items in this order

item 10 days ago, item 9 days ago, item 5 days ago, item 2 days ago, item 1 day ago

How can I make them to be shown in this order?

item 1 day ago, item 2 days ago, item 5 days ago, item 9 days ago, item 10 days ago?

Any other options than this available please?

Thank you,

*

MB Themes

Re: Premium items order on homepage
« Reply #1 on: March 08, 2023, 12:43:41 PM »
It was discussed once how it is shown, premium items are sorted by date descending, if they have same number of premium views.
What you need is PHP approach to reverse array before it is used (array_reverse)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

questions

  • *****
  • 319 posts
Re: Premium items order on homepage
« Reply #2 on: March 08, 2023, 01:13:49 PM »
It was discussed once how it is shown, premium items are sorted by date descending, if they have same number of premium views.
What you need is PHP approach to reverse array before it is used (array_reverse)


How can this be done?
What needs to be edited?

Thank you

*

MB Themes

Re: Premium items order on homepage
« Reply #3 on: March 08, 2023, 01:19:08 PM »
Well you want to do that so you start and ask if there is problem.
https://www.w3schools.com/php/func_array_reverse.asp
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

questions

  • *****
  • 319 posts
Re: Premium items order on homepage
« Reply #4 on: March 08, 2023, 03:20:48 PM »
No idea, what should I modify and where? In main.php? Can you help please if it's not more than 1-2 lines to edit?

If it is, it is. No problem at all.

Thank you,

Marked as best answer by questions on March 10, 2023, 08:31:51 AM
*

MB Themes

Re: Premium items order on homepage
« Reply #5 on: March 09, 2023, 03:46:32 PM »
You have this code in main.php:
Code: [Select]
$premium_items = eps_premium_items(eps_param('premium_home_count') - $has_day_offer, @$day_offer['pk_i_id']);
and you need to add below it something like:
Code: [Select]
$premium_items = array_reverse($premium_items);
But I have no idea how it works on multidimensional arrays.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

questions

  • *****
  • 319 posts
Re: Premium items order on homepage
« Reply #6 on: March 10, 2023, 08:32:31 AM »
You have this code in main.php:
Code: [Select]
$premium_items = eps_premium_items(eps_param('premium_home_count') - $has_day_offer, @$day_offer['pk_i_id']);
and you need to add below it something like:
Code: [Select]
$premium_items = array_reverse($premium_items);
But I have no idea how it works on multidimensional arrays.

It does its job perfectly without errors from the first to the last, starting with the offer of the day ahead.

Can you UPDATE? :)

*

MB Themes

Re: Premium items order on homepage
« Reply #7 on: March 10, 2023, 10:16:32 AM »
Cool  :P
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots