*

Arreff

  • **
  • 9 posts
Random listings and sorting options
« on: October 10, 2022, 03:23:56 PM »
Hi I am using the Sigma Theme and there seems to be some limitations.
Basically I am using Osclass as a sort of private library. so there are no prices, locations or any such thing.
I use the title and my own alphabetized "code" to find item's locations in the real world.

First, I want to remove "Latest Listings" and from the top page show a list of random listings.
How might I do that?

Second, there is only one sorting option for browsing the categories or search results which is "Newly Listed"
I would like to add other sorting parameters such as "sort A to Z" or "sort Z to A" how might I do that?

Cheers.

*

MB Themes

Re: Random listings and sorting options
« Reply #1 on: October 10, 2022, 08:20:34 PM »
@Arreff
1) remove latest - edit main.php in theme folder
2) add sorting - not supported, in world of classifieds such request is irrelevant
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Arreff

  • **
  • 9 posts
Re: Random listings and sorting options
« Reply #2 on: October 11, 2022, 11:16:08 AM »
@Arreff
1) remove latest - edit main.php in theme folder
2) add sorting - not supported, in world of classifieds such request is irrelevant

Hi MB Themes,

1. No such thing "latest" exists int the main.php file of the Sigma theme.

2. Isn't that a bit narrow minded? why shouldn't you be able to sort A to Z or Z to A?
In the world of classifieds, I would think it is very relevant. Would help me to find a very specific classifieds if I was looking for a particular thing alphabetically.
Is it so difficult to do?

*

MB Themes

Re: Random listings and sorting options
« Reply #3 on: October 11, 2022, 03:57:16 PM »
1) Check also header.php for latest items
2) Isn't that a bit narrow minded? why shouldn't you be able to sort A to Z or Z to A? ---> already told you why such feature is not there.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Arreff

  • **
  • 9 posts
Re: Random listings and sorting options
« Reply #4 on: October 12, 2022, 06:29:02 AM »
For anyone who wants to know
1) After doing a word search, "Latest Listings" only exists in two places.

i. osclass\oc-content\themes\sigma\functions.php   AND
ii. osclass\oc-includes\osclass\gui\main.php

But this doesn't solve my question of how to RANDOMIZE listings.
If I change the title that doesn't randomize listings. Someone talked about randomizing premium listings.
From what I read, It wasn't a success. Does anyone else have an idea how this can be done.

2) I have made a work around since MT Themes either doesn't know how to do it or just flat refuses.
I have edited dt_pub_date in the SQL to reflect the alphabetical order by changing the publish date. That's easy enough.

The sort parameters only allow for sort by Newest Listing i.e. iOrderType=desc
There is an 'asc' in the script, but it doesn't reflect in the sort parameters on the site.
Does anyone know why this is and how to fix it?

*

MB Themes

Re: Random listings and sorting options
« Reply #5 on: October 12, 2022, 07:33:47 AM »
It does not show because order by date from oldest does not make sense in classifieds.
Randomization can be done i.e. by doing subquery to get random ids first and then show listings of these ids.
Order by rand() could work.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Arreff

  • **
  • 9 posts
Re: Random listings and sorting options
« Reply #6 on: October 13, 2022, 11:56:44 AM »
Quote
It does not show because order by date from oldest does not make sense in classifieds.
I would say it does. If you can sort by newly added then you should be able to order by oldest.
To me it seems like adding an extra option or <li> code somewhere with iOrderType=asc

Simple logic. But if you don't want to help me, then that is just who you are.
People reading this will understand that.

Quote
Randomization can be done i.e. by doing subquery to get random ids first and then show listings of these ids.
Order by rand() could work.
As I am new to coding (like just the last few days I started), could you possibly give me an example?
And also, in which file would it go?
search.php ? or somewhere else?

Help would be appreciated.

*

Arreff

  • **
  • 9 posts
Re: Random listings and sorting options
« Reply #7 on: October 17, 2022, 04:33:20 AM »
Can anyone give me an example code of how a subquery to get random ids to show these ids by using rand() ?

*

Arreff

  • **
  • 9 posts
Re: Sorting options
« Reply #8 on: October 22, 2022, 05:46:44 AM »
I have figured out how to sort things for listing searches.
The file you need is osclass\oc-includes\osclass\helpers\hSearch.php

line 46 to 60
Code: [Select]
function osc_list_orders() {
  if (osc_price_enabled_at_items()) {
    return osc_apply_filter('search_list_orders', array(
      __('Newly listed') => array('sOrder' => 'dt_pub_date', 'iOrderType' => 'desc'),
      __('Lower price first') => array('sOrder' => 'i_price', 'iOrderType' => 'asc'),
      __('Higher price first') => array('sOrder' => 'i_price', 'iOrderType' => 'desc')
    ));
  }
  else {
    return osc_apply_filter('search_list_orders', array(
      __('Newly listed') => array('sOrder' => 'dt_pub_date', 'iOrderType' => 'desc')
    ));
  }
}

you can add code
Code: [Select]
__('Oldest listing') => array('sOrder' => 'dt_pub_date', 'iOrderType' => 'asc')
after both
Code: [Select]
__('Newly listed') => array('sOrder' => 'dt_pub_date', 'iOrderType' => 'desc')
and you can probably add other sorting options by changing the dt_pub_date

asc is for ascending and desc is for descending.

Why MB Themes refused to suggest this is beyond me, but at least everyone knows where the sorting options are.



*

MB Themes

Re: Random listings and sorting options
« Reply #9 on: October 22, 2022, 09:51:56 AM »
@Arreff
Because we never suggest modifications in core.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Arreff

  • **
  • 9 posts
Re: Random listings and sorting options
« Reply #10 on: October 22, 2022, 03:52:24 PM »
@MB Themes
Something you could have suggested from the beginning?