Apply Coupon via direct link

[quote name=‘SWS’]There is a bug with this, in that you cannot delete the coupon[/quote]



Editing the SQL database will release the coupon code at all?

Or do you mean that the code will stay the entire duration of the customer’s visit?

I mean from the checkout page, the user cannot remove the coupon…



Dont worry, nothing to do with the backend / coupons and discounts…

Sweet, so far so good, hope you or other coders can fix the other bugs

I kinda like the idea of that bug, enforces the user to specify they’re referral ID, inclusive add more discount possibilities for referral admins

Certainly going to make things easier when advertising special offers…



Thanks for the motivation, I would never have thought about it…



The bug is caused by me specifying an url variable when applied, for some reason, maybe tiredness :smiley: I couldnt get it to work using if != either so had to use if / else



Im sure CS would have made it a bit more fancy for $100

??? So you fixed the bug ? Anyways are you open for donation? Just a little donation to show my appreciation.

No donation necessary, but thanks for the offer…



Im afraid the bug still isnt fixed, but will be soon… promise…



Dont let that stop you using it, I mean… who in their right mind would want to remove a discount from their cart and pay more anyway ???



Other than that… its working fine, auto adds the discount etc.

[quote name=‘SWS’]Dont let that stop you using it, I mean… who in their right mind would want to remove a discount from their cart and pay more anyway ??>[/quote] Nice people lol

[quote name=‘JesseLeeStringer’]Nice people lol[/quote]



Now if that wasnt a post to get +1 to your post count… lol…

guess im guilty too

Yes i’m going to use that in my shop.

I’ll have to use this one. Many thanks for sharing this code. Looking forward to the ‘bug’ fix. Perhaps also there can be some other imrpovements thought of… For example;



When adding a new coupon, show the link url - as it does with the CMS, probably very easy template change.



Ability to land on a certain page, eg a particular product or category.



etc.

Im also going to need the “landing on certain product page”



Im sure its only a matter of placement within the files, Will let you know when I find it.

Cool, looking forward to it already :wink:

Removal of the coupon bug can be fixed as below



edit include/customer/checkout.php



add and change the red code below.




if ($REQUEST_METHOD == 'POST') {

$_suffix = '';

// Delete discount coupon
if ($mode == 'delete_coup') {

[COLOR="Red"] sess_unregister('url_coupon'); // Add this if you want to remove it from the session also[/COLOR]

[COLOR=red]unset($url_coupon); [/COLOR]
unset($cart['coupons'][$c_id]);
$_suffix = "&$mode_name=checkout[COLOR=red]&applied=yes[/COLOR]";
}

// Update products quantity in the cart
if ($mode == 'update') {


Cool, thanks for your hard work.



I might give this a go later if I can find the time.



Cheers

No worries…



Ive had a play trying to apply it to products pages, but no success as of yet… the above now works perfectly though :wink:

Its desierable but not essential. This is a great mod and it will make sales promotion easy for loads of us. I’ve got about 200 email addresses of customers from my old site who I’ve been wanting to send a coupon too, so it should be a good test for this.



Cheers

that was fast SWS I’ll update it later

I always try and get things done quick… especially if I want them myself :lol:



As I say, it wasnt that difficult, just a case of finding the right places to put things…

Just to let you all know…



I have passed this Mod to CS-Cart for inclusion / improvement in CS 1.3.5