- Posts: 15
- Thank you received: 0
Show results randomly?
- crashtackle
- Topic Author
- Offline
- New Member
Less
More
10 years 8 months ago #1772
by crashtackle
Show results randomly? was created by crashtackle
Please Log in or Create an account to join the conversation.
- andrea_4g
- Offline
- Administrator
Less
More
- Posts: 1122
- Thank you received: 163
10 years 8 months ago #1773
by andrea_4g
Replied by andrea_4g on topic Show results randomly?
There's not such an option, but...
it's fairly easy to implement.
Edit file components/com_customproperties/models/search.php
Change lines 572-576 from:
to
You also need to set parameter 'Section / Category ordering:' = None, in Custom Properties configuration.
it's fairly easy to implement.
Edit file components/com_customproperties/models/search.php
Change lines 572-576 from:
Code:
switch($ordering){
case 'category' :
...
Code:
$ordering = 'random';
switch($ordering){
case 'random':
$orderstr[] = 'RAND()';
break;
case 'category' :
...
You also need to set parameter 'Section / Category ordering:' = None, in Custom Properties configuration.
Please Log in or Create an account to join the conversation.
- crashtackle
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
10 years 8 months ago #1774
by crashtackle
Replied by crashtackle on topic Show results randomly?
Works great...
Except now the drop downs for 'Alphabetically' 'Newest' and 'oldest' etc also show randomly...
Except now the drop downs for 'Alphabetically' 'Newest' and 'oldest' etc also show randomly...
Please Log in or Create an account to join the conversation.
- andrea_4g
- Offline
- Administrator
Less
More
- Posts: 1122
- Thank you received: 163
10 years 8 months ago #1775
by andrea_4g
Replied by andrea_4g on topic Show results randomly?
You can either:
- disable the Ordering dropdown (there's a set parameter in CP Config to modify the search header elements)
- keep on tweaking Custom Properties
If you choose the latter, here's what to do:
- edit components/com_customproperties/views/show/tmpl/default.php (**)
- change lines
from
to
(**) or write your own override, based of default.php
- disable the Ordering dropdown (there's a set parameter in CP Config to modify the search header elements)
- keep on tweaking Custom Properties
If you choose the latter, here's what to do:
- edit components/com_customproperties/views/show/tmpl/default.php (**)
- change lines
from
Code:
$orders = array(
JHTML::_('select.option', 'newest', JText::_('Newest First')),
JHTML::_('select.option', 'oldest', JText::_('Oldest First')),
JHTML::_('select.option', 'alpha', JText::_('Alphabetical')),
JHTML::_('select.option', 'ordering', JText::_('Ordering')),
JHTML::_('select.option', 'category', JText::_('Section/Category'))
);
Code:
$orders = array(
JHTML::_('select.option', 'random', JText::_('Random')),
JHTML::_('select.option', 'newest', JText::_('Newest First')),
JHTML::_('select.option', 'oldest', JText::_('Oldest First')),
JHTML::_('select.option', 'alpha', JText::_('Alphabetical')),
JHTML::_('select.option', 'ordering', JText::_('Ordering')),
JHTML::_('select.option', 'category', JText::_('Section/Category'))
);
(**) or write your own override, based of default.php
Please Log in or Create an account to join the conversation.
- crashtackle
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
10 years 8 months ago #1776
by crashtackle
Replied by crashtackle on topic Show results randomly?
Please Log in or Create an account to join the conversation.
- andrea_4g
- Offline
- Administrator
Less
More
- Posts: 1122
- Thank you received: 163
10 years 8 months ago #1777
by andrea_4g
Replied by andrea_4g on topic Show results randomly?
True that.
You need to undo the modifications in search.php I previously suggested, and apply the following.
Change line 599
from
to
You also need to set 'Default results ordering' = None, in Custom Properties config.
You need to undo the modifications in search.php I previously suggested, and apply the following.
Change line 599
from
Code:
case 'newest':
default:
$orderstr[] = "c.".$ce->created." DESC";
break;
Code:
case 'newest':
$orderstr[] = "c.".$ce->created." DESC";
break;
case 'random':
default:
$orderstr[] = 'RAND()';
break;
You also need to set 'Default results ordering' = None, in Custom Properties config.
Please Log in or Create an account to join the conversation.
Time to create page: 0.293 seconds