Zen Follower
- Join Date:
- Jun 2008
- Location:
- UK
- Posts:
- 209
- Plugin Contributions:
- 0
"Back to Shopping" always goes back to homepage
I thought that normally the problems lay within this coding ...
My includes/template/template name/templates/tpl_shopping_cart_default.php looks like this.
<!--bof shopping cart buttons-->
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div>
<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div>
<?php
// show update cart button
if (SHOW_SHOPPING_CART_UPDATE == 2 or SHOW_SHOPPING_CART_UPDATE == 3) {
?>
<div class="buttonRow back"><?php echo zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT); ?></div>
<?php
} else { // don't show update button below cart
?>
<?php
} // show update button
?>
<!--eof shopping cart buttons-->
</form>
And my includes/functions/functions_general.php looks like this
////
// Set back button
function zen_back_link($link_only = false) {
if (sizeof($_SESSION['navigation']->path)-2 >= 0) {
$back = sizeof($_SESSION['navigation']->path)-2;
$link = zen_href_link($_SESSION['navigation']->path[$back]['page'], zen_array_to_string($_SESSION['navigation']->path[$back]['get'], array('action')), $_SESSION['navigation']->path[$back]['mode']);
} else {
if (isset($_SERVER['HTTP_REFERER']) && preg_match("~^".HTTP_SERVER."~i", $_SERVER['HTTP_REFERER']) ) {
//if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], str_replace(array('http://', 'https://'), '', HTTP_SERVER) ) ) {
$link= $_SERVER['HTTP_REFERER'];
} else {
$link = zen_href_link(FILENAME_DEFAULT);
}
$_SESSION['navigation'] = new navigationHistory;
}
if ($link_only == true) {
return $link;
} else {
return '<a href="' . $link . '">';
}
}