RealTimeDesigner Support Network
Wiki Forums Libraries Docs Support RealTimeDesigner Home
Welcome! Log In Create A New Profile


Creating a "discount code" using coupons - a simpler version

Posted by Alex 
Creating a "discount code" using coupons - a simpler version
April 24, 2012 06:36PM
This tutorial is very similar to this other one I've already posted.
It's different because it's simpler, focused on a specific scenario.

This tutorial is about how to create a discount code off entire cart contents.

Applying to entire cart contents means applying to every entry of your pricing matrix.

So, the way is to create an external variable, create a discount rule, and apply that rule to all of your pricing matrix entries.
A quick step-by-step guide:

1) go In PRODUCT CONFIGURATOR OPTIONS => Manage/Define External Variables
2) Add a new variable named "coupon_code" and set both Show in cart as coupon code and Expire With Submittal to yes
3) click on top the Manage/Define External Variables Rules link
4) add a rule with:
Rule Name: discound_fullcart
Rule Desc: 20% off
Source Variable: coupon_code
Checkvalue: MyCouponCode
Modifier: 0
% Modifier: -20
5) open a product with PRODUCT OPTIONS => Configure Products => [your product] => Configure Pricing Structure
6) click the Apply External Variables Rules button
7) enable the discound_fullcart rule for all of the visible values
8) repeat 5-6-7 for all the products you want to be affected by the discount rule

That's basically it. Once done, the customer will see in cart a coupon code area.
If he will enter the MyCouponCode value, rule will become active and, with this setup, would apply a -20% to every used price value.
If in future you want to change the discount, you can edit the rule and edit the modifier.
If you think you'll want multiple discount codes (for example, one for -15% and one for -20%), just create another rule and assign that too to all of your products.

For this reason, it could be a good idea to create a couple "zero rules" (so rules with ZERO modifiers that will not affect pricings) and assign them all when performing steps 5-6-7 the first time.
In other words, have them already there as placeholders, so it will be very quick to add multiple codes in case you'll ever need them.
Re: Creating a "discount code" using coupons - a simpler version
November 30, 2012 08:19PM

For step #4 It is now possible to upload a Muptiple Codes File, instead of activating the rule against a single checkvalue match.
you need to create a simple text file, and place one valud coupon code per each line. So, something like this:

If you'll upload such file into the new Multiple Checkvalues File field, all those codes will be valid matches for the rule.
Moreover, when one of the codes is used and an order is sent by making use of it, the used code will be removed from the file.
When the file will have no more codes, rule will basically become inactive.
This is the best way to have mutliple dicount codes that can be used only once.

This quote is from the Manage/Define External Variables Rules page:


If you fill the checkvalue field, passed string will be checked against it.
Multiple Checkvalues File can be used if you want multiple checkvalues to be valid for the same rule.
If you will upload a file, the checkvalue field will be forced to be empty.
Moreover, when an order is submitted and one of the values defined in the Multiple Checkvalues File is used, that value will be removed from the file.

So, Multiple Checkvalues File is the method to use in case you want to provide your customers codes that can be used only one time (for example, discount codes for a campaign)
-------> The file you have to submit must be a simple text file, with one code per line. <-------
If the file is uploaded, this page will also show how many codes are still available.
When a customer will use the latest available one you will read 0 entries left and the rule will be no more active until you upload a new file, or remove the file and set a single checkvalue.

The update announcing this new feature is here
Re: Creating a "discount code" using coupons - a simpler version
February 01, 2014 05:36PM

Hello. I have followed your instruction to successfully add the coupon code. However, it did not meet my needs.
What I want to do with coupon code is to send the coupon to multiple existing customers to give them discount(15%, 20% .....etc) for future orders. I want send out single coupon code to everyone to be able to use it as they check out the order. The submited coupon code will expires for that particular customer who used it by submiting the order, while other customer who received the coupon still have a capability to use it until I remove the coupon code in my RTD system. Can this be done?
Re: Creating a "discount code" using coupons - a simpler version
February 02, 2014 07:40PM
Sorry but no. It isn't possible to expire a single code for a single specific user only.
If you want them to be able to use a code one time only, you'd need to have different codes to be sent to each users usign the Multiple Checkvalues File.
A single code can work as a static discount code, but not as something that expires on a per-user basis.

