Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

BACK button


fiat707

Recommended Posts

Posted

Hi,

 

I want to place "BACK" button at products_info page, so visitors can click and go back to any immediate previous page, not an URL specified page like the one below:

 

<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>

 

The above one is specified as back to the products_info page with specific "products_id". How do I change it to make a genuine "back" link to any previous page? The reason is that a products_info page can be from a special product link in index.php, from a product link in a category page, or any other page with a link of that product ...

 

Thanks

Posted

hmm try this..

 

<a href="javascript:history.go(-1)"><?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>

Posted

Thanks, Chad. It works, but I wonder what if visitors turn off their javascript function from their browsers? Well, guess nothing is perfect.

 

KF

Posted

They wouldn't be able to create an account then. Javascript checks the forms to make sure fields are filled in. Don't think it's going to be a problem for you, I wouldn't worry about it.

Posted

if you are really worried about the whole javascript thing, try modifing this to work for your needs.

 

<?php
   $back = sizeof($navigation->path)-2;
   if (isset($navigation->path[$back])) {
?>
               <td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>

 

i copied this straight from the shopping_cart.php. all you would have to do is define a different button and change the number of steps back (-2 -> -1)

Archived

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

×
×
  • Create New...