In my component am using a router to handle my sef url's and am having trouble with a paginated list generated by the component. JPagination (JRoute) is getting the SEF path segments out of order for the page links.
For the form tag containing the pagination I have the following:
<form name="search_form" id="search_form" action='index.php?option=com_chimneypots&task=admin.showAgentsSellersProperties&Itemid=526' method="POST" >
I am also using a custom router that looks like this:
function chimneypotsBuildRoute(&$query) {
$segments = array();
// we use sub controllers extensively in com_chimneypots so no need to check for controller,
//it will be part of the task string. Put the task string first
$i = 2;
foreach ($query as $param => $value ) {
if ($param == 'option' ) {
list($tmp, $component_name) = explode('_',$query['option']);
$segments[0] = $component_name;
unset ($query['option']);
} elseif ($param == 'task' ) {
$segments[1] = $query['task'];
unset ($query['task']);
} else {
$segments[$i] = "{$param},{$value}";
$i++;
unset ($query[$param]);
}
}
return $segments;
}
function chimneypotsParseRoute($segments) {
$query = array();
// The first segment should be the task, the rest we'll decode
$query['task'] = $segments[0];
unset($segments[0]);
$num_segments = count($segments);
for ($i=1; $i <= $num_segments; $i++) {
list($parm, $value) = explode(',', $segments[$i]);
$query[$parm] = $value;
}
for ($i=1; $i <= $num_segments; $i++) {
unset($segments[$i]);
}
return $query;
}
The problem I am having is that when pagination->getListFooter() is run at the bottom of my form, it doesn't appear to be calling my router which would get the segments in the correct order. Instead it generates the path:
"/index.php/component/chimneypots/Itemid,526/adminAgentSeller.showAgentSellersProperties".
I can see the incorrect path being generated at the point show in the call stack

Just after executing line 649 I can see the "out or order" sef link in $data->all->link:

In the generated link "/index.php/component/chimneypots/Itemid,526/adminAgentSeller.showAgentSellersProperties", the segment "Itemid,526" should come after "adminAgentSeller.showAgentSellersProperties".
Should JRoute be calling chimneypotsBuildRoute to build the URL or am I doing something wrong?
TIA,
Nick