VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Security (https) / Performance / SEO/ SEF issues VM 1.1 => Topic started by: FavoriteU on May 07, 2008, 23:11:57 pm

Title: sh404SEF & VM Search Results
Post by: FavoriteU on May 07, 2008, 23:11:57 pm
I've noticed that the first page of search results with VM Search & sh404SEF works fine.  But if you have results that extend to more than one page, and you click number 2, 3, etc or "next" then you will get seemingly random results (which are not random at all, but from some other user's previous search that got written to the SEF URL table).

Has anyone else noticed this problem, and if so, have you found a way to overcome it?  Can you override SEO on the search function somehow?  I thought I had everything working great with 1.1 and sh404SEF until I found this.

FYI - I'm using .htaccess version of sh404SEF.

Title: Re: sh404SEF & VM Search Results
Post by: FavoriteU on May 09, 2008, 16:38:19 pm
Is anyone else able to get Pagination to work properly with J! 1.5.3, VM 1.1 and sh404SEF??

Title: Re: sh404SEF & VM Search Results
Post by: _fD_ on May 13, 2008, 17:08:44 pm
Hello

Yes, i set all this as custom URL's:

alle-produkte-1-10.html      
index.php?option=com_virtuemart&Itemid=54&category_id=0&keyword=0&lang=en&limit=10&limitstart=0&manufacturer_id=0&page=shop.browse
alle-produkte-1-15.html    
index.php?option=com_virtuemart&Itemid=54&category_id=0&keyword=0&lang=en&limit=15&limitstart=0&manufacturer_id=0&page=shop.browse
alle-produkte-1-20.html    
index.php?option=com_virtuemart&Itemid=54&category_id=0&keyword=0&lang=en&limit=20&limitstart=0&manufacturer_id=0&page=shop.browse

and so on. But i have to disable all the ordering functions (Newest Product, Price).

I hope, this helps a little.

Regards, Urs
Title: Re: sh404SEF & VM Search Results
Post by: FavoriteU on May 28, 2008, 22:28:14 pm
Thanks, but either I don't follow or that doesn't work for me.  Surely there is someone who is getting SEF URLs to work with VirtueMart completely.  This is such an important issue. 

Is *anyone* getting sh404SEF to work with pagination, etc in VirtueMart 1.1 who has multiple products and multiple categories??
Title: Re: sh404SEF & VM Search Results --FIXED--
Post by: FavoriteU on June 04, 2008, 22:20:50 pm
Pagination appears to work in the latest build of sh404SEF for Joomla 1.5 (build 112).  The keywords and order parameters are listed after the SEO URL, which so far produces accurate results.

There is a slight issue with the archive of the 112 build for J! 1.5, the changelog.txt file was left out of the archive, so you until that is fixed you will have to add a blank text file (changelog.txt) to the archive before installing through Joomla.
Title: Re: sh404SEF & VM Search Results
Post by: dancetools on June 11, 2008, 01:07:53 am
hi everybody,

new to this forum but maybe I can help.

after scratching my head for a long time because of virtuemart search module and SEO , I found this solution for Joomla 1.x, virtuemart 1.1 and sh404 1.31

first, in sh404, I disabled the SEO for the search module only.

locate this file:  components/com_sef/sef_ext/com_virtuemart.php

at line 188:       

 if (empty($product_id) && empty($category_id) && empty($manufacturer_id) && empty($Search)
          && empty($root)) {
        $title[] = $sh_LANG[$shLangIso]['_PHPSHOP_LIST_ALL_SHOP_PRODUCTS'];
 }

replaced by :

 if (empty($product_id) && empty($product_type_id) && empty($category_id) && empty($manufacturer_id) && empty($Search)
          && empty($root)) {
        $title[] = $sh_LANG[$shLangIso]['_PHPSHOP_LIST_ALL_SHOP_PRODUCTS'];
 }


2 - to fix the problem with order_by, next pages, and order ASC/DES listing,

