Jump to content

Conditions Apply To A Promotion


owengreaves

Recommended Posts

Hi There,

 

This seems like it should be easy but I'm obviously not the sharpest tool in the shed.

 

I have a promotion, it will run for one month, I want to display a message if and when the PROMO CODE code is used on webhosting packages, as it will only work on hosting packages.

 

As soon as the PROMO CODE is submitted, I want to show a message - Conditions May Apply to this PROMO - and then display the conditions, how would I do this?

 

 

Thanks,

Edited by owengreaves
Link to comment
Share on other sites

Hi Owen,

 

exactly how will depend on which order-form template you're using and when/where you want to display the message... but the basic way would be...

 

{if $promotioncode eq "whatever"}message to display{/if}

obviously, it will likely need to be expanded to suit your needs, but probably pointless to tell you how without knowing the template used.. e.g most of them I think will only accept a promotion at checkout (unless passed in the URL), Ajaxcart can probably accept it at any time...

Link to comment
Share on other sites

It's in the ordering process, the first step is the domain options, then any product add-ons, the next step is to enter a PROMO CODE - and then checkout. I'm not sure which template that is, will have to snoop.

 

But once a customer enters the code and clicks submit, I want to be able to display a message, any Conditions that may apply to that promo code before they can checkout. So multiple / different PROMO CODE's code have different conditions. I suspect, it would be an {if this}{do this} - and then they can move on to checkout.

 

I'm thinking my idea would require a unique id for each promocode : )

 

Anyway, I'm told this option is not available at this time and should submit a feature request : (

 

Thanks for responding though.

Link to comment
Share on other sites

It's in the ordering process, the first step is the domain options, then any product add-ons, the next step is to enter a PROMO CODE - and then checkout. I'm not sure which template that is, will have to snoop.

 

But once a customer enters the code and clicks submit, I want to be able to display a message, any Conditions that may apply to that promo code before they can checkout. So multiple / different PROMO CODE's code have different conditions. I suspect, it would be an {if this}{do this} - and then they can move on to checkout.

 

I'm thinking my idea would require a unique id for each promocode : )

 

Anyway, I'm told this option is not available at this time and should submit a feature request : (

I guess it was Support that told you that... nobody else ever suggests submitting a feature request other than them! :roll:

 

if I were you, I wouldn't give up on this - it should be relatively easy to achieve what you want. :idea:

 

if you have a promocode box on any existing page, then once submitted/validated, that page and/or checkout should have access to the $promotioncode variable - at which point, you can use it to display your specified message and conditions.

 

you are correct that it's going to be an "{if this}{do this}" solution, but I would expect that you are only going to need one line of code to cover all promotion codes and their different messages/conditions! :)

 

but your next step should be to find the name of your order form template, add the above code to its viewcart.tpl and see if the message appears - if it does, then the solution can be fine-tuned for your needs.

Link to comment
Share on other sites

Thanks for your response and encouragement, I'm not a gear head or programmer, so I don't easily identify what's what in code - eventually I figure it out, but it takes much longer than it should.

 

I think it's a great feature idea, I can see multiple uses of the promotion code : )

 

I'm also tinkering with whmcs-bridge...I'm certain I'm having issues between the plugin and my Theme (Headway) some stuff works, and some stuff just doesn't : (

 

I'm out of office most of today, but will get back to it later....I'll keep you posted if you wish?

 

Thanks again.

Link to comment
Share on other sites

Thanks for your response and encouragement, I'm not a gear head or programmer, so I don't easily identify what's what in code - eventually I figure it out, but it takes much longer than it should.

 

I think it's a great feature idea, I can see multiple uses of the promotion code : )

there was something familiar about your question - I couldn't remember if i'd already done this (or something similar) for a client or if i'd posted it here... it seems that i've answered it before (6 months ago) and included the required working code! that probably explains why I knew it could be done! :)

 

http://forum.whmcs.com/showthread.php?92890-Coupon-codes

 

