| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Pulling my hair out ... Following Coupon Code | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Pulling my hair out ... Following Coupon Code
Hi All,
Going totally nuts here trying to customize my coupon to be on a different page. I have searched these forums and read every post that even has the word coupon in it, and while many mention this issue I'm having, not one has a solution. I am a relative novice at this and am doing my best to learn. Where I am at in following the code and my question... I have been able to move the location where it asks for a coupon code to just below the final pricing on the checkout page. This works flawlessly in calculating the coupon, but the problem is when a coupon is entered here it redirects to the incorrect page. This would seem pretty simple to fix, but for some reason it isn't in X-Cart. When I try to "follow the code" I am able to see that {$paymentid} is set when the customer gets to the final checkout page with Fast Lane Checkout (the page labeled "Place Order" where it shows all the items, subtotal, shipping costs, billing address, shipping address, and requests the credit card info.) Now when someone enters a coupon on that page and clicks submit, if it is a valid coupon it redirects them back one page to the "shipping and payment" page. If they leave the coupon blank entirely and submit, it takes them back to the very first page of "Your Shopping Cart". To clarify, I am referring to the submit with the coupon module (shop/skin1/modules/Discount_Coupons/add_coupon.tpl) not anything from any other element on the page. I did add something to both the skin1/modules/Fast_Lane_Checkout for both checkout_2_method.tpl and checkout_3_place.tpl to show me the value of {$paymentid}. When someone first goes to the Shipping & Payment page that value is null. After selecting Delivery method and Payment method then clicking on continue, it goes to the checkout_3 page and shows the value of {$paymentid} as 1, which is correct based on my selection. It also shows the variable {$payment_data.paymentid} as the value of 1 at this point. Here is where it gets even stranger. When a coupon is submitted, it "seems" to set both these values back to null and takes you back to the Shipping and Payment page. That page shows these fields as null. If prior to entering the coupon I make a duplicate tab of the final page, then enter the coupon code, and go to the duplicate tab and refresh, it still shows {$paymentid} as 1 AND shows the coupon properly applied to the invoice. If I were able to just get this thing to redirect to the place order page after a coupon is entered it would apparently fix the issue. I feel like a complete idiot that I can't follow the code enough to see where to put some kind of statement to have it go to the final Place Orders page after a coupon is entered. One other thing that I tried is entering manually the url that the software appears to use to go to the place order page in the first place (see cart.php in the shop/modules/Fast_Lane_Checkout/ folder --- which is the file it uses to determine which page to go to at any time) www.mysite.com/shop/cart.php?paymentid=$paymentid&mode=checkout this replies by taking me to the Shipping & Payment page with the URL of : http://www.mysite.com/shop/cart.php?mode=checkout&err=paymentid This specifically says that paymentid is the error. What I then did was just replace the $paymentid with the number 1. This worked, but I have no clue where to even place this to force it to go back (and what variable to use instead of $paymentid since that seems to be the issue, that this is somehow, for some reason, set back to null somewhere in this whole process.) The link that works perfectly is : www.mysite.com/shop/cart.php?paymentid=1&mode=checkout I tried changing the form action="cart.php" to form action="cart.php?paymentid=$paymentid&mode=checkou t" and no luck. I also tried the working line with the paymentid=1 in place of the variable and it still doesn't work. Anyone - PLEASE help - I have spent over 9 hours total now fighting with something that really should be simple. How do I make the coupon on the last checkout page link back to the same page where the form was submitted? *note: I did have to refresh the data from the server every time when I go to the place orders screen, so this doesn't appear to be a cache problem on my system. Thanks in advance for any reply! ~David P.S. I am on version 4.1
__________________
Version 4.0.16 |
|||||||
#2
|
|||||||
|
|||||||
Re: Pulling my hair out ... Following Coupon Code
Hi All,
I guess I may end up with some hair left on my head afterall ... because I found the correct place to make the edits, but still can't seem to pass through the $payment variable (I hardcoded in the number 1 since right now we only accept credit cards, and that works as a temporary solution.) The thread of files to get to this point is : shop/skin1/modules/Fast_Lane_Checkout/checkout_3_place.tpl Added the following file, which allows coupon entry (at this point, the variable $paymentid does equal what was selected by the customer in checkout step 2.) shop/skin1/modules/Discount_Coupons/add_coupon Posts to cart.php shop/cart.php Leads to the next step shop/modules/Discount_Coupons/discount_coupons.php File I edited, where I ended up hardcoding in the paymentid=1 but would like to be able to add more payment methods in the future, so still need help! cart.php?paymentid=1&mode=checkout What I replaced "cart.php?mode=checkout" with in the discount_coupons.php file so it goes back to the correct page. The only remaining question! : Anyone have any idea how to dynamically get the paymentid at this point so it doesn't have to be hard coded as the value of 1? Trying paymentid=$paymentid just leaves the value blank, so for some reason between the top step listed here, where $paymentid does equal whatever the customer selects, and this bottom step, it seems to completely lose any value of $paymentid and makes it null. Does it need to be passed through from step to step somehow, and if so, how would I do that, or is it stored somewhere as another variable so I can just use that in the URL string? Any help on how to do this would be appreciated! Thanks! ~David
__________________
Version 4.0.16 |
|||||||
#3
|
|||||||||
|
|||||||||
Re: Pulling my hair out ... Following Coupon Code
I did try this ones for the FLC without success. Not sure why QT put the coupon box in cart page in the first place. Can you post what you did?
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#4
|
|||||||
|
|||||||
Re: Pulling my hair out ... Following Coupon Code
Hi Steve,
There were a couple files I modified. 1) I edited shop/skin1/modules/Fast_Lane_Checkout/checkout_3_place.tpl to include the following (my edits in red) : Quote:
2) The second step was editing the file shop/modules/Discount_Coupons/discount_coupons.php in two places to reflect the correct func_header_location : Quote:
This is actually where my issue still comes in... the only way I could get this to work was to hard code in paymentid=1 instead of paymentid=$paymentid. I would prefer to use the value the customer entered for their payment id, but I just can't figure out where that variable is (or why it got reset to null after being entered by the customer) and how to put it in that link above to apply the correct method of payment if more than just one type exists. Hope this helps, and if you have any ideas on the payment id portion please let me know! Thanks, ~David
__________________
Version 4.0.16 |
|||||||
|
#5
|
|||||||||
|
|||||||||
Re: Pulling my hair out ... Following Coupon Code
Thanks. I will have to give it a try again
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#6
|
|||||||
|
|||||||
Re: Pulling my hair out ... Following Coupon Code
Payment id is saved in the cart. Try $cart["paymentid"]
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
|
#7
|
|||||||||
|
|||||||||
Re: Pulling my hair out ... Following Coupon Code
Ok I took it a little bit further because I don't want to force customers to login, register or fillout checkout info just to see how much they can save with the coupon (I know they can do simple math but still...). So I wanted the coupon discount form on cart page and last checkout page.
Thanks to David and Ralph. Here is my customization 1. Open skin1/customer/main/cart.tpl, find Code:
Code:
2. Open skin1/modules/Fast_Lane_Checkout/checkout_step_3.tpl, insert the discount coupon code (you can take it from the file above) and change the line with include file to Code:
3. Open modules/Discount_Coupons/discount_coupons.php, find (in 2 places) Code:
Code:
4. Open skin1/modules/Discount_Coupons/add_coupon.tpl, find Code:
Code:
5. Open skin1/customer/main/cart_total.tpl, find (in 2 places) Code:
Code:
6. Run cleanup.php
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#8
|
|||||||
|
|||||||
Re: Pulling my hair out ... Following Coupon Code
thanks dudeeeeeeeee!!!!!!!!!!!!!!!
__________________
4.2.3 |
|||||||
#9
|
|||||||
|
|||||||
Re: Pulling my hair out ... Following Coupon Code
Brilliant - can't believe that this is still missing even in 4.3.1
Thanks again
__________________
X-Cart 4.7.12 (Live) Redux Template CDSEO |
|||||||
#10
|
|||||||
|
|||||||
Re: Pulling my hair out ... Following Coupon Code
I'm not sure what I'm missing. I've gone through the steps but I don't have this file modules/Discount_Coupons/discount_coupons.php in my modules?
__________________
Version 4.1.10 Add-ons: X-SpecialOffers X-Magnifier X-FancyCategories |
|||||||
|
|||
X-Cart forums © 2001-2020
|