Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Continue Shopping

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 08-29-2004, 06:10 PM
 
Brian Peat Brian Peat is offline
 

Advanced Member
  
Join Date: Aug 2004
Location: Mc Connellsburg, PA
Posts: 73
 

Default

I ended up doing this after creating that label:

Added this:
<TD align="right">
{include file="buttons/button.tpl" button_title=$lng.lbl_continue_shop style="button"}
</TD>

Right above this:

<TD align="right">
{include file="buttons/button.tpl" button_title=$lng.lbl_checkout style="button" href="cart.php?mode=checkout"}
</TD>

So it uses my button style and lines up right next to it. It also actually loads the front of the store again (my store is small). I wasn't sure I liked the Javascript thing. It works great.
__________________
X-Cart Gold 4.3.1
Php 5.2.14
MySQL: 5.1.52
My Machine: OS X 10.6.5
Reply With Quote
  #12  
Old 09-28-2004, 07:36 AM
 
Allan Martel Allan Martel is offline
 

Advanced Member
  
Join Date: Mar 2004
Posts: 72
 

Default

Brian Peat -

I followed your example - Works Great! Thank you for the post!

Personally, I think this should have been in x-cart from the begining....
Reply With Quote
  #13  
Old 12-01-2004, 07:35 AM
 
roccons roccons is offline
 

Member
  
Join Date: Nov 2004
Posts: 16
 

Default

Quote:
I wish [customers] to be redirected to the Catagory page always.
Anyone has the answer to this?

For example, if they clicked in the shopping cart link (instead of adding a product) they won't like the two steps history back behaviour.
__________________
x-cart 3.5.12 (Unix)
Reply With Quote
  #14  
Old 12-05-2004, 09:24 PM
 
elomibao elomibao is offline
 

Member
  
Join Date: Sep 2004
Posts: 24
 

Default

Quote:
Originally Posted by roccons
Quote:
I wish [customers] to be redirected to the Catagory page always.
Anyone has the answer to this?

For example, if they clicked in the shopping cart link (instead of adding a product) they won't like the two steps history back behaviour.

I had the same dilema. The Continue Shopping should only appear if and only if I added a product. No sense in having a Continue Shopping button if you didn't added a product in the first place.

Code:
# # Redirect # if($mode=="add" and $productid) { if($config["General"]["redirect_to_cart"]=="Y") { func_header_location("cart.php"); } else{ if(!empty($HTTP_REFERER)) { func_header_location($HTTP_REFERER); } else { func_header_location("home.php?cat=$cat&page=$page"); } } }

Changed redirect to:
Code:
func_header_location("cart.php?mode=added");

then before:
Code:
func_header_location("cart.php");

added:
Code:
if ($mode == "added") $smarty->assign("cshopping","1");

then in cart.tpl, above the checkout button:
Code:
{if $cshopping eq "1"} <TD align="right"> {include file="buttons/button.tpl" button_title="Continue Shopping" style="button" href="javascript:history.go(-2);"} </TD> {/if}

Conditions:
Redirect to cart has to be Y.
Buy Now code in templates disabled
You can only add to cart when viewing product details (or clicking on a particular product).
__________________
X-Cart Pro 4.0.5
Fedora Core 2
Apache 2.x/PHP 4.x
MySQL 3.x
Reply With Quote
  #15  
Old 12-06-2004, 12:47 PM
 
roccons roccons is offline
 

Member
  
Join Date: Nov 2004
Posts: 16
 

Default

Nice!
It seems that it's exactly what I was looking for.
I'll implement that soon.
Thanks, elomibao
__________________
x-cart 3.5.12 (Unix)
Reply With Quote
  #16  
Old 12-06-2004, 02:17 PM
 
elomibao elomibao is offline
 

Member
  
Join Date: Sep 2004
Posts: 24
 

Default

I made a booboo when posting the solution.

The line:
Code:
if ($mode == "added") $smarty->assign("cshopping","1");

