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)

Kanyon71 12-04-2002 12:41 PM

Continue Shopping
 
I did a search on every way I could think of but didn't find anything. I need to add a button in the catalog that says Continue Shopping after you have added items to your cart. Any ideas on how I can do this? I want it to take you back to where you where last shopping.

shan 12-04-2002 01:54 PM

Theres a couple of things that you could do ...

Either unset Redirect customer to cart in general settings to stop the customer giong to the view catr page when they add a product

or

create a new button file called continue_shopping.tpl that contains the following code.


the (-2) part is how many steps you wish to take them backwards. (-1) would take them back to the last product detail page or (-2) would move them back 2 steps and thus go to the products list page.

Now where ever you want that to appear just add this code ...

Quote:

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

Its not perfect but it does the job most of the time

Cefko 12-05-2002 04:20 AM

Which is best practice? To send them to cart when they "add" or not to send them to cart?

shan 12-05-2002 04:24 AM

up to you I suppose but I reckon its best to show them the cart after choosing a product just so that they know its been added and dont try and add it again

Kanyon71 12-05-2002 05:55 AM

Ok I am feeling pretty stupid about right now, where do I need to put the code to call this? I am not sure which file is getting called to display what you are seeing after adding a product.

shan 12-05-2002 06:00 AM

if you switch on the debug console in your admin area you should see what tpl files are being loaded for each page.

Im pretty sure that want to be looking at cart.tpl though

Kanyon71 12-05-2002 06:43 AM

Yeah it was, I found it after a little digging, had a brain lock when I was typing. :D

parmar 03-30-2004 12:12 AM

Ok, this is a very old post I'm replying to, but I'm thinking of adding "continue shopping" button at the View Cart and Checkout stage.

I have tried to work with by disabling "redirect customer to cart" and although I have three "view Cart" and "checkout" links on our pages, customers seems to be getting confused once they add an item to cart, and when the shop doesn't direct them to a cart iteself after adding that item. I find that surprising but hey, customers are alway right.

What I need to do is redirect customers to the Category they were at and not direct them always to the last page they were at. Sometimes a customer will choose to see a product page and than add that product to a cart, or they may add an item using "Buy now" from within the Catagory pages. (-1) setting will redirect them to the last page they were at, which will be fine if they were on Catagory page, but if they added an item at Product page this will redirect them back to that product page. I wish them to be redirected to the Catagory page always. How do I go on about implimenting this?

GM 04-30-2004 04:59 PM

TRY THIS...

1:) Create a new button file in /buttons called

continue_shopping.tpl that contains the following code:

Code:

{include file="buttons/button.tpl" button_title=$lng.lbl_continue_shop}

2:) In Admin go to "languages" edit languages and create a new

entry called "lbl_continue_shop" (without the quotes)

Now in cart.tpl or where ever you want the button to appear just add this

code:


DONE!

longhorn180 05-24-2004 05:51 AM

I could'nt get these methods to work, so I tried something that is pretty much what was suggested above, but without the tpl file. I just created a label called lbl_continue_shop with text reading Click Here to Continue Shopping and added this code to customer/main/cart.tpl below the checkout and submit labels and below the your shopping cart is empty labels:


{$lng.lbl_continue_shop}



This works great for me.

Brian Peat 08-29-2004 06:10 PM

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.

Allan Martel 09-28-2004 07:36 AM

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

roccons 12-01-2004 07:35 AM

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.

elomibao 12-05-2004 09:24 PM

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

roccons 12-06-2004 12:47 PM

Nice!
It seems that it's exactly what I was looking for.
I'll implement that soon.
Thanks, elomibao

elomibao 12-06-2004 02:17 PM

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. :mrgreen:

inthepink 01-06-2005 11:48 AM

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

roccons 01-12-2005 06:54 AM

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.

elomibao 01-12-2005 05:11 PM

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!

roccons 01-12-2005 06:10 PM

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.

PersonalizedFitness 01-13-2005 07:47 AM

Elomibao, on that last piece of code you posted ... what tpl did you apply that too ?

Thanks

elomibao 01-16-2005 06:28 PM

Quote:

Originally Posted by PersonalizedFitness
Elomibao, on that last piece of code you posted ... what tpl did you apply that too ?

Thanks


The last one? cart.php

roccons,

You're right. The solution I posted will have the Continue Shopping button taken out once a product has been removed from the cart.

jkirkpatrick 01-28-2005 10:37 AM