locate this file : components/com_virtuemart/themes/default/templates/browse/includes/browse_orderbyform.tpl.php

at line 30 :

if( !empty( $product_type_id )) {
   echo $ps_product_type->get_parameter_form($product_type_id);
}

replaced by :

if( !empty( $product_type_id )) {
   echo '<input type="hidden" name="product_type_id" value="'.$product_type_id.'" />';
   echo $ps_product_type->get_parameter_form($product_type_id);
}

3 last but not least : to make the button "modify prameters" appear again !

locate this file : administrator/components/com_virtuemart/html/shop.browse.php

at line 148:

$parameter_form = $tpl->fetch( 'browse/includes/browse_searchparameterform.tpl.php' );

replaced by :

$parameter_form = $tpl->fetch( 'browse/includes/browse_searchparameter_form.tpl.php' );

that's it.

hope it helps...

regards from france ;-).
Laurent.
Title: Re: sh404SEF & VM Search Results
Post by: korb on June 11, 2008, 15:11:53 pm
Hi dancetools,
Does this hack apply to sh404SEF-15_1.0.5_Beta_build_120.joomla1.5.x?
Maybe you will be interested in this matter: Link. (http://extensions.siliana.com/forums/index.php?topic=9344.0)
Thanks
Title: Re: sh404SEF & VM Search Results
Post by: dancetools on June 11, 2008, 17:59:53 pm
Hi korb,

after lookin' in the code of sh404sef 15_1.04beta,
I should answer YES ! it's the same Rev. [V 1.2.4.m]  for this "shop.browse" section.

so backup your file and try it ;-)

ps: just a question; Do you think SEF rewriting is so important for search mode in Virtuemart ?

cheers.
Laurent.
Title: Re: sh404SEF & VM Search Results
Post by: korb on June 11, 2008, 19:39:18 pm
yes it is important, because I don't want my clients to see in the link com_virtuemart.
Ciao
Title: Re: sh404SEF & VM Search Results
Post by: korb on June 22, 2008, 03:27:17 am
hei dancetools, it works! it appears again. Thank you!
I must hack this even further:
I want the search form to be always shown when I browse a VM category that is actualy a product type variation, like a product type to define all products in that category.
Thanks again
Title: Re: sh404SEF & VM Search Results
Post by: p9939068 on July 10, 2008, 14:09:38 pm
Hi dancetools, I tried your hack but it doesn't seem to work (trying to fix next/prev page and order by problem). I'm curious, why will adding a hidden input type fix the problem? Also, when is browse_orderbyform.php called? Maybe I should add the hidden field on another file?

I'm using J! 1.0.15 and VM 1.1 too. I've made all 3 hacks you mentioned. Hope you can shed some light :)
Title: Re: sh404SEF & VM Search Results
Post by: dlux on September 09, 2008, 00:00:37 am
Same situation...

I find this topic today and I looking into the referred files, and these are already have dancetools suggestion. Maybe this comes with VM liveupdate.

But every pagination link ends: Page-1-.html
I'm using Joomla! 1.0.15 and VM 1.1.2

So many post about VM SEF pagination problem here, and on SH404 forum - and I can not find the right way. If anybody know the solution, plase post here.

Thank you.
Title: Re: sh404SEF & VM Search Results
Post by: dancetools on September 30, 2008, 10:17:59 am
hi everybody,

finally I fixed this weird issue of virtuemart pagination with sh404sef.

tested in (joomla 1.0.13 and virtuemart 1.1.1 ), for other version it should give you some ideas how to fix.

in fact the problems was coming from virtuemart itself, not from shumisha's component.  ;-)

ok let's go.

