VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: stegov on November 23, 2016, 15:44:29 PM

Title: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: stegov on November 23, 2016, 15:44:29 PM
Hi,
I am running VM 3.0.18 on Joomla 3.6.4, no 3rd-party SEF component

Joomla SEF Settings:
Search Engine Friendly URLs: Yes
Use URL rewriting: Yes
Adds Suffix to URL: No
Unicode Aliases: No

Virtuemart SEF Settings:
SEO Disabled: checked
Seo Suffix: -detail
Translate strings: unchecked
Use Product and Category IDs: unchecked

Product pagination is not working properly, selecting any other page (i.e. page 2 where the final partr of the url is: .../start/24) ust refresh the first page.
This happend on a website I'm working on so I tried installing a clean version of Joomla with the latest virtuemart adding sample products and the problem persists.
I tried different version fo PHP (5.3, 5.5, 5.6) and problem persists.

Any ideas on how to debug and correct this problem?

Thanks in advance.

Thanks in advance.
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: marcodamico88 on November 24, 2016, 12:16:45 PM
I too have the same problema..sembra that with the new version have solved, just that for me installing the new version brings me a blank page with just ordering products and nothing else. I wrote a post, hoping to find a solution.
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: jenkinhill on November 24, 2016, 17:42:43 PM
@marcodamico88 do not cross-post

@ are you using the default Joomla & VM templates?  Why turn off VM SEO? I always use Joomla+VM SEO.

Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: stegov on November 24, 2016, 19:26:14 PM
Hi Kelvyn,
thank for your reply.

It's a standard out of the box installation joomla and VM. You can check it @ http://seba.hot-stuff.it
The specific link where I have the pagination problem is: http://seba.hot-stuff.it/it/catalogo/view/category/virtuemart_category_id/7/lang/it-IT
If you try to switch to page 2 (url: http://seba.hot-stuff.it/it/catalogo/view/category/virtuemart_category_id/7/lang/it-IT/start/24) it doesn't work.

For this specific project I need VM SEO off.

Regards.
stefano

Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: jjk on November 24, 2016, 21:01:22 PM
For some reason it always starts with the first product, no matter which page you select.
Perhaps re-install VM using 3.0.18.5 with the Joomla extension manager and afterwards click on the 'Install or if necessary update tables' button at VM 'Tools & Migration'.
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: Studio 42 on November 25, 2016, 21:50:20 PM
Hi,
The problem is here:
http://seba.hot-stuff.it/it/catalogo/view/category/virtuemart_category_id/7/lang/it-IT/start/15/limit/15
right is http://seba.hot-stuff.it/it/catalogo/view/category/virtuemart_category_id/7/lang/it-IT/limitstart/15/limit/15
Joomla swap limitsart and start for SEF urls, but Virtuemart do not check this case and return start bbut limitstart is needed.

Change in router file
JOOMLASITE\components\com_virtuemart\router.php in function virtuemartParseRoute line 339
if ($helper->router_disabled) {
$total = count($segments);
for ($i = 0; $i < $total; $i=$i+2) {
$vars[ $segments[$i] ] = $segments[$i+1];
}
return $vars;
}

to

if ($helper->router_disabled) {
$total = count($segments);
for ($i = 0; $i < $total; $i=$i+2) {
$vars[ $segments[$i] ] = $segments[$i+1];
}
if(isset($vars[ 'start'])) $vars[ 'limitstart'] = $vars[ 'start'];
return $vars;
}
}


and all should work;)
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: Milbo on November 26, 2016, 11:02:32 AM
Great work Patrick. Well examined, explained and fix. I add it directly.
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: stegov on November 26, 2016, 11:35:08 AM
Hi Patrick,
thanks very much for your help.

I changed the router file as suggested. At first I received a blank page then I realised there was an additional brace.
I used the following code:

if ($helper->router_disabled) {
$total = count($segments);
for ($i = 0; $i < $total; $i=$i+2) {
$vars[ $segments[$i] ] = $segments[$i+1];
}
if(isset($vars[ 'start'])) $vars[ 'limitstart'] = $vars[ 'start'];
return $vars;
}


Now it goes to page 2 but it gets stuck there. If I refresh the page it's still the same but if I go to an upper level (clicking 'catalogo' on the menu) and get back to the 'wear' category (which contains 27 products) I'm on page 2 and I can go to page 1 and back to page 2 but then it gets stuck on page 2.
Any idea why?

Thanks.
Stefano G.
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: Studio 42 on November 26, 2016, 12:01:41 PM
Sorry i have copy past, 1 line more

for return to page 1 problem
replace the code with

if ($helper->router_disabled) {
$total = count($segments);
for ($i = 0; $i < $total; $i=$i+2) {
$vars[ $segments[$i] ] = $segments[$i+1];
}
if(isset($vars[ 'start'])) $vars[ 'limitstart'] = $vars[ 'start'];
else $vars[ 'limitstart'] = 0;
return $vars;
}
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: rahulsagipl on February 09, 2017, 07:12:46 AM
Quote from: stegov on November 23, 2016, 15:44:29 PM
Hi,
I am running VM 3.0.18 on Joomla 3.6.4, no 3rd-party SEF component

Joomla SEF Settings:
Search Engine Friendly URLs: Yes
Use URL rewriting: Yes
Adds Suffix to URL: No
Unicode Aliases: No

Virtuemart SEF Settings:
SEO (https://www.sagipl.com/seo-services/) Disabled: checked
Seo Suffix: -detail
Translate strings: unchecked
Use Product and Category IDs: unchecked

Product pagination is not working properly, selecting any other page (i.e. page 2 where the final partr of the url is: .../start/24) ust refresh the first page.
This happened on a website I'm working on so I tried installing a clean version of Joomla with the latest VirtueMart adding sample products and the problem persists.
I tried different version fo PHP (5.3, 5.5, 5.6) and the problem persists.

Any ideas on how to debug and correct this problem?

Thanks in advance.

Thanks in advance.

Your problem is similar to one I had but from a different cause. I recently upgraded from PHP5.3.13 to 5.4.37 and pagination no longer worked. That was with Joomla 3.3.6. The problem was with my template which did not work for pagination on the new version of PHP. The solution was to disable the pagination php file provided by the template (I renamed it).
Title: Re: Pagination is not working when Virtuemart SEO is disabled and joomla SEF enabled
Post by: Milbo on February 09, 2017, 09:24:10 AM
Quote from: Studio 42 on November 26, 2016, 12:01:41 PM
Sorry i have copy past, 1 line more

for return to page 1 problem
replace the code with

if ($helper->router_disabled) {
$total = count($segments);
for ($i = 0; $i < $total; $i=$i+2) {
$vars[ $segments[$i] ] = $segments[$i+1];
}
if(isset($vars[ 'start'])) $vars[ 'limitstart'] = $vars[ 'start'];
else $vars[ 'limitstart'] = 0;
return $vars;
}


Added to core, thx.