However, personally I don't think it would be a great idea to have the same code anyhow: even in the event we would support that, simply ordering with a different email would allow users to use the discount over and over.
Re: Creating a "discount code" using coupons - a simpler version
June 07, 2018 03:57PM
this is great information and it works, however, it works so well it shows on EVERY PRODUCT not just the products I've activated it for
how do I turn it on only for certain categories or products and off for others?
it even shows across stores! of which we have 6. so now my coupon that's supposed to be only for real estate products on is showing in products, products, products, etc, etc.
I need it to only show in the products I've activated it on in RTD, I've turned it on on all of my real estate products in, how do I turn it off for everything else? our owner is not happy that it's showing up in EVERY CART, in EVERY STORE!
Re: Creating a "discount code" using coupons - a simpler version
June 07, 2018 04:41PM
testing trying to use the instructions above the coupon area

URL METHOD: add &extvar_myvar=alpha to the url
where extvar_ is added at the beginning of my extra code
myvar is the external variable name
alpha is the external rule name

not working, unless I have the show in cart set to yes. when I set the show in cart set to yes it shows in EVERY products's cart on EVERY store on EVERY website.
your help is much appreciated.
Re: Creating a "discount code" using coupons - a simpler version
June 08, 2018 04:49AM

I see a little confusion in here.
It is not possible to limit the products the code is going to be used on: if you think at that, cart could contain multiple products, and only some of them might have actual rules.
Infact the stting to show the code in cart is NOT something you do at product level, but GLOBAL in Manage/Define External Variables => Show in cart as coupon code.
This means also that it is not a per store setting either. It's just global.

That said, although it shows everywhere, it should actually APPLY discounts only on products having extvar rules assigned to it.
In short, if you do have a product in cart that's not having rules, no matter the discount code you enter in the field no discount should be applied.
This means that your goal is to hide that yourself when you feel it's not needed.

The extvar code has a class, extvars_container.
This means that a simply CSS can actually hide that from user, like this:
.extvars_container { display: none; }
This can be placed into a style tag right in your footer code for designer of your other stores, and this will prevent it from being visible at STORE level.

If you do not really need users to see it at all and you're good with the 2nd method you mentioned (the URL method), then just disable the Show in cart as coupon code setting.
About this, what you're saying there sounds strange though: the "Show in cart" is just a way for customers to enter the code manually, and makes no difference about fields passed with the URL method.
I mean, if you use the URL method the value should be used no matter what the "Show in cart" value is.
Is it possible you're not formatting the URL right?
In that case I'd need to see the actual URL you're trying to use. You can PM it to me if you prefer not to post it here in public
Re: Creating a "discount code" using coupons - a simpler version
June 08, 2018 08:24AM
I was hoping the 'show in cart' set to no, coupled with the url method would only show the box to enter the coupon code on the products to which I added the url blurb, but I see now that is not the case.
I've passed the code on to the developer who will implement it so at least it won't show on the stores it is not affiliated with or offered through. it is weird that you did not set up an option to just assign it to specific categories or products, but I understand it's just a global feature.
thanks, will let you know what happens.
Re: Creating a "discount code" using coupons - a simpler version
June 08, 2018 09:50AM
I understand the confusion, but logically it is not wierd at all.
The feature is a price modifier one, which can also be used as coupon as an extent.
Technically you an already not-assign products to it: all you need to do is not set modifier rules in the product itself.

This however means you can already control if it will "apply" on a product, so your question is really just about showing the coupon code field in the cart. Doing this at product level would REQUIRE to have a separate coupon field for each and every product, instead of one for the whole cart.

Reason is pretty simple: suppose such product option exists and you have product A which it set to "show", and product B set to "not show".
In the event both products A and B are added to the cart, what should the tool do? At the end, it would be forced to ignore in any case one of the 2 settings, unless the coupon code is product specific as well (which would mean to show one field per cart entry, making it extremely complex to manage and more confusing for end users).

This because when you see the cart you are no more viewing a "specific product": you see everything it contains, which can also be mulptile products. And this makes impossible to trigger global options at a single product level.

Hope it makes better sense now!
Sorry, only registered users may post in this forum.

Click here to login