Author Topic: How to display previous_product, next_product by product_sku  (Read 3230 times)

1Jumpman

  • Beginner
  • *
  • Posts: 8
How to display previous_product, next_product by product_sku
« on: April 17, 2009, 12:14:56 pm »
How can i display previous nad next product by sku not by name, in product detail page?


Please help me.

1Jumpman

  • Beginner
  • *
  • Posts: 8
Re: How to display previous_product, next_product by product_sku
« Reply #1 on: April 19, 2009, 01:01:59 am »
!SOLVED!  :)


in file ps_product.php : /administrator/components/com_virtuemart/classes

add line (1310):

if( !empty( $previous_row->product_id )) {
  $neighbors['previous']['product_id'] = $previous_row->product_id;
  $neighbors['previous']['product_name'] = $previous_row->product_name;
$neighbors['previous']['product_sku'] = $previous_row->product_sku;


next (line 1315):

if( !empty( $next_row->product_id )) {
 $neighbors['next']['product_id'] = $next_row->product_id;
 $neighbors['next']['product_name'] = $next_row->product_name;
$neighbors['next']['product_sku'] = $next_row->product_sku;

In file flypage.tpl: /components/com_virtuemart/themes/default/templates/product_details/

change this:
if( $this->get_cfg( 'product_navigation', 1 )) {
   if( !empty( $previous_product )) {
      echo '<a class="previous_page" ef="'.$previous_product_url.'">'.shopMakeHtmlSafe($previous_product['product_name']).'</a>';
   }
   if( !empty( $next_product )) {     
      echo '<a class="next_page" href="'.$next_product_url.'">'.shopMakeHtmlSafe($next_product['product_name']).'</a>';
   }

on this :

if( $this->get_cfg( 'product_navigation', 1 )) {
   if( !empty( $previous_product )) {
      echo '<a class="previous_page" href="'.$previous_product_url.'">'.shopMakeHtmlSafe($previous_product['product_sku']).'</a>';
   }
   if( !empty( $next_product )) {     
      echo '<a class="next_page" href="'.$next_product_url.'">'.shopMakeHtmlSafe($next_product['product_sku']).'</a>';
   }

That's all.


Greetings from Poland!