X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Continue Shopping (https://forum.x-cart.com/showthread.php?t=873)

smitty 03-15-2005 12:32 PM

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).


Isleman 03-17-2005 01:55 AM

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 .

ozpopzi 04-13-2005 09:24 AM

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~~ :)

smitty 04-13-2005 02:59 PM

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).


shipmerchant 04-15-2005 02:31 PM

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! :lol:


As they say, too much information.....should have read "Isleman" post above and saved myself a headache! :D

extreme 06-19-2005 07:59 PM

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.

xgarb 10-17-2005 03:08 AM

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!

fuzzy 10-17-2005 04:20 AM

Works GREAT! =D>
Thanks!!

chrisinoz 10-24-2005 02:11 PM

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

shipmerchant 10-25-2005 08:04 PM

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!


All times are GMT -8. The time now is 03:22 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.