the code in that thread should work for you - I appreciate that you want to do slightly more than tweak the promo description, but the principle is exactly the same... you might be able to use the code as is, or it might need a third variable to list the promotion conditions - but probably best to use the code as is for now and then tweak if necessary.

 

one thing that I have just spotted in the code is that it needs some slight further promocode validation - nothing drastic... but as it stands now, when you enter a promotional code, $promotioncode will exist - regardless of whether the qualifying product is in the shopping cart or now.

 

to get around this, you just need to change...

 

{if $promotioncode}[/if]

to...

 

{if $promotioncode and $rawdiscount neq 0}[/if]

this will detect if the promotion code has had some effect on the cart - if it hasn't (e.g there is no qualifying product in the cart), it will equal 0 - otherwise, it will equal the value of the discount (positive or negative).

 

I'll keep you posted if you wish?

by all means, i'm always interested to see how my code is used. :)

 

let me know if you run into any issues.

Link to comment
Share on other sites

Brianl

 

Howdy! Just wanted to update you, I have everything working as I would like, with exception of maybe a pop-up window with the conditions of the promo when clicking a link. I used _blank so it opened a new window, I suspect the best way would be to use Javascript...but that gets kludgy me thinks. I want to ensure the Conditions of a PROMO are understood before a new customer checks out.

 

Interestingly enough, I didn't have to do much, I just entered the following into the viewcart.tpl file:

 

<tr class="promo"> <td align="right">Conditions May Apply</td>

<td align="center"><a href="http://billyhost.com/2mthsfree"target="_blank">Click Here For Details Of Conditions</a></td>

</tr>

 

This is the next line after showing the discount, I changed the text color to RED and increased the font size to make sure it's obvious the discount was applied, and the instruction to read the conditions of the PROMO. I don't want new customers complaining they didn't know about the conditions, I should also have a link to the Terms of Service, which spells out how ALL Promotion/Discount codes parameters.

 

Thanks for pointing me in the right direction

Link to comment
Share on other sites

i'm glad that you got the solution working - it's much quicker than waiting for a feature request to be acted on! :)

 

if you're using more than one promocode, don't forget what I said about using $rawdiscount too to check it's a valid promocode for the contents of the cart - it's not foolproof, but it would be a weird promotion that didn't provide any discount (which would be the only way the promo code could be right and $rawdiscount = 0 !)

Link to comment
Share on other sites

That line shows up earlier in the viewcart.tpl:

 

{elseif $promotioncode && $rawdiscount eq "0.00"}

<div class="errorbox">{$LANG.promoappliedbutnodiscount}</div>

 

It would appear to apply to what you are saying, the above code was already there, it's a default setting me thinks.

Link to comment
Share on other sites

that code is just to display an error message that there is an invalid promo code entered...

 

let's take a simple example... assume we have two promo codes and two products...

 

PROMO1 -> Product 1 -> $10 discount

PROMO2 -> Product 2 -> $25 discount

 

we go through the order process, put product2 in the cart and then when we get to the promotion code box, we enter "PROMO1" - this code shouldn't apply to the cart (and won't), but $promotioncode will now equal "PROMO1", $rawdiscount will equal zero... so you'll get the above error message...

 

however, with your additional code where you are just checking if $promotioncode exists, then it will try to display your text and conditions for the PROMO1 code... even though the products in the cart don't qualify for the discount.

 

if product2 is in the cart and you use PROMO2, then $promotioncode will equal "PROMO2" and $rawdiscount will equal 25.00 - so you can assume the promotional code is valid... and know it is safe to display your message.

 

I hope that makes sense and helps!

Link to comment
Share on other sites

So, this is what the code should look like then:

 

{if $promotioncode and $rawdiscount neq 0} <tr class="promo">

<td align="right">{$promotiondescription}:  </td>

<td class="textcenter">{$discount}</td>

</tr>

<tr class="promo">

<td align="right">Conditions May Apply</td>

<td align="center"><a href="http://billyhost.com/2mthsfree"target="_blank">Click Here For Details Of Conditions</a></td>

</tr>

{/if}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated