News:

Support the VirtueMart project and become a member

Main Menu

VM Search plugin produces wrong URLs

Started by at, April 07, 2018, 14:28:47 PM

Previous topic - Next topic

at

Hi,

I use the VM - Search in Shop module. When I enter a keyword in the search box and press Enter, it generates a correct URL (yes, I have created a search menu item and set the ItemID):

/index.php/en/?keyword=searchkeyword&limitstart=0&option=com_virtuemart&view=category&virtuemart_category_id=0&Itemid=381

However, as soon as I click the Next button, the URL suddenly changes to:

/index.php/en/results,25-48?keyword=searchkeyword

In particular, the ItemID parameter disappeared.

That wouldn't be a big problem though. The real problem is that all the modules assigned to the homepage are shown on top and the search results are shown only at the bottom, although on the first page of search no homepage modules appeared.

After that, when I click the Prev button, nothing happens (i.e. I still see the second page of search results with all modules that shouldn't be shown)!

I haven't been able to find the root cause of such behavior... Could anyone give a hint?

I use the latest versions of Joomla (3.8.6) and VM (3.2.14).

jjk

Do you use the deprecated 'Frontpage' as the menu item for your homepage?
If this is the case, use the 'Category' view instead of the deprecated 'Frontpage' for your home page menu item and configure the setting to display 'Show categories' = Yes in order to 'simulate' the old Frontpage. And set 'Show categories' to No for the regular category links.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

at

Thank you for your suggestion.

No, I'm not using the deprecated Frontpage and already am using the Category view.

I tried to trace this down to at least something. I'm stuck in the following.

In the file /administrator/components/com_virtuemart/helpers/vmpagination.php, there's a function _buildDataObject(), which is responsible for generating the URLs for Next, Prev and other navigation buttons.  I'm on the first page of search results and looking on how the link to the second page of results is generated.

Line 758 says:
$data->next->link = JRoute::_($params . '&' . $this->prefix . 'limitstart=' . $next);

The value of $next is calculated correctly. The values for $params and $this->prefix are empty (at least they appear so if I try to output them using either echo or print_r). So in my case, what's passed to JRoute is "&limitstart=24". The result of this is /index.php/en/results,25-48?keyword=searchkeyword.

My question is: Is this a correct behavior? Or I'm missing something? If these are really the parameters that should be passed to JRoute, where should I look further to understand why it gives wrong resulting value? As I understand, this is actually a call to Joomla internals, not really a VM function, but I suspect they may be linked together.

jjk

Quote from: at on April 07, 2018, 14:28:47 PM
The real problem is that all the modules assigned to the homepage are shown on top...

Which modules?
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

at

Well, I have a number of Custom modules I'm showing on the frontpage.

I have three languages in my shop. There are four menus:

       
  • Main Menu contains the Home menu item, which is marked as Home for all languages. It also contains the Search Results menu item with ID 381. This 381 is indicated in the VM - Search in Shop module as Itemid.
  • Menu (en-gb) contains the Home menu item, which is marked as Home for en-GB language. It contains no other menu items.
  • Similar menus are created for the remaining two languages.
Now the modules I'm talking about are Custom modules. Their menu assignment is set to "Only on the pages selected", and what's selected is only Home from Menu (en-gb) for modules to be shown when the language is English, and similarly for the modules on other two languages.


Am I mixing up something in these various home menu items?