should be added before:
Code:
if ($mode == "checkout" || $mode == "auth") { # # Calculate total number of checkout process steps

and not this line:
Code:
func_header_location("cart.php");

Sorry about that.
__________________
X-Cart Pro 4.0.5
Fedora Core 2
Apache 2.x/PHP 4.x
MySQL 3.x
Reply With Quote
  #17  
Old 01-06-2005, 11:48 AM
 
inthepink inthepink is offline
 

Newbie
  
Join Date: Aug 2004
Posts: 1
 

Default alternative method using sessions

I wanted to be able to have a continue shopping button on any page that would automatically bring the user back to the last category or product they viewed. Obviously using history steps wouldn't work in this case. If anyone is intersted, here is how I did it:

Add this code to the end of config.php
Code:
x_session_register("last_cat"); x_session_register("last_productid"); if($HTTP_GET_VARS['cat'] != "") { $last_cat = $cat; } if($HTTP_GET_VARS['productid'] != "") { $last_productid = $productid; } $smarty->assign("last_productid", $last_productid); $smarty->assign("last_cat", $last_cat);

Then create a template similar to this one and save it as "buttons/continue_shopping.tpl":
Code:
{if $goto eq "product" and $last_productid neq ""} {assign var="href" value="`$WebDir`/product.php?productid=`$last_productid`"} {elseif $last_cat neq ""} {assign var="href" value="`$WebDir`/home.php?cat=`$last_cat`"} {else} {assign var="href" value="`$http_location`"} {/if} [img]{$ImagesDir}/buttons/continue_shopping.gif[/img]

Include the template anywhere you want to point the customer back to the last category or product they viewed.

To send them back to the last product include the template like this:
Code:
{include file="buttons/continue_shopping.tpl" goto="product"}

For the last department just include it like this:
Code:
{include file="buttons/continue_shopping.tpl"}

If the customer hasn't visited a department or product yet this sends them back to the homepage. Since this uses sessions, you can use it on any page no matter how many steps away from a department they've traveled.

Hope someone finds this useful.

Jay
__________________
X-Cart - Version 4.0.2
Reply With Quote
  #18  
Old 01-12-2005, 06:54 AM
 
roccons roccons is offline
 

Member
  
Join Date: Nov 2004
Posts: 16
 

Default

Hi, eliombao
I made the continue shopping implementation based on what I could grabb from your examples.
Instead of using a new $cshopping var I added this line to cart.php:
Code:
$smarty->assign("mode",$mode);
My redirect got like this:
Code:
# # Redirect # if($mode=="add" and $productid) { if($config["General"]["redirect_to_cart"]=="Y") { func_header_location("cart.php?mode=added"); } else { func_header_location("home.php?cat=$cat&page=$page"); } }
In cart.tpl, I added this lines
And, of course, I created the buttons/continue_shopping.tpl file.
It worked nice but I encountered that when you updated the shopping cart (changed quantity or deleted an item) the historyback-2 is not what you as a customer would expect.
So, I tried using a $mode=updated for that cases when you updated your cart after you added a product. It used an historyback-3. It worked great in IE, because one or several reloads of a page is registered in its history as one step, but it doesn't work the same way in Opera.
My next attempt was trying to carry the $cat var to remember the category you were on instead of using the history method, but I faced new problems.
What would you suggest to me?
Should I just dissapear the continue shopping button when you have updated the shopping cart?
Or should I use the historyback-3 solution without worrying about the rather minor Opera (and I guess mozilla) issue?
Or is there a more or less easy way to use something like
Code:
func_header_location("home.php?cat=$cat")
for the continue shopping instead of the history steps?
Any ideas or suggestions are welcome.
__________________
x-cart 3.5.12 (Unix)
Reply With Quote
  #19  
Old 01-12-2005, 05:11 PM
 
elomibao elomibao is offline
 

Member
  
Join Date: Sep 2004
Posts: 24
 

Default

roccons,

I already tried and tested the solution I posted previously. After adding a product, I updated it several times. After I clicked on Continue Shopping, it redirects me back to the category where I previously clicked a product. As long as the conditions I previously stated has been met, it should work.

BTW, I've tried on

FireFox 1.0
IE 6

Windows 2003
Windows 2000
Fedora Core 3
RedHat Linux 9

Goodluck!
__________________
X-Cart Pro 4.0.5
Fedora Core 2
Apache 2.x/PHP 4.x
MySQL 3.x
Reply With Quote
  #20  
Old 01-12-2005, 06:10 PM
 
roccons roccons is offline
 

Member
  
Join Date: Nov 2004
Posts: 16
 

Default

You're right, elomibao
You can update as many times as you wish without added history steps (because the action is not really a page reload but a form submition).
The problem appears only when deleting items.
I finally took this redirect issue with a different approach. I'll post it later.
Greetings.
__________________
x-cart 3.5.12 (Unix)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:21 PM.

   

 
X-Cart forums © 2001-2020