1) locate this file : administrator/components/com_virtuemart/classes/pageNavigation.class.php
around line 108 :
Quote
for virtuemart 1.1.1 only ( it appears to be fixed in virtuemart 1.1.2 using vmRoute url function)
Code: [Select]
function getPagesLinks($link='') {
../...
}
Quote
sefRelToAbs url fonction must be used to build sef url ! ( vmRoute in virtuemart 1.1.2 )
replaced by :
Code: [Select]
function getPagesLinks($link='') {
global $VM_LANG;
   
$displayed_pages = 10;
$total_pages = ceil( $this->total / $this->limit );
$this_page = ceil( ($this->limitstart+1) / $this->limit );
$start_loop = (floor(($this_page-1)/$displayed_pages))*$displayed_pages+1;
if ($start_loop + $displayed_pages - 1 < $total_pages) {
$stop_loop = $start_loop + $displayed_pages - 1;
} else {
$stop_loop = $total_pages;
}
$html = '<ul class="pagination">';
if ($this_page > 1) {
$page = ($this_page - 2) * $this->limit;
if( $link != '') {
$html .= "\n<li><a href=\"".sefRelToAbs($link."&amp;limitstart=0")."\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_START')."\">&laquo;&laquo; ".$VM_LANG->_('PN_START')."</a></li>";
$html .= "\n<li><a href=\"".sefRelToAbs($link."&amp;limitstart=".$page)."\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_PREVIOUS')."\">&laquo; ".$VM_LANG->_('PN_PREVIOUS')."</a></li>";
} else {
$html .= "\n<li><a href=\"#beg\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_START')."\" onclick=\"javascript: document.adminForm.limitstart.value=0; document.adminForm.submit();return false;\">&laquo;&laquo; ".$VM_LANG->_('PN_START')."</a></li>";
$html .= "\n<li><a href=\"#prev\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_PREVIOUS')."\" onclick=\"javascript: document.adminForm.limitstart.value=$page; document.adminForm.submit();return false;\">&laquo; ".$VM_LANG->_('PN_PREVIOUS')."</a></li>";
}
} else {
$html .= "\n<li><span class=\"pagenav\">&laquo;&laquo; ".$VM_LANG->_('PN_START')."</span></li>";
$html .= "\n<li><span class=\"pagenav\">&laquo; ".$VM_LANG->_('PN_PREVIOUS')."</span></li>";
}

for ($i=$start_loop; $i <= $stop_loop; $i++) {
$page = ($i - 1) * $this->limit;
if ($i == $this_page) {
$html .= "\n<li><span class=\"pagenav\"> $i </span><li>";
} else {
if( $link != '') {
$html .= "\n<li><a href=\"".sefRelToAbs($link."&amp;limitstart=".$page)."\" class=\"pagenav\"><strong>$i</strong></a></li>";
} else {
$html .= "\n<li><a href=\"#$i\" class=\"pagenav\" onclick=\"javascript: document.adminForm.limitstart.value=$page; document.adminForm.submit();return false;\"><strong>$i</strong></a></li>";
}
}
}

if ($this_page < $total_pages) {
$page = $this_page * $this->limit;
$end_page = ($total_pages-1) * $this->limit;
if( $link != '') {
$html .= "\n<li><a href=\"".sefRelToAbs($link."&amp;limitstart=".$page)."\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_NEXT')."\"> ".$VM_LANG->_('PN_NEXT')." &raquo;</a></li>";
$html .= "\n<li><a href=\"".sefRelToAbs($link."&amp;limitstart=".$end_page)."\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_END')."\"> ".$VM_LANG->_('PN_END')." &raquo;&raquo;</a></li>";
} else {
$html .= "\n<li><a href=\"#next\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_NEXT')."\" onclick=\"javascript: document.adminForm.limitstart.value=$page; document.adminForm.submit();return false;\"> ".$VM_LANG->_('PN_NEXT')." &raquo;</a></li>";
$html .= "\n<li><a href=\"#end\" class=\"pagenav\" title=\"".$VM_LANG->_('PN_END')."\" onclick=\"javascript: document.adminForm.limitstart.value=$end_page; document.adminForm.submit();return false;\"> ".$VM_LANG->_('PN_END')." &raquo;&raquo;</a></li>";
}
} else {
$html .= "\n<li><span class=\"pagenav\">".$VM_LANG->_('PN_NEXT')." &raquo;</span></li>";
$html .= "\n<li><span class=\"pagenav\">".$VM_LANG->_('PN_END')." &raquo;&raquo;</span><li>";
}
$html .= "\n</ul>";
return $html;
}

