- Posts: 27
- Thank you received: 0
How To Create Coupon From Username At Registration
7 years 5 months ago #306058
by workspace
How To Create Coupon From Username At Registration was created by workspace
Is it possible for somehow when a user signs up on my site, when their account is created a promo code/discount/coupon is automatically created from their username?
So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37
Is there any way to do this?
So basically, when John signs up with the username; john37 , when he presses register on the default Joomla registration form it creates a coupon with the code; john37
Is there any way to do this?
Please Log in or Create an account to join the conversation.
7 years 5 months ago #306079
by nicolas
Replied by nicolas on topic How To Create Coupon From Username At Registration
Hi,
Yes. You can do that with AcyMailing and the tag integration we have with it.
With AcyMailing, you can configure it to send an email automatically after the user registration. And in that email, you can use the HikaShop coupon tag to generate a HikaShop coupon and replace the tag in the email by the code of the coupon:
www.acyba.com/acymailing/161-acymailing-...hikashop.html#coupon
Yes. You can do that with AcyMailing and the tag integration we have with it.
With AcyMailing, you can configure it to send an email automatically after the user registration. And in that email, you can use the HikaShop coupon tag to generate a HikaShop coupon and replace the tag in the email by the code of the coupon:
www.acyba.com/acymailing/161-acymailing-...hikashop.html#coupon
Please Log in or Create an account to join the conversation.
7 years 5 months ago #306081
by workspace
Replied by workspace on topic How To Create Coupon From Username At Registration
Would this require the registration to be done via AcyMailing?
And would the coupon be able to be their username? I can't seem to see username in the code variables?
And would the coupon be able to be their username? I can't seem to see username in the code variables?
Please Log in or Create an account to join the conversation.
7 years 5 months ago #306085
by nicolas
Replied by nicolas on topic How To Create Coupon From Username At Registration
Hi,
No, it will work with the registration done through Joomla or HikaShop's registration forms (AcyMailing doesn't have a registration form).
Regarding the username, I checked in the code of the plugin and it doesn't support it.
It would require some code modification to the acymailing-hikashop integration to support it.
In the file plugins/acymailing/hikashop/hikashop.php you can find this line which replaces the tags:
Unfortunately, $user doesn't contain the information of the username and so to handle it would require loading the user with a MySQL query and then do the replacement. It's possible but it will require some development.
No, it will work with the registration done through Joomla or HikaShop's registration forms (AcyMailing doesn't have a registration form).
Regarding the username, I checked in the code of the plugin and it doesn't support it.
It would require some code modification to the acymailing-hikashop integration to support it.
In the file plugins/acymailing/hikashop/hikashop.php you can find this line which replaces the tags:
Code:
$code = str_replace(array('[name]', '[clean_name]', '[subid]', '[email]', '[key]', '[flat]', '[percent]', '[value]', '[prodid]'), array($user->name, $clean_name, $user->subid, $user->email, $key, $flat_amount, $percent_amount, $value, $product_id), $code);
Please Log in or Create an account to join the conversation.
7 years 5 months ago #306111
by workspace
Replied by workspace on topic How To Create Coupon From Username At Registration
What about instead of creating a plugin to do all this, couldn't there just be a line of code added to the registration that inserts the username entered into the MySQL table for the discounts?
Please Log in or Create an account to join the conversation.
7 years 5 months ago #306124
by nicolas
Replied by nicolas on topic How To Create Coupon From Username At Registration
Hi,
That could be a solution yes.
Here is some documentation on how to create a Joomla plugin for the registration:
www.informit.com/articles/article.aspx?p=1858258&seqNum=5
This is compatible with HikaShop's registration too.
Then, in the plugin, you can do that MySQL query to insert the coupon in the hikashop_coupon table.
That could be a solution yes.
Here is some documentation on how to create a Joomla plugin for the registration:
www.informit.com/articles/article.aspx?p=1858258&seqNum=5
This is compatible with HikaShop's registration too.
Then, in the plugin, you can do that MySQL query to insert the coupon in the hikashop_coupon table.
The following user(s) said Thank You: workspace
Please Log in or Create an account to join the conversation.
7 years 5 months ago #306128
by workspace
Replied by workspace on topic How To Create Coupon From Username At Registration
Thank you, I have succeeded with this by adding some PHP to the registration.php file that when the user registers it adds the username as a coupon. However I will definitely look into your link and learn to make a plugin as that is a more preferred method than having to put code in the core files. Thank you for that.
Please Log in or Create an account to join the conversation.
Time to create page: 0.191 seconds