Skip to main content
For reference only. Please use a different board for new questions

Adding sort options to the items display

More
11 years 11 months ago #685 by redactie
are you sure you are doing your math right?

now you sort on the difference in value

so 50-45= 5 euro ( 10%) is more then 2-1=1 euro ( 50% )

Please Log in to join the conversation.

More
11 years 11 months ago #686 by godfather
after the first try.. i wrote this in the callback
Code:
if ( $item['Prijs'] && $item['menu_7'] ) { $defirenz= $item['menu_7']-$item['Prijs']; $anteil= ($defirenz / $item['Select7']); $prozent= round($anteil * 100 ); $item['menu_6']= $prozent; }

it stil sorting it not in right way :(..
thank u

Please Log in to join the conversation.

More
11 years 11 months ago #690 by redactie
There are two typos in your script 'Prijs' should be 'prijs' and 'Select7' should be 'menu_7'

(I apologize for the inconsistent naming, can't change that anymore)

another issue is that the database field is a string, and there for sorting is string based and the string '8' > the string '10'.
This can be solved by either changing the type of the field in the database or the pad zero's:
Code:
$item['menu_6']= sprintf("%02d",$prozent);

final issue will be that the joomla paginition is not aware of the sort en order options. And the component will not add the neither ( intentionally)

use docs.joomla.org/Understanding_Output_Ove...tion_Links_Overrides to override
Code:
<?php global $sortstring; if ( $s=JRequest::getVar('sort','') && $o=JRequest::getVar('order','') ) { #you might need to change the link below $sortstring='&amp;sort='.$s.'&amp;order='.$o; } function pagination_item_active(&$item) { global $sortstring; return "<a href=\"".$item->link.$sortstring."\" title=\"".$item->text."\">".$item->text."</a>"; } function pagination_item_inactive(&$item) { return "<span>".$item->text."</span>"; }

Please Log in to join the conversation.

More
11 years 11 months ago #713 by Soener
Hi friends,

if i add the sort options, the xml sitemap feature didn't work anymore. Google said: "Unsupported file format" and firefox show the lines with the sort option code.

How can this be fixed?

Please Log in to join the conversation.

More
11 years 11 months ago #716 by redactie
sorry,


how en where do you add the sort options? THe xmlmap can't be sorted ( but shoudn't produce errors neither)

Please Log in to join the conversation.

More
11 years 11 months ago - 11 years 11 months ago #718 by Soener
i've added the sort code in the xhelpers.php and it shows up in the datafeeds without problems.
Only the sitmap creation filas with an error in google webmastertools and at browsers.
If i delete the sort option code at the xhelpers, sitemap creation works fine.

Im on joomla 2.5.3 and datafeeds svn 2.5.1517, with joomla built in seo url on and use modrewrite.
Last edit: 11 years 11 months ago by Soener.

Please Log in to join the conversation.

Time to create page: 0.410 seconds