2) locate this file : components/com_virtuemart/themes/default/templates/browse/includes/browse_orderbyform.tpl.php
line 4 :
Code: [Select]
<!-- ORDER BY .... FORM -->
<form action="<?php echo $mm_action_url."index.php" ?>" method="get" name="order">
replaced by :
Quote
again, sefRelToAbs function must be used to build correct sef url !
Code: [Select]
<form action="<?php echo sefRelToAbs($mm_action_url."index.php?option=com_virtuemart&amp;page=shop.browse&amp;category_id=".$category_id."&amp;manufacturer_id=".$manufacturer_id."&amp;Itemid=".$Itemid?>" method="get" name="order">then comment or simply delete these lines :
Code: [Select]
<input type="hidden" name="Itemid" value="<?php echo $Itemid ?>" />
    <input type="hidden" name="option" value="com_virtuemart" />
    <input type="hidden" name="page" value="shop.browse" />
    <input type="hidden" name="category_id" value="<?php echo $category_id ?>" />
    <input type="hidden" name="manufacturer_id" value="<?php echo $manufacturer_id ?>" />

3) locate this file : administrator/components/com_virtuemart/html/shop.browse.php
around line 173 :
Code: [Select]
$search_string = $mm_action_url."index.php?option=com_virtuemart&amp;page=$modulename.browse&amp;category_id=$category_id&amp;keyword=".urlencode( $keyword )."&amp;manufacturer_id=$manufacturer_id&amp;Itemid=$Itemid";
Quote
the limit parameter is missing !
replaced by:
Code: [Select]
$search_string = $mm_action_url."index.php?option=com_virtuemart&amp;page=$modulename.browse&amp;category_id=$category_id&amp;keyword=".urlencode( $keyword )."&amp;manufacturer_id=$manufacturer_id&amp;Itemid=$Itemid&amp;limit=$limit";
last but not least :
don't forget to activate "Using Items per page drop-down list" in sh404 virtuemart plugin.

Quote
in case it doesn't work for other version of joomla and virtuemart, maybe  you should use vmRoute in place of sefRelToAbs function

hope this help some of you...


Title: Re: sh404SEF & VM Search Results
Post by: dancetools on September 30, 2008, 12:36:21 pm
hi again,

for joomla 1.5.7 and virtuemart 1.1.2

after trying to apply these patches, I encountered sh404 limit security error + bad page navigation number.

I found this solution, despite the fact that you must use  vmRoute in place of sefRelToAbs function ( see my previous post )

1) locate this file : administrator/components/com_virtuemart/classes/pageNavigation.class.php
Quote
replace the shumisa's function getLimitBox hack by the old one   ::)
Code: [Select]
  /**
   * Modified by shumisha to handle SEF URLs 2008-06-28
   * @return string The html for the limit # input box
   */
   
  function getLimitBox ( $link = '') {
    $limits = array();

    if (!empty($link) && strpos( 'limitstart=', $link) === false) {  // insert limitstart in url if missing // shumisha
      $link .= '&limitstart='.$this->limitstart;
    }
    for ($i=5; $i <= 30; $i+=5) {
      if (empty( $link)) {
        $limits[$i] = $i;
      } else {
        $limits[vmRoute($link.'&limit='.$i)] = $i;
      }
    }
    if (empty( $link)) {
      $limits[50] = 50;
    } else {
      $limits[vmRoute($link.'&limit=50')] = 50;
    }

    // build the html select list
    if (empty( $link)) {
    $html = ps_html::selectList( 'limit', $this->limit, $limits, 1, '',  'onchange="this.form.submit();"' );
    } else {
      $current = vmRoute($link.'&limit='.$this->limit);
      $html = ps_html::selectList( 'limit', $current, $limits, 1, '',  'onchange="location.href=this.value"' );
    }
    $html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
    return $html;
  }
 

