- Posts: 1421
- Thank you received: 234
For reference only. Please use a different board for new questions
Adding sort options to the items display
12 years 2 months ago - 10 years 1 month ago #263
by redactie
Adding sort options to the items display was created by redactie
Below is a bit of code that adds sort options to a layout
see : [strike]badmode.co/online/Dames.html[/strike]
This code can be added to any component layout.
Should work for the 1.5 and 2.5 versions. However in version prior 2.5.1417 you must replace the sort=price with sort=Prijs
The sort parameters are not added to the SEF url. This makes it easier for robots to ignore them.
If you are using Non-sef url's on you site you must ensure the ?sort= are replaced with &sort= where necessary
Simply code to add to a component or module, you an use the dynamic classes to highlight the selected option.
With pulldown list
see : [strike]badmode.co/online/Dames.html[/strike]
This code can be added to any component layout.
Should work for the 1.5 and 2.5 versions. However in version prior 2.5.1417 you must replace the sort=price with sort=Prijs
The sort parameters are not added to the SEF url. This makes it easier for robots to ignore them.
If you are using Non-sef url's on you site you must ensure the ?sort= are replaced with &sort= where necessary
Simply code to add to a component or module, you an use the dynamic classes to highlight the selected option.
Code:
echo '<div class="sortbar">';
$s=JRequest::GetVar("sort",'','' );
$o=JRequest::GetVar("order",'','' );
$this_page=JURI::current();
print 'Sort on price <a rel="internal nofollow" class="pa_'.$s.'_'.$o.'" href="'.$this_page.'?sort=price&order=asc">low first</a>';
print ' - <a rel="internal nofollow" class="pd_'.$s.'_'.$o.'" href="'.$this_page.'?sort=price&order=desc">high first</a>';
print ' - <a rel="internal nofollow" class="hd_'.$s.'_'.$o.'" href="'.$this_page.'?sort=hits&order=d">Popular</a>';
print ' - <a rel="internal nofollow" class="ad_'.$s.'_'.$o.'" href="'.$this_page.'?sort=adddate&order=desc">New</a>';
echo '</div>';
With pulldown list
Code:
<ul class="nav">
<?php
#add to component/module or create as module tmpl : sort_custom.php
#for a module this version requires svn:1469. for older version wrap in function
$s=JRequest::GetVar("sort",'','' );
$o=JRequest::GetVar("order",'','' );
$this_page=JURI::current();
$list=array(
''=>'Pick one',
'?sort=price&order=asc'=>'Price Low',
'?sort=price&order=desc'=>'Price High',
'?sort=hits&order=desc'=>'Populair',
'?sort=items_id&order=desc'=>'New'
);
print '<li class="dropdown datamenuli">';
print '<select class="datamenubtn" onchange="if ( this.value.length>0 ) document.location=this.value;return false">';
foreach ( $list as $k => $v ) {
$selected=( "?sort=$s&order=$o" == $k ) ?'selected':'';
print '<option value="'.$this_page.$k.'" '.$selected.'>'.$v.'</option>';
}
?>
</select>
</li></ul>
Last edit: 10 years 1 month ago by redactie.
Please Log in to join the conversation.
12 years 2 months ago #354
by sidewind
Joomla versie: 2.5.28 & 3.4.3
Datafeed component versie: 2.5.2038 & 3.1.2072
www.kledingstunts.nl
www.bestelsuperdeals.nl
test shop: test.superdeals-online.nl
Replied by sidewind on topic Re: Adding sort options to the items display
Bram,
The link doesn't work...
Greetz.
Sander
The link doesn't work...
Greetz.
Sander
Joomla versie: 2.5.28 & 3.4.3
Datafeed component versie: 2.5.2038 & 3.1.2072
www.kledingstunts.nl
www.bestelsuperdeals.nl
test shop: test.superdeals-online.nl
Please Log in to join the conversation.
12 years 2 months ago #355
by redactie
Replied by redactie on topic Re: Adding sort options to the items display
What link? the example page @ badmode.co?
works fine for me
works fine for me
Please Log in to join the conversation.
12 years 2 months ago - 12 years 2 months ago #356
by sidewind
Joomla versie: 2.5.28 & 3.4.3
Datafeed component versie: 2.5.2038 & 3.1.2072
www.kledingstunts.nl
www.bestelsuperdeals.nl
test shop: test.superdeals-online.nl
Replied by sidewind on topic Re: Adding sort options to the items display
Bram,
Yes the example page link. Weird.
I get: De server op www.badmode.co doet er te lang over om te antwoorden.
I want to check where in the layout you put the code.
[strike]Now i put it above the pagination in my default_shop.php
Also under it i can't get it to show.[/strike]
Solved.. is shows up now.
Greetz.
Sander
Yes the example page link. Weird.
I get: De server op www.badmode.co doet er te lang over om te antwoorden.
I want to check where in the layout you put the code.
[strike]Now i put it above the pagination in my default_shop.php
Also under it i can't get it to show.[/strike]
Solved.. is shows up now.
Greetz.
Sander
Joomla versie: 2.5.28 & 3.4.3
Datafeed component versie: 2.5.2038 & 3.1.2072
www.kledingstunts.nl
www.bestelsuperdeals.nl
test shop: test.superdeals-online.nl
Last edit: 12 years 2 months ago by sidewind.
Please Log in to join the conversation.
12 years 1 month ago #429
by Jort
Replied by Jort on topic Re: Adding sort options to the items display
Is it possible to add these options to the mod_datamenu in one selectbox perhaps?
So my first options will be the default data_menu options i have selected in the backend and the last selection is on price, popularity or newest or oldest items.
So my first options will be the default data_menu options i have selected in the backend and the last selection is on price, popularity or newest or oldest items.
Please Log in to join the conversation.
Time to create page: 0.439 seconds