Jump to content


This topic is now archived and is closed to further replies.


Resolved - Reviewing Link broken

Recommended Posts

If you do a search for a product using the search engine and you click on the link for a review, this will not lead to your destination.
Tested on CC522
Any solution fast?


Share this post

Link to post
Share on other sites

We would like to see this problem as presented by your installation.


Please let us know what your store's URL is.

Share this post

Link to post
Share on other sites

Please perform this experiment:


In the file /classes/catalogue.class.php, find near line 926:

$product['review_score'] = round($score/$count, 1);
if (!$product_view) {
  $link = currentPage(array('_a', 'cat_id'), null, false).'_a=product&product_id='.$product['product_id'].'#reviews';
} else {
  $link = '#reviews';
$score = number_format(($score/$count),1);

Change this part of the statement:

currentPage(array('_a', 'cat_id'), null, false).'_a




The function currentPage returns the whole and complete URL of the currently viewed page...


...minus the keys listed in the first argument of the function: '_a' and 'cat_id'. These keys are from the extra part of the URL for the ViewCat page, of which the Search and SaleItems pages are variants. So, instead of adding every possible key to the argument array, we will just do away with the function and plug in the store's main URL.


Then the desired extra part gets added.



But you may want the link to be of the SEO-type style. If that is to happen, then the mod_rewrite rule, currently:

RewriteRule ^(.*).html?$ index.php?seo_path=$1 [L,QSA]

will need to be changed to accommodate the anchor tag, #reviews. Something approximating (but probably not correct as written):

RewriteRule ^(.*).html?(#.*)?$ index.php?seo_path=$1$2 [L,QSA]

This says, after 'htm' or 'html', there may be an anchor hash mark followed by anything at the end of the string. If there is, place it after the seo_path=whatever part.


Then we can simply use $product['url'].'#reviews' instead of the $GLOBALS['storeURL'] solution.


But there is a problem with that. Near line 140, find:

foreach ($products as $product) {
  $product = $this->getProductPrice($product);
  $this->productAssign($product, false);
  $product['url'] = $GLOBALS['seo']->buildURL('prod', $product['product_id'], '&');
  $vars['products'][] = $product;

Note that productAssign is called before $product['url'] is built. (Personally, I would like to see $product['url'] built inside the productAssign function, but, hey....)


So, switch the order of those two lines so that ['ur'] is built first, then it is available for the $link statement in productAssign.

Share this post

Link to post
Share on other sites
I was able to solve the problem with your patch.
Thanks again bsmither

Share this post

Link to post
Share on other sites

  • Create New...