VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: at on April 07, 2018, 14:28:47 PM

Title: VM Search plugin produces wrong URLs
Post by: at on April 07, 2018, 14:28:47 PM
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).
Title: Re: VM Search plugin produces wrong URLs
Post by: jjk on April 10, 2018, 13:09:48 PM
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.
Title: Re: VM Search plugin produces wrong URLs
Post by: at on April 18, 2018, 23:13:40 PM
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.
Title: Re: VM Search plugin produces wrong URLs
Post by: jjk on April 19, 2018, 09:53:41 AM
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?
Title: Re: VM Search plugin produces wrong URLs
Post by: at on April 20, 2018, 19:44:20 PM
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:
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?