We upgraded joomla, CB, CBSubs and all plugins to the latest version this weekend.
Unfortunately we discovered an issue with one promotion that uses a cbquery field and a text field.
The promotion is now always active even though the condition is not met.
Query field: cb_currentyear: calculates the current year ("SELECT YEAR( current_date ) FROM `#__comprofiler` WHERE `id` = '[user_id]'")
Text field: cb_freemembshipin: administrator can enter a year in which the promotion is valid. Usually empty.
The promotion:
if value of cb_currentyear = value of cb_freemembshipin: apply a 100% discount
Current situation: even if the cb_freemembshipin field is empty, the promotion is applied.
We currently had to disable the promotion to prevent free discounts.
Attachments:
Last edit: 8 years 10 months ago by krileon. Reason: Added [SOLVED] tag to subject
Your query isn't valid and is either erroring or just returning back empty value. You also don't need SQL to compare a field against current year. Use a condition from a substitution supported value against a field [cb:date format="Y" /] as the substitution. Example as follows.
Date A, Field A or Value A: Following CB field
CB Field A: cb_freemembshipin
Date B, Field B or Value B: Constant Value or String (CB substitutions can be used)
Value B: [cb:date format="Y" /]
Condition 1 (> for Dates): A = B (Value A is equal to Value B )
If you still want to use the query then the below should work, but I don't recommend doing an SQL query when it's not necessary.
Code:
SELECT YEAR( NOW() ) FROM `#__comprofiler` WHERE `id` = '[user_id]'
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 8 years 10 months ago by krileon.
The following user(s) said Thank You: webweaver.be