Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
How build a coupon system?
A client wants to promote his activity with promo cards. Cards report coupon code.
I’de like to check if a code is active before send form to prevent spam.
How can I made it?
Can I use adi_variables to store codes?
Thanks in advance :)
Offline
Re: How build a coupon system?
I’ve found a solution but I think it can be best…
Using adi_variables I set only 1 coupon code.
With adi_contact I check if code are the same:
<txp:zem_contact to="io@me.it"> <txp:zem_contact_email /> <txp:zem_contact_text label="Codice" /> <txp:zem_contact_secret label="valcodice" value='<txp:variable name=''coupon'' />' /> <txp:zem_contact_submit /> <txp:adi_contact_validate names="Codice,valcodice" type="equal" message="Il codice inserito non è corretto" /> </txp:zem_contact>
If true with adi_gps I can set a conversion.
All suggestions are welcome :)
Offline
Re: How build a coupon system?
I’m still working on this…ù
Update soon…
Offline
Re: How build a coupon system?
I think that it should be
<txp:zem_contact_secret label="valcodice" value='<txp:variable name="coupon" />' />
and not
<txp:zem_contact_secret label="valcodice" value='<txp:variable name=''coupon'' />' />
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How build a coupon system?
Hi there! I think I found a solution.
This is my way. Maybe I use too much plugin, but I’m not a programmer, so…
- adi_contact
- smd_if
- zem_contact_reborn
First of all I set a form like this
<txp:zem_contact to="me@me.it" thanks_form="grazie"> <ul> <li><txp:zem_contact_email /></li> <li><txp:zem_contact_checkbox name="codecheckbox" label="Ho un codice coupon" required="0" /></li> <li><txp:zem_contact_text name="code" label="Codice" required="0" /></li> <txp:zem_contact_submit /> </ul> <txp:adi_contact_checkboxes names="codecheckbox" /> <txp:adi_contact_combo names="codecheckbox" require="code" /> <txp:adi_contact_validate names="code" type="custom" pattern="my-regex" message="Il codice inserito non è corretto" /> </txp:zem_contact>
adi_contact does code validation olny if codecheckbox is on and validate it basing on pattern I set.
I add few line of code to zem_contact_reborn at line 231before
$_POST = array();
Adding this line I set a global variable before zem_contact reborn clears post var.
if (isset($zem_contact_values['code'])) { global $variable; $variable['code'] = $zem_contact_values['code']; }
In this way I can use smd_if to check if user had submitted code or not and set a conversion.
This is thanks_form
<txp:smd_if field="txpvar:code" operator="isused"> <p>Grazie. Ricordati di presentare la tua cartolina alla reception!</p> <txp:else /> <p>Grazie</p> </txp:if_variable>
What do you think about?
Offline
Pages: 1