?
avatar heleneross
heleneross
25 Sep 2014

Steps to reproduce the issue

Create several search menu items - I had 3 which were customised for different areas of the site.

Create a search module for each menu item and publish, but make sure you don't publish on any of the search pages linked to by the menu items. Also make sure to set ItemID in the module so each module points to a different search page.

Expected result

Each module should go to the search page set by the ItemID in the module.

Actual result

They always go to the same search page.

System information (as much as possible)

J3.3.4

Additional comments

this is because although we have this code in default.php of the mod_search template
<input type="hidden" name="Itemid" value="<?php echo $mitemid; ?>" />

Joomla overrides this with the page Itemid so it is never picked up by com_search

My solution

first I changed the code in the mod_search template to
<input type="hidden" name="mitemid" value="<?php echo $mitemid; ?>" />

and then in com_search/controller.php, on I think line 71 instead of:
$post['Itemid'] = $this->input->getInt('Itemid');

I put in:
$post['Itemid'] = $this->input->getInt('mitemid','') ? $this->input->getInt('mitemid') : $this->input->getInt('Itemid');

The result was that if I put an ItemID in the module parameters I get the search page expected. If I don't put an ItemID in or put a wrong one in that is not a search page I get the default search page.

This has been outstanding for quite a while but since the change in J3.3.4 so that getting the menu item by link is not used but rather now by component my old workaround fails.

avatar heleneross heleneross - open - 25 Sep 2014
avatar brianteeman
brianteeman - comment - 25 Sep 2014

You say this has been outstanding for a while. Please can you link to the report so we can see what was discussed at the time.

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar Kubik-Rubik
Kubik-Rubik - comment - 25 Sep 2014

I can not reproduce the described behavior.

Joomla overrides this with the page Itemid so it is never picked up by com_search

Where exactly is the Itemid overwritten by Joomla! in this process?

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar zero-24 zero-24 - change - 27 Sep 2014
Category Front End Search
avatar heleneross
heleneross - comment - 29 Sep 2014

OK. mea culpa.

Not an issue with a vanilla install. Problems were caused in my overriding the com_search and mod_search templates

Sorry - please close the issue

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar betweenbrain betweenbrain - close - 29 Sep 2014
avatar zero-24 zero-24 - close - 29 Sep 2014
avatar betweenbrain betweenbrain - change - 29 Sep 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-09-29 18:07:42
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment