Randomly results

  • RafaelLuna
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 7 months ago #1989 by RafaelLuna
Randomly results was created by RafaelLuna
Hi,

Is there a way to make the result pages show by "Random" on productfinder?

I saw on another post that it is possible in custom properties

I thank you in advance for your attention to the present request.

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago - 9 years 7 months ago #1991 by andrea_4g
Replied by andrea_4g on topic Randomly results
Having the results randomly sorted defies the purpose of productfinder, that is to have results sorted by score with the most recommended items on top.

Could you please elaborate more?
Last edit: 9 years 7 months ago by andrea_4g.

Please Log in or Create an account to join the conversation.

  • RafaelLuna
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 7 months ago #1992 by RafaelLuna
Replied by RafaelLuna on topic Randomly results
Hi Andrea, Thanks for your quick response.

I'm using productfinder to make a kind of "custom searcher". Let me explain, what i want to do is a little website where you can find recipes. It would be great that you could get only one recipe for each search.

Please excuse my limited English

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago - 9 years 7 months ago #1995 by andrea_4g
Replied by andrea_4g on topic Randomly results
There's a way, but it requires a tiny little modification to the code.

First you need to set questionnares parameters properly.

- Edit your questionnaire *menu item*.
- Set "Results limit" = 1
- Set "Primary order" = Score

This way the questionnaire will sort the results placing the ones with the highest scores at the top, and it will return only 1 result.

Then the add the following line of code to file components/com_productfinder/connectors/articles.php, at line 314
Code:
$order = ' RAND()';

So that the bottom of that function looks like this:
Code:
... case 'hits': $order = 'pfitem_hits DESC'; break; } $order = ' RAND()'; return $order; }
Last edit: 9 years 7 months ago by andrea_4g.

Please Log in or Create an account to join the conversation.

  • RafaelLuna
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 7 months ago #2002 by RafaelLuna
Replied by RafaelLuna on topic Randomly results
Thanks Andrea, working fine now.

Please Log in or Create an account to join the conversation.

Time to create page: 0.137 seconds