When using discount-codes I want every code just used once.
How can I achieve this and let people getting the message: "sorry, discount code already used..."
There isn't an option to set a Unique field, because there is no possibility to use a "Validation Rule"
Please advice
- Home »
- Support »
- RO Payments »
- can't set the "Validation Rule" for discount code field to "Unique field".
- Peter
- RO Payments
- Tuesday, 17 June 2025
- Subscribe via email
0
Accepted Answer
Pending Moderation
Yes, it works for me.
Didn't realise I had to mention ALL the discountcodes here:
Unfortunately there isn't an alert or pop-up when a discount-code is already used.
Thanx for your help!
Didn't realise I had to mention ALL the discountcodes here:
$uniqueDiscounts = ['TEST', 'TEST1'];
Unfortunately there isn't an alert or pop-up when a discount-code is already used.
Thanx for your help!
- 2 weeks ago
- RO Payments
- # 1
Accepted Answer
Pending Moderation
Hello Peter,
RSForm does not support single use codes from what I found. You can write to RSJoomla team to implement this feature.
RSForm does not support single use codes from what I found. You can write to RSJoomla team to implement this feature.
Attachments (1)
Kind regards,
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- 3 weeks ago
- RO Payments
- # 2
Accepted Answer
Pending Moderation
I dit ask.
They responded: "In order to achieve this, you can set the "Validation Rule" for that field to "Unique field".
But there isn't an option in the RoPayment component "Kostingscode"
They responded: "In order to achieve this, you can set the "Validation Rule" for that field to "Unique field".
But there isn't an option in the RoPayment component "Kostingscode"
- 3 weeks ago
- RO Payments
- # 3
Accepted Answer
Pending Moderation
Hello,
When I look at RSForms only textbox field has Validation rule field. The Discount field of Payment plugin does not have this field or it has logic for single use code.
Did you also ask them on how to use Validation rule on Discount field from Payment plugin? We are not able to see Validation rule on Discount field. Can you ask them on how to use it?
They responded: "In order to achieve this, you can set the "Validation Rule" for that field to "Unique field".
When I look at RSForms only textbox field has Validation rule field. The Discount field of Payment plugin does not have this field or it has logic for single use code.
Did you also ask them on how to use Validation rule on Discount field from Payment plugin? We are not able to see Validation rule on Discount field. Can you ask them on how to use it?
Kind regards,
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- 3 weeks ago
- RO Payments
- # 4
Accepted Answer
Pending Moderation
They answered:
The RSForm!Pro Discount field you're viewing in the payment package doesn't incorporate this functionality by default. What you're asking requires custom development as well as scripting knowledge. Although we normally don't provide customization services or paid development services, we do like to help our customers when the time allows. For example, you can edit your Discount field and add something similar in the 'Coupon Code' field:
Make sure to replace (1) with your form's Id and 'discount_field_name' with the actual name of your field.
Regards!
The RSForm!Pro Discount field you're viewing in the payment package doesn't incorporate this functionality by default. What you're asking requires custom development as well as scripting knowledge. Although we normally don't provide customization services or paid development services, we do like to help our customers when the time allows. For example, you can edit your Discount field and add something similar in the 'Coupon Code' field:
//<code>
$db = JFactory::getDbo();
// change this if you want to use a different discount from the list below
$uniqueDiscounts = ['DISCOUNT_ABCD'];
$discounts = [
'10%|DISCOUNT_ABCD',
'10%|DISCOUNT_1234',
'10%|DISCOUNT_EFGH',
];
// get only the discount codes
$discountsCodes = [];
foreach($discounts as $discount)
{
list($value, $code) = explode('|', $discount, 2);
$discountsCodes[] = $code;
}
foreach ($uniqueDiscounts as $discountCode)
{
$query = $db->getQuery(true);
$query->clear()
->select("COUNT(*)")
->from('#__rsform_submission_values')
->where($db->qn('FormId').' = '.$db->q(1)) // form id
->where($db->qn('FieldName').' = '.$db->q('discount_field_name')) // name of the field
->where($db->qn('FieldValue').' = '.$db->q($discountCode));
$db->setQuery($query);
$used = (int) $db->loadResult();
// search in the discount codes
if ($used && in_array($discountCode, $discountsCodes))
{
$key = array_search($discountCode, $discountsCodes);
// remove from the actual discounts
unset($discounts[$key]);
}
}
return $discounts;
//</code>
Make sure to replace (1) with your form's Id and 'discount_field_name' with the actual name of your field.
Regards!
- 3 weeks ago
- RO Payments
- # 5
Accepted Answer
Pending Moderation
Hi Peter,
Your initial request was how to use discount codes only once. That is something the Discount option in the RSForms Payment package does not support. That is why we said this needs to be implemented by RSJoomla into the discount option and your reply was that the Unique field validation should be used.
That we tested on the RSForms payment package but does not work and as a result asked to clarify how the Unique field would work with the RSForms payment package. So RSJoomla came back to you with some code to put into the Discount field. That is because there is nothing in RSForms to provide for the single use coupon codes.
Have you tested this code into the Kortingscode field? Of course modifying the code per your needs.
Let us know how it goes.
Your initial request was how to use discount codes only once. That is something the Discount option in the RSForms Payment package does not support. That is why we said this needs to be implemented by RSJoomla into the discount option and your reply was that the Unique field validation should be used.
That we tested on the RSForms payment package but does not work and as a result asked to clarify how the Unique field would work with the RSForms payment package. So RSJoomla came back to you with some code to put into the Discount field. That is because there is nothing in RSForms to provide for the single use coupon codes.
Have you tested this code into the Kortingscode field? Of course modifying the code per your needs.
Let us know how it goes.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- 3 weeks ago
- RO Payments
- # 6
Accepted Answer
Pending Moderation
Yes, I tested it.
Unfortunately, doesn't do anything....
Unfortunately, doesn't do anything....
- 3 weeks ago
- RO Payments
- # 7
Accepted Answer
Pending Moderation
Hi Peter,
Did you adjust the code for your site? Did you test to see if the code is actually triggered?
Did you adjust the code for your site? Did you test to see if the code is actually triggered?
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- 2 weeks ago
- RO Payments
- # 8
Accepted Answer
Pending Moderation
Hi RolandD,
Yes, I did
You can check if you like (See details)
Thanx in advance!
Yes, I did
You can check if you like (See details)
Thanx in advance!
- 2 weeks ago
- RO Payments
- # 9
Accepted Answer
Pending Moderation
Hi Peter,
Just having a look at it, you are missing the code tags. Look at the code RSJoomla gave you, they start and end with code tags. These are required for RSForms to process code. That still needs to be added and then test again.
Just having a look at it, you are missing the code tags. Look at the code RSJoomla gave you, they start and end with code tags. These are required for RSForms to process code. That still needs to be added and then test again.
Kind regards,
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
RolandD
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- 2 weeks ago
- RO Payments
- # 10
Accepted Answer
Pending Moderation
When I use
Unfortunately I get this error: "syntax error, unexpected token "<", expecting end of file"
When I use
Discount can still be used more then once....
<code>
</code>
Unfortunately I get this error: "syntax error, unexpected token "<", expecting end of file"
When I use
//<code>
//</code>
Discount can still be used more then once....
- 2 weeks ago
- RO Payments
- # 11
Accepted Answer
Pending Moderation
Hi Peter,
I had a look at the code to see how it works. What I noticed is that the coupon code is applied only once and first time and if the same coupon code is used second time then form is submitted but there is no coupon discount applied. Is that how it works for you?
I had a look at the code to see how it works. What I noticed is that the coupon code is applied only once and first time and if the same coupon code is used second time then form is submitted but there is no coupon discount applied. Is that how it works for you?
Kind regards,
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- 2 weeks ago
- RO Payments
- # 12
Accepted Answer
Pending Moderation
Hello,
Yes that is correct. There is no message on already used discount code. You can check with RSJoomla if they can help with that as well.
Unfortunately there isn't an alert or pop-up when a discount-code is already used.
Yes that is correct. There is no message on already used discount code. You can check with RSJoomla if they can help with that as well.
Kind regards,
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
Tharuna
=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
- 2 weeks ago
- RO Payments
- # 13
- Page :
- 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »