Author Topic: sh404SEF & VM Search Results  (Read 36918 times)

FavoriteU

  • Jr. Member
  • **
  • Posts: 119
sh404SEF & VM Search Results
« 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.


FavoriteU

  • Jr. Member
  • **
  • Posts: 119
Re: sh404SEF & VM Search Results
« Reply #1 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??


_fD_

  • Jr. Member
  • **
  • Posts: 118
    • Printdesign :: Joomla! CMS Webdesign :: Apple Computer Support
Re: sh404SEF & VM Search Results
« Reply #2 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

FavoriteU

  • Jr. Member
  • **
  • Posts: 119
Re: sh404SEF & VM Search Results
« Reply #3 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??

FavoriteU

  • Jr. Member
  • **
  • Posts: 119
Re: sh404SEF & VM Search Results --FIXED--
« Reply #4 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.

dancetools

  • Beginner
  • *
  • Posts: 6
Re: sh404SEF & VM Search Results
« Reply #5 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.

korb

  • Quality&Testing Team
  • Full Member
  • *
  • Posts: 685
  • VM 2.0 in heavy testing
    • Buy my work
Re: sh404SEF & VM Search Results
« Reply #6 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.
Thanks

dancetools

  • Beginner
  • *
  • Posts: 6
Re: sh404SEF & VM Search Results
« Reply #7 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.

korb

  • Quality&Testing Team
  • Full Member
  • *
  • Posts: 685
  • VM 2.0 in heavy testing
    • Buy my work
Re: sh404SEF & VM Search Results
« Reply #8 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

korb

  • Quality&Testing Team
  • Full Member
  • *
  • Posts: 685
  • VM 2.0 in heavy testing
    • Buy my work
Re: sh404SEF & VM Search Results
« Reply #9 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

p9939068

  • Beginner
  • *
  • Posts: 10
Re: sh404SEF & VM Search Results
« Reply #10 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 :)

dlux

  • Beginner
  • *
  • Posts: 7
Re: sh404SEF & VM Search Results
« Reply #11 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.

dancetools

  • Beginner
  • *
  • Posts: 6
Re: sh404SEF & VM Search Results
« Reply #12 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...



dancetools

  • Beginner
  • *
  • Posts: 6
Re: sh404SEF & VM Search Results
« Reply #13 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

CyberWoolf

  • Beginner
  • *
  • Posts: 40
Re: sh404SEF & VM Search Results
« Reply #14 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