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
  #31  
Old 03-15-2005, 12:32 PM
 
smitty smitty is offline
 

Member
  
Join Date: Mar 2005
Posts: 27
 

Default

This looks like a good solution, but I got a little confused as to what the final code for the redirect section of cart.php should look like. Would it be possible for you to cut and paste the final, edited section altogether?

Thanks for your help!


Quote:
Originally Posted by elomibao
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 version 4.0.12
PHP 5.2.4-2ubuntu5.10
MySQL server 5.0.51a-3ubuntu5.5
MySQL client 5.0.51a
Web server Apache
Operation system Linux
Perl 5.008008
Reply With Quote
  #32  
Old 03-17-2005, 01:55 AM
 
Isleman Isleman is offline
 

Senior Member
  
Join Date: Jan 2005
Location: UK
Posts: 128
 

Default

Quote:
Posted: Mon Mar 07, 2005 10:52 pm Post subject: Easy continue shopping botton

--------------------------------------------------------------------------------

I changed the javascript to go back two pages, using this code, I also inserted this in the same place andreas04031 did just gives me a standard button which takes customer back to Category.

Insert this
Code:
<TD align="right"><TABLE border="0" cellspacing="0" cellpadding="0" onclick="javascript: history.go(-2)" style="cursor: pointer;" valign="middle">
<TR><TD>[img]{$ImagesDir}/but1.gif[/img]</TD>
<TD class="Button" valign="middle" nowrap><FONT class="Button">Continue shopping</FONT></TD>
<TD>[img]/{$ImagesDir}/but2.gif[/img]</TD></TR>
</TABLE>


Excelent work.Just a small mistake in the code here "<TD>[img]/{$ImagesDir}/but2.gif[/img]</TD></TR> " it should be "<TD>[img]{$ImagesDir}/but2.gif[/img]</TD></TR> " .
I could not get but2.gif because path wasn't right .
Hope it helps .
__________________
X-Cart ver. 4.4.2 ( www.responseelectronics.com )
X-Cart ver. 4.1.11 ( www.mrdoorbell.com)
Reply With Quote
  #33  
Old 04-13-2005, 09:24 AM
 
ozpopzi ozpopzi is offline
 

Newbie
  
Join Date: Apr 2005
Posts: 4
 

Default Suggestion

I would like to suggest guys to implement multiple solutions together to meet the redirect need. Letting customers themself to choose from WHERE to go after adding item to cart.

E.g. In the cart page, show

Checkout | Back to Home | Back to Last Category

I have not try but it should be a pretty good idea.

Anyone have this tested please post the final solution here and share to each other. (I m not a php guy so I have no idea to do it myself).

Thanks to all of you who shares here~~
__________________
------------------
New To X-Cart
suppose to use 4.0.13
But still finding multi-language solution
As our store will NOT be in English
Reply With Quote
  #34  
Old 04-13-2005, 02:59 PM
 
smitty smitty is offline
 

Member
  
Join Date: Mar 2005
Posts: 27
 

Default

This is a very simple and handy mod. Thanks for sharing.

Only problem with it is that when you are directed back 2 pages, the items that were added the cart do not appear. I'm afraid this might be confusing to customers.

Any way to make the javascript refresh the page after it sends you back 2 pages?

TIA!

Quote:
Originally Posted by elomibao
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 version 4.0.12
PHP 5.2.4-2ubuntu5.10
MySQL server 5.0.51a-3ubuntu5.5
MySQL client 5.0.51a
Web server Apache
Operation system Linux
Perl 5.008008
Reply With Quote
  #35  
Old 04-15-2005, 02:31 PM
  shipmerchant's Avatar 
shipmerchant shipmerchant is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 361
 

Default Continue shopping works.

Thanks Embliano, andreas, and swordfish and all the rest of this great xcart team. It works, and yes no need to create the button its already there. The only thing is the right rounded off edge seems to be missing.
Any one know how to correct this?

Again thanks!


As they say, too much information.....should have read "Isleman" post above and saved myself a headache!
__________________
Mil Mascaras
Live Xcart Site #1-V- 4.1.8
Live Xcart site # 2-V 4.4.3
CDSEO Mod - Firetank MM30 - 7DANA- The bestTemplates!
Linux - EWD Host Servers awesome service!
AlteredCart One Page Checkout
Reply With Quote
  #36  
Old 06-19-2005, 07:59 PM
 
extreme extreme is offline
 

Member
  
Join Date: Jun 2005
Posts: 28
 

Default

Not sure if anyone else had problems implementing elomibao's code, but just in case... here is what I eventually got it working as....

In cart.php, the redirect section should end up like this:

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

and further down, the top line in this block needs to be added so you end up with:

Code:
if ($mode == "added") $smarty->assign("cshopping","1"); if ($mode == "checkout" || $mode == "auth") { $smarty->assign("checkout_step",$checkout_step); $smarty->assign("total_checkout_steps",$total_checkout_steps); }

then the tpl mods as previously posted.
__________________
X-Cart version 4.1.10 (upgraded painfully from 4.0.18.)
Reply With Quote
  #37  
Old 10-17-2005, 03:08 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default

Going from inthepink's code I did this...

create a tpl. file in buttons called continue_shopping.tpl

add the following code to it...

Code:
{* source: http://forum.x-cart.com/viewtopic.php?t=1124 *} {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} {include file="buttons/button.tpl" button_title="Continue Shopping" style="button" href="$href"}

add to 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);

You can then use....

Code:
{include file="buttons/continue_shopping.tpl"}

whereever you like to give you a continue shopping button. I've got it next to the checkout button and also below 'Your shopping cart is empty'

sweet!
__________________
Core version: 5.5.xx
Reply With Quote
  #38  
Old 10-17-2005, 04:20 AM
 
fuzzy fuzzy is offline
 

Advanced Member
  
Join Date: Jun 2004
Location: oHIo
Posts: 77
 

Default

Works GREAT!
Thanks!!
__________________
X-Cart 4.0.12 Gold
Linux
Reply With Quote
  #39  
Old 10-24-2005, 02:11 PM
 
chrisinoz chrisinoz is offline
 

eXpert
  
Join Date: Aug 2004
Location: Australia
Posts: 248
 

Default

Thanks Swordfish and andreas04031. Your post worked fine for me in 4.016.

Reference: Posted: Mon Mar 07, 2005 5:52 pm Post subject: Easy continue shopping botton.

Small correction on code

From

Code:
>[img]/{$ImagesDir}/but2.gif[/img]

to

Code:
>[img]{$ImagesDir}/but2.gif[/img]

Cheers

Chris
Reply With Quote
  #40  
Old 10-25-2005, 08:04 PM
  shipmerchant's Avatar 
shipmerchant shipmerchant is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 361
 

Default

Quote:
Originally Posted by chrisinoz
Thanks Swordfish and andreas04031. Your post worked fine for me in 4.016.

Reference: Posted: Mon Mar 07, 2005 5:52 pm Post subject: Easy continue shopping botton.

Small correction on code

From

Code:
>[img]/{$ImagesDir}/but2.gif[/img]

to

Code:
>[img]{$ImagesDir}/but2.gif[/img]

Cheers

Chris



That "/" had me going too!
__________________
Mil Mascaras
Live Xcart Site #1-V- 4.1.8
Live Xcart site # 2-V 4.4.3
CDSEO Mod - Firetank MM30 - 7DANA- The bestTemplates!
Linux - EWD Host Servers awesome service!
AlteredCart One Page Checkout
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 04:44 AM.

   

 
X-Cart forums © 2001-2020