Elomibao - you listed "Redirect" code in an earlier post. Where do I find this code to make the change you suggested?

Thanks,
Jennifer

Jon 01-28-2005 10:34 PM

I've created a mod that uses a redirect landing page which makes it clear the product was added, gives them the option to continue shopping, checkout, and uses the links you set in upselling to encourage them to purchase the related products.

For more information or to demo visit:

http://www.websitecm.com/store/customer/product.php?productid=84

elomibao 01-30-2005 07:28 PM

jkirkpatrick,

In cart.php, look for this chuch of code:

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");
                }
        }
}


replace:
Code:

func_header_location("cart.php");

with:
Code:

func_header_location("cart.php?mode=added");

Jon,

Interesting solution. You don't get redirected to a cart but a page that allows you to continue shopping or checkout. There are advantages and disadvantages to this. It's all up to them what to implement. Nice work. :wink:

andreas04031 02-16-2005 01:32 AM

well, I think many of these solutions are not working or too complicated. I just added to customer/main/cart.tpl the following code:
Code:

<TD align="right"><TABLE border="0" cellspacing="0" cellpadding="0" onclick="javascript: self.location='home.php'" style="cursor: pointer;" valign="middle">
<TR><TD>[img]/cart/skin1/images/but1.gif[/img]</TD>
<TD class="Button" valign="middle" nowrap><FONT class="Button">Continue shopping</FONT></TD>
<TD>[img]/cart/skin1/images/but2.gif[/img]</TD></TR>
</TABLE>


right above the code

Code:

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


it is in around line 99 in my file (version 4.0.11).

This is the original xcart code from the invoice page, there is already a Continue Shopping button.

Andy

elomibao 02-17-2005 06:37 PM

Your solution only redirects the shopper to the home page. Not exactly what other people wanted. Some people wanted to get redirected to the last Category they shoped from. No sense in going back to the home page and re-clicking the categories to get back to where you came from.

Again, it's up to them what to implement. And I think some of the solutions posted above are pretty straight forward and very easy to implement.

andreas04031 02-17-2005 07:43 PM

Well, I wasn't critizising the other solutions, they are actually pretty neat =D> but with some drawbacks.
I just look at this:
Quote:

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. + Buy Now code in templates must be disabled
= something is not working and buy now must be disabled.

Quote:

...but it doesn't work the same way in Opera
= not working for opera visitors

= loads the very first page, well... we don't have to let them go that far back :wink:

Why do we assume the visitor want to go back to the same category he came from? We don't know that for sure but we know for sure if he want's to resume shopping he want's to stay in the shop, not in the very first page but in the shop.

Again, all solutions may work well in one or another way, to make sure it works in all cases - no matter what browser is used - let them go with a simple link back to the shop start page.

I think we all agree: this shouldn't be any matter for a custom mod, this should be included in the standard XC code :) as many other nice and smart solutions we all can find in this forum - it is not my intetion to make any code looking bad, if you and all the other ones felt that way... I apologize, I just wanted to add another, very simple and "works always" solution, Andy

elomibao 02-17-2005 10:29 PM

Sorry if I sound as if I was offended. I wasn't. If you look at my first reply on this thread (located on the first page), there were conditions and situations where I mentioned how shopping should work the way I wanted it. If an x-cart user wanted the same thing, then good. If not, it's good also because there were other solutions that we're available.

It's all good. :mrgreen:

swordmart 03-07-2005 01:52 PM

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>


Above This in your /customer/main/cart.tpl
Code:

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


or if you dont have any mods on cart.tpl just replace cart.tpl with this:
Code:

{* $Id: cart.tpl,v 1.74.2.9 2004/12/14 08:24:21 svowl Exp $ *}
<H3>{$lng.lbl_your_shopping_cart}</H3>
{$lng.txt_cart_header}
{if $active_modules.Gift_Certificates ne ""}
{$lng.txt_cart_note}
{/if}



{capture name=dialog}
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/cart_offers.tpl"}
{/if}



{if $products ne ""}
<FORM action="cart.php" method="post" name="cartform">
<TABLE border="0" width="100%">
{section name=product loop=$products}
{if $products[product].hidden eq ""}
<TR><TD width="90" align="center" valign="top">
{if $active_modules.Special_Offers ne "" and $products[product].have_offers}
{include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]}
{else}
{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$products[product].image_x image_y=$products[product].image_y product=$products[product].product tmbn_url=$products[product].tmbn_url}
{/if}
</TD>
<TD valign="top">
<FONT class="ProductTitle">{$products[product].product}</FONT>



