Is it possible to add a feature which is similar to the one existing in the ubercart Userpoints Invite module where an option is added to the settings as such:

When should the invite discount be issued:
1) The first time the invitee makes an order only.
2) Everytime the invitee makes an order.

The above would appear as radio buttons.

Of cause the above implementation is just a suggestion. The idea is to enable limiting the coupon generation to the first purchase made by the invitee and not everytime the invitee makes a purchase. Even a simple patch or location where the code can be altered will be accepted as a blessing.

Thanks

Comments

Vladimir K’s picture

Hi, I need first option (only first time) now. When I complete site, I'll post solution.
While I not found this module I thought make it with userpoints, userpoints_ubercart and referral modules:
At admin/settings/userpoints go to tab "Points for referral", set moderation to "Yes".
When invitee user paid per purchase first time set it moderated, otherwise delete (need some code for this)
In next tab like "discount settings" (I use localized drupal) set 1 point per $ and up to 100% of purchase.
I think, points are easier than coupons for users.

VanessaM’s picture

Hi,

I investigated the Userpoints module in depth before deciding which module to user and although Userpoints has more of the solution I need on a techincal level, from a marketing perspective I still prefer to provide a coupon to an user who invited a friend.
Is there anyway you can help me add this feature to the uc_invite_discount module? I don't know PHO myself and since I am builing a pretty serious e-commerce site I am willing to pay if necessary. My email is: vanessamitelman@gmail.com

Thanks

Vladimir K’s picture

StatusFileSize
new3 KB

Hi,
I create patch which limits the coupon generation to the first time the invitee makes a purchase without option in interface. This patch also included Patch for the "no email sent" problem (http://drupal.org/node/790434).

VanessaM’s picture

Hi,

The patch works great! Thank you sooooo much.
How can I donate towards your development time?

Vladimir K’s picture

Everybody can use and modify for free.
However you can donate using wmtransfer.com (purse Z904944383299) or yandex.ru (purse 41001240095596).

gillisig’s picture

That patch seems to break the order process, When i apply the patch and try to make an order for the first time it gives me an error message after sending order, the mail gets sent but the order fails. No error is logged into watchdog. If I try again it goes trough without a problem but as if I was making second order.. so no mail or anything.

Vladimir K’s picture

sorry, there is one thing. Please go to /admin/store/settings/invite_discount and set "Coupon Name Pattern" to "[invitor-username]-[invitee-username]". Added code search already generated coupons by this pattern and if it already exists break coupon generation. Or you can change pattern to search in line 406 (
$count = db_fetch_object(db_query("SELECT count(1) AS cnt FROM uc_coupons WHERE name = '%s-%s'", $invitor->name, $order_user->name));
) appropriate to your "Coupon Name Pattern". If these patterns aren't equal, coupons will be generated each time when invitee have complete order.
But any way patch can't break order! How your had applied it? Please review patch code and make changes manually in /sites/all/modules/uc_invite_discount/uc_invite_discount.module.

VanessaM’s picture

I spent half a day trying to use wmtransfer.com without success and I don't know russian so I cannot use: yandex.ru
I have Paypal. It is really easy to create an account and I checked that there is Paypal in Russian. Can I use Paypal instead? I really want to donate as I am really grateful for your help.
Thanks

v8comp’s picture

StatusFileSize
new5.05 KB

Here is a my version which:
- adds a check box in settings whether to apply to first order only
- stops duplicate coupons from being generated for the same order
- uses any name and code pattern setting
- works with table prefixes

Also includes the created date in coupon generation as per this issue: http://drupal.org/node/1178546

Anonymous’s picture

Your patch seems to work the best so far! Thank you!

Although, once (as the 'invitor') I add the coupon cope to my purchase and hit 'checkout', I get the error 'Fatal error: __clone method called on non-object in /********/uc_discount/uc_discount.module on line 126'.

Is this an error with the patch, or did I perhaps apply the patch wrong?

v8comp’s picture

uc_discount is an unrelated module. This module is uc_invite_discount which ties together the invite module with the coupon module (uc_coupon). I'd suggest disabling any other discount type modules if you don't use them.

Anonymous’s picture

Uhm... yes, you make a very good point. If I wasn't being an idiot, I would have noticed that and fixed it.
Thanks so much, now it works PERFECTLY! ;)

Anonymous’s picture

I'm sorry to bother again with a sort of unrelated issue. I just saw that if an invitor is granted a 20% discount, this is 20% of the invitee's purchase, and not the invitor's. This doesn't seem to make much sense to me.
Is there a way to modify this to give the invitor 20% off of his own purchase?

Should I make a new thread for this?

v8comp’s picture

If there's a bug with that then it should probably be a separate issue.

I don't see how that would happen though, all it does is create a new coupon that only the invitor can redeem with whatever settings you specify. If its for 20% off then it would apply to the order where the invitor types the code in (presumably his next one), not to either of the original purchases.

cockers’s picture

Issue summary: View changes
StatusFileSize
new5.07 KB
cockers’s picture

Thanks guys! Your patches alongside this fantastic module have added an invaluable tool to my site.

For those who - like me - aren't too php savvy. Here's the module file that I ended up with after a morning of patching and tweeking.

I hope this helps someone!