Apply Coupon via direct link

how can I embed the coupon into the link so when buyer click on the link from e-mail advertise site it will apply the coupon to the visitor shopping cart automatically, so the visitor don’t have to apply it when checkout.

Not that I’m aware of.

I request it with CS-Cart and they quote me 100 for this mod.

You can enquire how much it will cost to be developed by a mod builder, may be cheaper in the long run but at least you’ve got two quotes./

Anyone else interest in this mod? If anyone interest please reply so we can share the cost.


We can offer you the following project.

We will add the ability to apply coupon via a link.

If customer clicks on your banner post somewhere on the internet then he will be redirected to your site and a specific coupon/discount will be applied to the visitor cart.

We will add the coupon ID information to the URL e.g. [url][/url]

The system will automatically recognize the coupon ID and apply it to the cart.

The modification of such complexity will cost $100

We can start working for you in 15 business days after the payment is made.

The whole task will take us 3-4 days to complete.



Yes we will add the example of coupon link to the coupon details page in the back-end

e.g. [url]Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days

Yes, the coupon link will contents the special coupon number

e.g. [url][/url]

And if customer uses such link then the coupon #1000456 discount will be activated for him on checkout page.

I have discussed your request with the developer and we found it possible to perform this modification only for $75. But in this case whole task will take us 8-10 days to complete.


I’ll stand by this, with 1 more person I think $33 will be reasonable? paypal ok?


I should ask but is it possible to add the coupon id as a text variable?

ie Customer

Oh and the more the merrier people!

If I had more cash at the moment I’d probably be in… If it gets down to about $10 each let me know! Not much space in our budget at the moment, Google is eating everything at the moment!

Hehe, I’m lucky enough not to be googling at the moment. Although a tenner would be good if we got more people in obviously…

Well its something that would be nice but I’m not desperate for it.

Also I’m on 1.3.3 so it might be a problem for me if it gets developed for 1.3.4.

Keep this post updated though and we’ll see what happens

I’m not sure but i think it’s possible, let me confirm it with CS Developer.

reply from CS-Cart

[QUOTE]In this case we can add the coupon name information to the URL e.g.


The system will automatically recognize the coupon ID and apply it to the cart.[/QUOTE]

This can be done with a session variable, shouldnt be that difficult to code in atall

on page load, set a session variable based on the url…

When on the checkout page, if the variable is set populate the form…

Easy as that !!!

Infact, even easier than that… I will add code shortly to enable coupon via a link… :wink:

Amen Brother!

I’ve been awaiting something like this to be developed,

I can now visit forums with intentions to allow discounts :smiley:

Ok here goes…

3 files to edit, this relies on coupon being sent as

edit /index.php and add the RED CODE (near top of file)

[SIZE=1]if (!empty($settings['General']['store_access_key'])) {
if (!empty($_GET['store_access_key'])) {
$store_access_key = $_GET['store_access_key'];
if ($store_access_key != $settings['General']['store_access_key']) {
[COLOR=red]if (!empty($_GET['coupon'])) {[/COLOR]
[COLOR=red]$url_coupon = $_GET['coupon'];[/COLOR]

Edit /includes/customer/checkout.php

[SIZE=1]// Step 2: Shipping and payment methods

and add the red code

[SIZE=1][COLOR=red]$smarty->assign('[/COLOR][/SIZE][COLOR=red]COUPONVIAURL', @$url_coupon[SIZE=1][SIZE=2]);[/SIZE]
$smarty->assign('payment_methods', @$payment_methods);
$smarty->assign_by_ref('cart_products', $cart_products);

Edit /skins/…/customer/cart_pages/discount_coupon.tpl

Change the following line to include this code



I’m yet to try this SWS (testing a store at the moment) but let it be known you ROCK!

By chance is it possible to add a url as a discount coupon?


“By chance is it possible to add a url as a discount coupon?


Yes it is !! :smiley:

The only issue with this at the moment, is the session is registered in index.php so this must be the landing page…

I will extend it some time to include any page and tommorow if I get a spare 5 minutes or so will make it auto apply the discount coupon.

Thanks I just tried it out and got this error when try to checkout

Parse error: syntax error, unexpected ‘[’, expecting T_VARIABLE or ‘$’ in C:\VertrigoServ\www\TEST\eShops\include\customer\checkout.php on line 289

i’m using 1.3.4 SP3 and at step 2 I can’t find

[FONT=Courier New]

$smarty->assign(‘payment_methods’, @$payment_methods);

$smarty->assign_by_ref(‘cart_products’, $cart_products);



I just found

$smarty->assign(‘payment_methods’, @$payment_methods);

$smarty->assign_by_ref(‘cart_products’, $cart_products);


Delete the


[/font] parts, thats the forum adding them into my post… I will try and fix.

As it says, only add the parts coloured RED ! All this does at the moment is allow you to pass a coupon code to the checkout pages…

The rest will come tommorow. !!!

Ok, maybe not tommorow… here it is !

Add the following code "[COLOR=“Blue”]blue text to show you where to start and end…[/COLOR]

file : include/customer/checkout.php

[COLOR="blue"]// Step 2: Shipping and payment methods
elseif ($mode == 'checkout') {[/COLOR]

if (($url_coupon) && ($_GET['applied'] =="yes")) {
} else {
$coupon_code = @$url_coupon ;

if (!empty($coupon_code)) {
$partner_coupon_used = false;
$delim_len = empty($settings['Affiliate']['coupon_prefix_delim']) ? 0 : strlen($settings['Affiliate']['coupon_prefix_delim']);
if (@$settings['Affiliate']['use_partner_id'] == 'Y' && !empty($delim_len)) {
if (($delim_idx = strpos($coupon_code, $settings['Affiliate']['coupon_prefix_delim'])) != false) {
$delim_chr = substr($coupon_code, $delim_idx, $delim_len);
if ($delim_chr == $settings['Affiliate']['coupon_prefix_delim']) {
$partner_id = intval(substr($coupon_code, 0, $delim_idx));
if (!empty($partner_id)) {
$coupon_code = substr($coupon_code, $delim_idx + $delim_len);
$partner_coupon_used = true;
} else {
$prefix_length = 10;
$delim_chr = substr($coupon_code, $prefix_length, $delim_len);
if ($delim_chr == $settings['Affiliate']['coupon_prefix_delim']) {
$partner_code = substr($coupon_code, 0, $prefix_length);
$partner_id = fn_any2dec($partner_code);
if (!empty($partner_id)) {
$coupon_code = substr($coupon_code, $prefix_length + $delim_len);
$partner_coupon_used = true;

if (fn_check_coupon($coupon_code, $cart, $auth, true) == true) {
$coupon = db_get_row("SELECT discount_id FROM $db_tables[discounts] WHERE coupon_code='$coupon_code' AND avail='Y'");
if (!empty($coupon)) {
// The Coupon is saved in partner data as partner's coupon
// and Partner ID is saved
if ($partner_coupon_used) {
$partner_data['partner_id'] = $partner_id;
$partner_data['discount_ids'][$coupon['discount_id']] = $coupon['discount_id'];
$_suffix = "&$mode_name=checkout";
include $core_dir .'include_addons.php';

[COLOR="blue"]// If no valid coupons than disable coupon code mainbox[/COLOR]

There is a bug with this, in that you cannot delete the coupon