Looking for ideas to complete a small task

Mustafa_s

Member
I have a registration process where first part of the process asks for name, email, password so the user can login to the website, this is done using a Fabrik registration form. The second part of the registration process is optional, using Hikashop the user can enter in their address and receive a free sample product from the website owner.

However, since the second part is optional, I want to be able to send a "friendly email reminder" that the user should enter in their address information to receive a free sample product.

- I want to be able to do this after 5 days from the day the user registered
- Ideally automated
- Ideally not send the user another reminder if they did actually enter in their address

Is there a Fabrik solution I can adopt to meet this need? I think the email cron plugin is the way to go, I just found the documentation on it and started to read it now.

Thanks.
 
Is the address only contained in the Hikashop table(s)? I'm assuming so.

You can still do it with the email plugin, but your "Condition" will be a little more involved, as for each row you'll need to look up that userid in the Hikashop table to see if they exist.

I'd also add a "reminder_sent" field on the Fabrik list, which you can then set to 1 in the "Update" of the email cron plugin. Run the cron plugin on a copy of the list, where you have a prefilter for "where reminder_sent != 1". That way your email plugin won't have to worry about sending reminders twice. Also you'd need a prefilter on that copy so you only see rows from 5 days ago, something like two prefilters ...

field: date_time
condition: greater than
value: DATE_SUB(CURDATE(), INTERVAL 5 DAY)
type: no quotes

... and another for "less than" intefrval 6 day. Grouped, with AND.

In the Condition, you'd need to run a query like ...

$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('*')
->from('your_hika_shop_table')
->where('userid = ' . $myDb->quote('{yourtable___userid}'))
->where('address != ""');
$myDb->setQuery($myQuery);
$myResults = $myDb->loadObjectList();
return !empty($myResults);

You'll have to tweak that query to fit, I'm not sure what the Hikashop tables look like. But the principle is there - match the Hikashop userid element against a placeholder for yours, and test if the address is filled in.

-- hugh
 
Hugh wow that's amazing feedback, I'm going to test it out first thing tomorrow and get back to you. Your assumption is correct, the address is in the Hikashop tables.

Much appreciated it, thank you.
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top