With, I assume, the desire to make the shopping experience as smooth and as easy as possible I've seen a number of solutions to the continue shopping problem; most of which involve implementing back buttons.
My view was that rather than implement continue shopping buttons I should prevent the user being taken away from the page on which he or she was at the time; I wanted to do this for both the Cart and the Wishlist. Essentially so that you can Add to Cart or Add to Wishlist without ever losing your place within the site.
The problem with this method is that the user might think that nothing had actually happened. The solution to this is in two parts:
a) make the minicart visible in a prominent position so that the user can see the Item count incrementing as they add to it
b) set up a miniwishlist counter so that the same is true when adding to the wishlist
To implement b):
1) create a file /modules/Wishlist/miniwishlist.php
Code:
<?php
if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }
x_session_register("wlid_eventid");
if(!empty($login)) {
$count = func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[wishlist] WHERE login = '$login' ");
$smarty->assign("miniwishlist_total_items", $count);
}
?>
2) Add:
Code:
if(!empty($active_modules["Wishlist"])) {
include $xcart_dir."/modules/Wishlist/miniwishlist.php";
}
to auth.php below the line:
Code:
include $xcart_dir.DIR_CUSTOMER."/minicart.php";
3) Modify \skin1\customer\main\minicart.tpl to:
Code:
<TABLE border="1" cellpadding="1" cellspacing="0">
<tr>
<td rowspan="2" width="23">{if $minicart_total_items > 0}
[img]{$ImagesDir}/cart_full.gif[/img]{else}[img]{$ImagesDir}/cart_empty.gif[/img]{/if}</td>
<td colspan="3"><A href="cart.php?mode=checkout" class="VertMenuItems">{$lng.lbl_your_mini_cart}<A href="cart.php" class="VertMenuItems"></td>
</tr>
<tr>
<td></td>
<TD class="VertMenuItems">{if $minicart_total_items > 0}{$lng.lbl_items}: {else}<CENTER>{$lng.lbl_cart_is_empty}</CENTER>{/if}</TD>
<TD class="VertMenuItems" color="#0000ff">{if $minicart_total_items > 0}{$minicart_total_items}{else}{/if}</TD>
</tr>
{if $active_modules.Wishlist ne ""}
<tr>
<td></td>
<td colspan="3">
{$lng.lbl_your_mini_wish_list}</td>
</tr>
<tr>
<td></td>
<td></td>
<TD class="VertMenuItems">{if $miniwishlist_total_items > 0}{$lng.lbl_items}: {else}<CENTER>{$lng.lbl_wish_list_is_empty}</CENTER>{/if}</TD>
<TD class="VertMenuItems" color="#0000ff">{if $miniwishlist_total_items > 0}{$miniwishlist_total_items}{else}{/if}</TD>
</tr>
{/if}
</table>
<HR size="1" NOSHADE class="VertMenuHr">
and create the appropriate language labels.
Note: this does not include Cart total information.
As far as never losing your place within the site is concerned you must:
c) Switch off redirection when adding to Cart:
By unchecking Redirect customer to cart: in the General Settings section of the Admin site.
d) Modify \modules\Wishlist\wishlist.php by making the following changes:
i)
Code:
#func_header_location("cart.php?mode=wishlist");
#
# Redirect
#
if(!empty($HTTP_REFERER)) {
func_header_location($HTTP_REFERER);
} else {
func_header_location("home.php?cat=$cat&page=$page");
}
ii)
Code:
#func_header_location("cart.php");
#
# Redirect
#
if(!empty($HTTP_REFERER)) {
func_header_location($HTTP_REFERER);
} else {
func_header_location("home.php?cat=$cat&page=$page");
}
Note: You could of course perameterise this change and allow it to be switched on and off via the Admin interface.
I think that's all. I'd appreciate any comments/feedback from those of you who know the system and Smarty/php better than I!