<TABLE border="0" cellpadding="0" cellspacing="0" width="100%"><TR><TD>
{$products[product].descr}
</TD></TR></TABLE>




{if $products[product].product_options ne ""}
{$lng.lbl_selected_options}:

<TABLE>
{foreach from=$products[product].product_options item=v}
<TR>
        <TD>{$v.class}:</TD>
        <TD>{$v.option_name}</TD>
</TR>
{/foreach}
</TABLE>




{/if}
{assign var="price" value=$products[product].display_price}
{if $active_modules.Product_Configurator ne "" and $products[product].product_type eq "C"}
{include file="modules/Product_Configurator/pconf_customer_cart.tpl" main_product=$products[product]}
{assign var="price" value=$products[product].pconf_display_price}



{/if}
<DIV align="left">
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice and $products[product].product_type ne "C"}
{include file="modules/Subscriptions/subscription_priceincart.tpl"}
{else}
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/cart_price_special.tpl"}
{/if}
<FONT class="ProductPriceConverting">{include file="currency.tpl" value=$price} x {if $active_modules.Egoods and $products[product].distribution}1<INPUT type="hidden"{else}<INPUT type="text" size=3{/if} name="productindexes[{$products[product].cartid}]" value="{$products[product].amount}"> = </FONT><FONT class="ProductPrice">{math equation="price*amount" price=$price amount=$products[product].amount format="%.2f" assign=unformatted}{include file="currency.tpl" value=$unformatted}</FONT><FONT class="MarketPrice"> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$unformatted}</FONT>
{if $config.Taxes.display_taxed_order_totals eq "Y" and $products[product].taxes}
{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}
{/if}
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/cart_free.tpl"}
{/if}
{/if}




{include file="buttons/delete_item.tpl" href="cart.php?mode=delete&productindex=`$products[product].cartid`"}
{if $products[product].product_options ne ''}
{if $config.UA.platform eq 'MacPPC' && $config.UA.browser eq 'MSIE'}
{include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');" js_to_href="Y"}
{else}
{include file="buttons/edit_product_options.tpl" href="javascript:window.open('`$catalogs.customer`/popup_poptions.php?target=cart&id=`$products[product].cartid`','POptions','width=400,height=350,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');"}
{/if}
{/if}
</DIV>
</TD></TR>
<TR><TD colspan="2"><HR size="1" noshade></TD></TR>
{/if}
{/section}
</TABLE>
{if $active_modules.Gift_Certificates ne ""}
{include file="modules/Gift_Certificates/gc_cart.tpl" giftcerts_data=$cart.giftcerts}
{/if}
{include file="customer/main/cart_totals.tpl"}




{if $js_enabled}
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD>
{include file="buttons/update.tpl" type="input" href="javascript: document.cartform.submit()" js_to_href="Y"}

{include file="buttons/button.tpl" button_title=$lng.lbl_clear_cart href="cart.php?mode=clear_cart"}
</TD>
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/cart_checkout_buttons.tpl"}
{/if}
<TD align="right"><TABLE border="0" cellspacing="0" cellpadding="0" onclick="javascript: history.go(-2)" style="cursor: pointer;" valign="middle">
<TR><TD>[img]/xcart/skin1/images/but1.gif[/img]</TD>
<TD class="Button" valign="middle" nowrap><FONT class="Button">Continue shopping</FONT></TD>
<TD>[img]/xcart/skin1/images/but2.gif[/img]</TD></TR>
</TABLE>
<TD align="right">
{include file="buttons/button.tpl" button_title=$lng.lbl_checkout style="button"  href="cart.php?mode=checkout"}
</TD>
</TR>
</TABLE>
{else}
<INPUT type="hidden" name="mode" value="checkout">
{include file="submit_wo_js.tpl" value=$lng.lbl_checkout}
{/if}
</FORM>
{else}
{$lng.txt_your_shopping_cart_is_empty}
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_items content=$smarty.capture.dialog extra="width=100%"}
{if $cart.coupon_discount eq 0 and $products ne ""}



{if $active_modules.Discount_Coupons ne ""}
{include file="modules/Discount_Coupons/add_coupon.tpl}
{/if}
{/if}


Thanks to andreas04031 ;)

viewable on my store (not live) http://shop.swordmart.co.uk

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 05:51 AM.

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