Skip to content

Commit

Permalink
[joomla#28081] Smart Search Results Page Displays Wrong Modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed May 24, 2013
1 parent 25c33a7 commit 45b824e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
1 change: 1 addition & 0 deletions installation/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $ -> Language fix or change
#$ [#30994] Untranslated String. Thanks Jean-Marie Simonet
# [#30974] Fix offline overflow image. Thanks Angelika Reisiger
#$ [#31001] *Missing lang string for Protostar. Thanks Jean-Marie Simonet
#$ [#28081] Smart Search Results Page Displays Wrong Modules

24-May-2013 Jean-Marie Simonet
# [#30689] jQuery not loaded in Isis error page. Thanks Dennis Hermatski
Expand Down
2 changes: 2 additions & 0 deletions language/en-GB/en-GB.mod_finder.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_DESCRIPTION="The width of the search fie
MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_LABEL="Search Field Size"
MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_DESCRIPTION="The position of the search label relative to the search field."
MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_LABEL="Label Position"
MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_DESCRIPTION="Assign an ItemID for the display of the search results if there is no com_finder menu and a specific display is desired. The ItemId may be chosen among those available through the Menu Manager. If you do not know what this means, you may not need it."
MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_LABEL="Set ItemID"
MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_DESCRIPTION="Toggle whether a button should be displayed for the search form."
MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_LABEL="Search Button"
MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_DESCRIPTION="Toggle whether a label should be displayed for the search field."
Expand Down
24 changes: 13 additions & 11 deletions modules/mod_finder/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ class ModFinderHelper
* Method to get hidden input fields for a get form so that control variables
* are not lost upon form submission.
*
* @param string $route The route to the page. [optional]
* @param string $route The route to the page. [optional]
* @param integer $paramItem The menu item ID. (@since 3.1) [optional]
*
* @return string A string of hidden input form fields
*
* @since 2.5
*/
public static function getGetFields($route = null)
public static function getGetFields($route = null, $paramItem = 0)
{
$fields = null;
$uri = JUri::getInstance(JRoute::_($route));
Expand All @@ -37,27 +38,29 @@ public static function getGetFields($route = null)

// Create hidden input elements for each part of the URI.
// Add the current menu id if it doesn't have one
$needId = true;
foreach ($elements as $n => $v)
{
$fields .= '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
if ($n == 'Itemid')
{
$needId = false;
continue;
}
$fields .= '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
}
if ($needId)
{
$fields .= '<input type="hidden" name="Itemid" value="' . JFactory::getApplication()->input->get('Itemid', '0', 'int') . '" />';
}

/*
* Figure out the Itemid value
* First, check if the param is set. If not, fall back to the Itemid from the JInput object
*/
$Itemid = $paramItem > 0 ? $paramItem : JFactory::getApplication()->input->getInt('Itemid');
$fields .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';

return $fields;
}

/**
* Get Smart Search query object.
*
* @param JRegistry object containing module parameters.
* @param JRegistry $params Module parameters.
*
* @return FinderIndexerQuery object
*
Expand Down Expand Up @@ -85,5 +88,4 @@ public static function getQuery($params)

return $query;
}

}
5 changes: 5 additions & 0 deletions modules/mod_finder/mod_finder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
type="text"
label="MOD_FINDER_FIELD_OPENSEARCH_TEXT_LABEL"
description="MOD_FINDER_FIELD_OPENSEARCH_TEXT_DESCRIPTION" />
<field
name="set_itemid"
type="text"
label="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_DESCRIPTION" />
</fieldset>
</fields>
</config>
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_finder/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@
</div>
<?php endif; ?>
<?php endif; ?>
<?php echo modFinderHelper::getGetFields($route); ?>
<?php echo modFinderHelper::getGetFields($route, (int) $params->get('set_itemid')); ?>
</div>
</form>

0 comments on commit 45b824e

Please sign in to comment.