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

Coupon box on final page of Checkout

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 02-13-2008, 10:41 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Coupon box on final page of Checkout

One of the things I have always hated about the discount coupon in X-Cart is that it is on the cart page. This causes a ton of problems when you are trying to give free shipping or 'per customer' discounts, as the customer needs to be logged in to use these. So today I simply tried adding the discount coupon code to the checkout page, and low and behold, it almost works! A few tweaks to the code and you can have it working this way too.

NOTE: I have not fully tested this, as we are using a custom checkout so I can't verify if this works on a stock install. Make backups first and test it out for yourselves. THIS WILL NOT WORK WITH FAST LANE CHECOKUT

1. First, you'll need to move the discount code from cart.tpl to checkout.tpl. Open up customer/main/cart.tpl and comment out this, and then copy it to your clipboard:

Code:
{if $cart.coupon_discount eq 0 and $products ne ""} <p /> {if $active_modules.Discount_Coupons ne ""} {include file="modules/Discount_Coupons/add_coupon.tpl} {/if} {/if}

Then open up customer/main/checkout.tpl and paste the code in where you want it to appear. It is important that you put this outside of any other forms on that page, as you can't have a form inside a form.

2. Next you'll need to edit modules/Discount_Coupons/discount_coupons.php and change the redirect. So find two instances of this on line 83 and 88:

func_header_location("cart.php");

and replace with this:

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

Again, I have not fully tested this, but this was done on a 4.1.8 version, so test it out for yourselves and report back here with your findings. The templates for Fast Lane Checkout will be different, and as I don't work with that module I can't tell you what they are. Perhaps some other kind soul will get this working for that module as well.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #2  
Old 02-13-2008, 04:06 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Coupon box on final page of Checkout

Hey balinor,

That was bodering me too. Very nice and clean solution. Thanks for posting it. I did try it on my test site and it seems to work fine. I put the code between the cart and payment method selector. The coupon was applied with the correct amount and everything. Even when I went back to "View Cart" after applying the coupon, the cart was showing the amouth as discounted as I think it should. I also tested it with adding more products, changing the quantity in the cart, removing items from the cart... it was changing the discount number accordingly. The test checkout went fine and order was placed with the discount. So I thing it works the way you have it. At least for what I've checked.
One thing though - I just saw that after a coupon is applied the cart table listing the products also lists the coupon discount for each product but the title on the table, the label "discount" under subtotal, and on the invoice doesnt show how much is the discount. Not the amount taken off but the coupon itself - 5%, or $5, ... Is there any way to show this? Now customers will only see that there is a discount applied but they will have no idea what kind of discount.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 02-13-2008, 04:14 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Coupon box on final page of Checkout

Hmmm...that shouldn't have anything to do with this mod, I'm guessing that is default X-Cart behavior. Let me see if I can find a fix, as it should work just like the cart summary.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 02-13-2008, 04:21 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Coupon box on final page of Checkout

Maybe my question was confusing the way I put it here. Here is what I meant (from my test order):

Subtotal: $1,013.96
Coupon saving (aaa): $50.70
Discounted subtotal: $963.26
Shipping and handling: $19.80
Sales Tax 7.00%: $68.81
Total: $1,051.87

Is there any way to have "Coupon saving (aaa): $50.70" to show like this
Coupon saving (5%): $50.70 or Coupon saving (aaa-5%): $50.70

Right now is showing only the coupon name as setup by the admin. I hope this now is more clear.
Oh and yes this has nothing to do with your mod. Just something I saw now.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 02-13-2008, 04:26 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Coupon box on final page of Checkout

Ah, I'm sure there is a way to do that, just don't have time to figure it out at the moment
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #6  
Old 02-13-2008, 04:34 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Coupon box on final page of Checkout

That's perfectly fine. Whenever you get a minute or so Thanks
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #7  
Old 02-22-2008, 05:07 AM
  wardworth's Avatar 
wardworth wardworth is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 78
 

Default Re: Coupon box on final page of Checkout

Hi,

Has anyone got this working with fast lane checkout yet? I've modified all the relevant files and changed the redirect, but when I click on 'submit' on the redeem coupon (i've placed it after payment method) it does nothing. Clicking on the continue button below this takes me back to cart contents for some reason.

Any ideas?
__________________
:: Wardworth Ltd
:: X-Cart 4.1.8
Reply With Quote
  #8  
Old 02-22-2008, 07:53 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Coupon box on final page of Checkout

You'd need to change the redirect to whatever the page the coupon is on. I don't use Fast Lane so I don't know what that is.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #9  
Old 02-29-2008, 01:20 AM
  wardworth's Avatar 
wardworth wardworth is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 78
 

Default Re: Coupon box on final page of Checkout

I don't quite understand what you mean in regards to the redirect. I'm moving the discount coupon to the checkout_2_method.tpl in fast lane checkout, but this is still cart.php?mode=checkout in the url. Is that right?
__________________
:: Wardworth Ltd
:: X-Cart 4.1.8
Reply With Quote
  #10  
Old 02-29-2008, 01:29 AM
  wardworth's Avatar 
wardworth wardworth is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 78
 

Default Re: Coupon box on final page of Checkout

I've just tried changing it to cart.php?mode=checkout and the coupon submit button still doesn't work (javascript problem?), and the continue button just bounces me back to the shopping cart items page.

Can anyone help please?
__________________
:: Wardworth Ltd
:: X-Cart 4.1.8
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 06:41 PM.

   

 
X-Cart forums © 2001-2020