replaced by:
Code: [Select]
function getLimitBox () {
$limits = array();
for ($i=5; $i <= 30; $i+=5) {
$limits[$i] = $i;
}
$limits[50] = 50;

// build the html select list
$html = ps_html::selectList( 'limit', $this->limit, $limits, 1, '',  'onchange="this.form.submit();"' );
$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
return $html;
}

it works great... at least for me  ;)
cordially
Laurent
Title: Re: sh404SEF & VM Search Results
Post by: CyberWoolf on October 06, 2008, 05:40:34 am
Dancetools,

Thank you so much!  I've had this problem for awhile and had no clue wtf the problem was.  I bow to your superior knowledge :-D
Title: Re: sh404SEF & VM Search Results
Post by: woonydanny on November 11, 2008, 15:07:00 pm
i am still having an error with VM1.1.2 and sh404sef.

There is something weird still happening so that the sorting of ascending and descending of price, sku, product name and lastest products dont work correctly. It seems to be work sometimes and not others, then pagination wont let you go past page 2. it will just show you page 2 even if you click on page 5.

I am just about to crack it with joomla and VM. firstly VM doesnt work with the native J1.5 sef so i have to use sh404sef so that users can go to the checkout, but ive had a bunch of problems with sh404sef and VM as well.

I all want is something that works and that works for the users as if im a user and click on sort by price or something i would expect that to work!
Title: Re: sh404SEF & VM Search Results
Post by: pdvdz on November 15, 2008, 12:10:36 pm
I have the same problem.
Tried everything but the pagination problem still exists. I'm using the latest versions of Virtuemart (1.1.2) and sh404SEF (1.3.8) with Joomla 1.0.15

My biggest problem is that (with sh404SEF enabled) it's not possible to go to another VM browse page. For example, if you have a category with more than two pages, all pages are 'page_1' in sh404SEF so you always get the same page and it's impossible to go further.
Title: Re: sh404SEF & VM Search Results
Post by: korb on November 15, 2008, 14:29:20 pm
Please open your VM sef plugin and comment limit and limitstart lines as well as orderby.
! Do not modify last lines of the plugin (those that include limit and limitstart).

This will make navigation work smooth, but you will no longer have page-1, page-2 for manufacturers, all products in shop and search, but if you want to change orderby while browsing page 5, you will remain on page 5!! and the URL will temporarily show orderby and asc/desc till you go to another page.

Ok now a one last thing: there is a problem with top limitbox, so you have to comment the folowing lines in browse_orderbyform.tpl.php

Code: [Select]
<?php $pagenav->writeLimitBox$search_string ); ?>
<noscript><input type="submit" value="<?php echo $VM_LANG->_('PHPSHOP_SUBMIT'?>" /></noscript>

I hope it helps,
Danny

like this
Code: [Select]
<!-- <?php $pagenav->writeLimitBox$search_string ); ?>
<noscript><input type="submit" value="<?php echo $VM_LANG->_('PHPSHOP_SUBMIT'?>" /></noscript> -->
Title: Re: sh404SEF & VM Search Results
Post by: pdvdz on November 16, 2008, 11:40:31 am
That does the trick, I can now browse all pages.
Strange thing is that every page has a sef url of 'page1', even if it's page 4 or whatever.
Title: Re: sh404SEF & VM Search Results
Post by: goldlink on December 16, 2008, 01:32:05 am
Hi everybody,
Thank you for helping dancetools, BUT I have a problem...
I use Joomla 1.0.15 and VM 1.0.13
the second point (locate this file : components/com_virtuemart/themes/default/templates/browse/includes/browse_orderbyform.tpl.) I don't find this file
and the third point I find file, but Idon't find this line $parameter_form = $tpl->fetch( 'browse/includes/browse_searchparameterform.tpl.php' );

