Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

We need a back button


Guest

Recommended Posts

Posted

I need to add a back button on the product_info.php to return

to the previously view page.

 

I tried using this code below (from shopping_cart.php, slightly modified)

but I can't get it to work properly, as I dont know how the 'isset($navigation->path[$back]))' and all that works.

 

 

<?php
$back = sizeof($navigation->path)-3;
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_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
<?php
}
?>

Posted

just use something like:

 

<script language="javascript"><!-- 
function GoBack() 
{ 
if (navigator.appName == "Microsoft Internet Explorer") 
document.location="javascript: history.go(-1)" 
else 
document.location="javascript: window.back()" 
} 
//--> 
</script>

 

but put it BETWEEN <HEAD> .... </HEAD>

Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Posted

This code added to footer.php will work also, giving you a back button on every osCommerce page, and works with all the browsers I have tested, including MSN and AOL9.

 

<tr>

<td><p><center><!-- this script and many more avaliable from A1 javascripts all credit to A1javascripts. Please leave these comments intact thank you -->

<form><input type=button value="Back" onClick="history.back()"></form><!-- --></center></p></td>

</tr>

 

George

GEOTEX from Houston, TX

 

(George)

  • 2 weeks later...
Posted

I am wanting to use the back button instead of the review button, So i have replaced the review button code.

 

IF i use this

<td><p><center><!-- this script and many more avaliable from A1 javascripts all credit to A1javascripts. Please leave these comments intact thank you -->
<form><input type=button value="Back" onClick="history.back()"></form><!-- --></center></p></td>

 

Then it works fine :)

 

If however I try to use the back button from my images collection like this

   <td><p><center><!-- this script and many more avaliable from A1 javascripts all credit to A1javascripts. 

Please leave these comments intact thank you -->
<form><input type=image src="/includes/languages/english/images/buttons/button_back.gif" value="Back" 

onClick="history.back()"></form><!-- --></center></p></td>

 

However this takes me to the cart page and tells me there is nothing in my cart, why does changing this one thing stop it from working :huh:

Posted

Really :huh:

 

I couldnt find that, any idea where ?

Posted

Here is the code I'm using

 

"Add a BACK button in the product_info"

for MS2.2

 

This is a small modification in order to alow costumers to go back when they are in the product info page.

 

 

Step 1:

Open the file catalog/product_info.php

 

Step 2:

Find this:

it is about line 212

 

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>

 

And after add this:

 

<?php

$back = sizeof($navigation->path)-2;

if (isset($navigation->path[$back])) {

?>

<td class="main" align="center"><?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_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

<?php

}

?>

 

 

You are done it.

 

I wish this to be usefull to some people.

 

_____________

Dimitris Behtsis

 

Hope that helps

catcastle

http://castlesweb.com

Archived

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

×
×
  • Create New...