Suppose I have an online computer shop and I want to add a new feature - advertisement As a manager of the store, I want to create an advertisement about a particular product. Let's say that it goes like this: If a customer has signed up for at least 2 months in advance and the value of its order is higher than $ 150 or the product A or B already The car is in his shopping and he shows this advertisement.
My question is how to store such statements (Condition A 'A' or 'A', 'A' A and B? ????, A (A or B) and CAE, etc.) In a database and after that, record and display (or not) How to choose the desired advertisement?
One of my thoughts:
ads 1. id, 2. name, 3. details, a ?? | 4. criterias_pattern [ie ??? (1 or 5) and 4 ????] Second tab:
AdvertsCriterias 1. ID ... 2. Type 3. Value < / Code> In short: I parse the pattern stored in the criteria_pattan. Remove the fields, criterias_id, and then I check the conditions.
This should work but it has many obvious drawbacks. Random Thoughts -
random views -
Why not submit real SQL where evaluated At least then you do not need to change your own syntax and parser again.
Comments
Post a Comment