You could help me please, I do not know where most beat your head!

Regards,

goldlink.

2 - to fix the problem with order_by, next pages, and order ASC/DES listing,
locate this file : components/com_virtuemart/themes/default/templates/browse/includes/browse_orderbyform.tpl.php
at line 30 :
if( !empty( $product_type_id )) {
echo $ps_product_type->get_parameter_form($product_type_id);
}
replaced by :
if( !empty( $product_type_id )) {
echo '<input type="hidden" name="product_type_id" value="'.$product_type_id.'" />';
echo $ps_product_type->get_parameter_form($product_type_id);
}
3 last but not least : to make the button "modify prameters" appear again !
locate this file : administrator/components/com_virtuemart/html/shop.browse.php
at line 148:
$parameter_form = $tpl->fetch( 'browse/includes/browse_searchparameterform.tpl.php' );
replaced by :
$parameter_form = $tpl->fetch( 'browse/includes/browse_searchparameter_form.tpl.php' );
Title: Re: sh404SEF & VM Search Results
Post by: dancetools on December 31, 2008, 14:35:25 pm
hi,

to goldlink,
please be aware that this thread is about virtuemart 1.1
that's why you cannot locate these file/lines of code. in your 1.0.x.  ::)

regards.
laurent
Title: Re: sh404SEF & VM Search Results
Post by: mark82 on February 25, 2009, 01:26:27 am
Anyone know the exact fix for the breadcrumbs error on VM 1.0.1 3 beta. On the advanced search parameters page I get the html code displayed as a link in the breadcrumbs instead of the actual link
child search cats are fine just this initial page causes this

I tried the update 2 patches to the latest version of vm as well as dancetools suggested fix here and they caused php errors so had to restore.

I just need to know the exact files to replace/code to replace as I cannot now overwrite all of the other template files as my site is complete but with this annoying bug.

Im not using SEF urls and wont be doing - they dont work at all in my joomla 1.5.0 and again cause a php error when enabled.

Thanks in advance to anyone who can help or suggest a solution amongst the 1000s of files which work this software.
Title: Re: sh404SEF & VM Search Results
Post by: mark82 on February 27, 2009, 00:09:13 am
I answer my own question:

The fix for me was to overwrite administrator/components/com_virtuemart/html/shop.parameter_search.php. with the latest version

I tried the patches and upgrades and they wrecked my layout. virtuemart parser did not work either. This one specific file fixed it. I think i will restore all the other files i had overwritten when trying the patches and just leave this one. There are too many conflicts and too many other files which will overwrite my hard work on the template to risk doing the full patch from 1.1.0 beta 3 - 1.1.1 - 1.1.3

The supposed fix re the SEF urls is irrelevant to this breadcrumbs bug IMO it doesnt fix the bug of the breadcrumbs link html showing instead of the link title.

Hope this helps someone else like me who unfortunately uses the earlier versions.
Title: Re: sh404SEF & VM Search Results
Post by: chuckscroggs on June 11, 2009, 21:42:21 pm
I use Joomla 1.5.9 and Virtuemart 1.1.2

There is no solution to the problem in this topic or any other topic I've read. The page navigation stays screwed up whether the changes are made or whether they are not. The sh404sef and virtuemart DO NOT WORK TOGETHER!!!

I challenge anyone to show me a live website using these 2 and prove me wrong!

Thanks.

P.S. I have read much on this issue in many posts and I don't understand why this has not been addressed by the virtuemart code developers before now. You would think an issue this huge would be dealt with. If a client can't even have customers navigate their site, why use virtuemart at all? I guess we could turn off the sef and not have the site even on page 1 of the search engines.

I also know about the easier router.php options but they don't work properly either. It seems to me (A lowly Designer) that there are no programmers out there that even understand how this thing works. Many hack and many try hard but there are no answers that see results except for one guy who then posts back later that it really didn't work for him either.

Show me one good virtuemart website that uses sef and works properly in ALL ASPECTS and then give me the number to that programmer!