21 pointsStarting to get into this DEV thingI'm new here
mgyura
Member
—
22nd November 2011
Currently the Pro Site Coupon Code automatically discounts the first month's membership. Would it be possible to make this so that the coupon code discount's the membership fee for the lifetime of the customer? For example we want our normal monthly fee to be $49. With the correct coupon code, however, we want users to pay $39 a month for their membership. I am pretty sure this functionality is not built in to Pro-Sites at this point but where should I start if I was going to code it for myself?
Currently the Pro Site Coupon Code automatically discounts the first month's membership. Would it be possible to make this so that the coupon code discount's the membership fee for the lifetime of the customer? For example we want our normal monthly fee to be $49. With the correct coupon code, however, we want users to pay $39 a month for their membership. I am pretty sure this functionality is not built in to Pro-Sites at this point but where should I start if I was going to code it for myself?
From what I can see this would involve quite an extensive alteration to the plugin code. You could search pro-sites.php for all occurrences of the term 'coupon' to find the relevant portions. There's some of it on line 653 with the session variable being dealt with shortly after.
I imagine what you'd have to do is apply the same coupon code to the account every time there's a payment being made, not a simple feat from what I can see.
Basically, it's a bit outside the scope of support here. But you can definitely find the needed portions of code by searching for 'coupon' in pro-sites.php as I mentioned above.
Let me know if you come up with a solution for this, mgyura. It's definitely a feature I'd like to see added to the plugin as well. Offering a discount on the monthly rate is much more useful than offering a discount on one payment.
Actually, it seems like this wouldn't be all that hard to implement. It looks like the database entry for coupons is just a serialized array, so adding a "coupon_type" key to the array wouldn't require any changes to the database, and shouldn't affect backwards compatibility. Then you'd just need to change the logic in the gateways to either modify the initial payment, or both the initial payment and the payment amount (near line 772 of gateway-paypal-express-pro.php). The only thing I haven't figured out is if there'd be any issue with the "amount" column in the pro_sites table. Can a developer comment on this? As long as there's no issue with the amount not matching the the amount associated with that pro site level, it should be OK.
That's a tough one. I'm leaning towards all actually... but I'd hate to loose the first month option, I plan to use that in a first month free campaign.
Maybe a compromise would be coupon system behavior feature. Makes coupon feature "all" or "first month". Since we're not mixing the coupons behavior in one setup it's still easier to implement with no need for rewriting gateways I think.
Also... this would help with existing setups that have published coupons and prefer not to change the behavior.
I would argue that ALL makes sense (if I had to choose one), but I don't see why you can't offer both—the code it already written. You just need to audit it and fix a few spelling issues:
Responses (22)
WPMU DEV Fanatic — 22nd November 2011 #
Hi mgyura,
From what I can see this would involve quite an extensive alteration to the plugin code. You could search pro-sites.php for all occurrences of the term 'coupon' to find the relevant portions. There's some of it on line 653 with the session variable being dealt with shortly after.
I imagine what you'd have to do is apply the same coupon code to the account every time there's a payment being made, not a simple feat from what I can see.
Basically, it's a bit outside the scope of support here. But you can definitely find the needed portions of code by searching for 'coupon' in pro-sites.php as I mentioned above.
Thanks,
David
Member — 29th December 2011 #
Let me know if you come up with a solution for this, mgyura. It's definitely a feature I'd like to see added to the plugin as well. Offering a discount on the monthly rate is much more useful than offering a discount on one payment.
Member — 29th December 2011 #
Actually, it seems like this wouldn't be all that hard to implement. It looks like the database entry for coupons is just a serialized array, so adding a "coupon_type" key to the array wouldn't require any changes to the database, and shouldn't affect backwards compatibility. Then you'd just need to change the logic in the gateways to either modify the initial payment, or both the initial payment and the payment amount (near line 772 of gateway-paypal-express-pro.php). The only thing I haven't figured out is if there'd be any issue with the "amount" column in the pro_sites table. Can a developer comment on this? As long as there's no issue with the amount not matching the the amount associated with that pro site level, it should be OK.
Member — 8th January 2012 #
Any news with this one?
Member — 12th January 2012 #
Hej!
Chris,
I followed your Idea, and I don't see a reason for this to fail.
here are the files
I think its a fair feature request. Isn't it?
Koff
Member — 18th January 2012 #
Anyone at WPMUDEV able to comment on this?
Member — 20th January 2012 #
Bump.
Member — 24th January 2012 #
Anyone?
Support Chimp — 25th January 2012 #
Hey everyone!
Yeah the way it currently works is to discount the first payment. I don't believe it reoccurs.
It most certainly is a valid feature request and so we will get this over to the feature request forum.
Anyone else want this, show your support :-)
+1 from me!!
Member — 26th January 2012 #
+1 - this feature should definitely get implemented
Member — 26th January 2012 #
+1 please.
Member — 6th February 2012 #
+1
Support Chimp — 6th February 2012 #
Hey guys, we now have another way to request plugins and provide feedback! :-)
http://wpmudev.uservoice.com/
Its new, but its proving rather popular! As you will note there are new features already under review. :-)
I will also pass this feedback to the plugin developer.
Take care.
Lead Developer — 6th February 2012 #
Do you guys think it should only be for all payments? It's much easier to either do one or the other. The gateways need to be rewritten for that.
Member — 7th February 2012 #
That's a tough one. I'm leaning towards all actually... but I'd hate to loose the first month option, I plan to use that in a first month free campaign.
Maybe a compromise would be coupon system behavior feature. Makes coupon feature "all" or "first month". Since we're not mixing the coupons behavior in one setup it's still easier to implement with no need for rewriting gateways I think.
Also... this would help with existing setups that have published coupons and prefer not to change the behavior.
Member — 7th February 2012 #
I would argue that ALL makes sense (if I had to choose one), but I don't see why you can't offer both—the code it already written. You just need to audit it and fix a few spelling issues:
https://docs.google.com/open?id=0B6kj_zUyxc54NmVkZjFkNzEtOTRkNy00OTUyLWJjZWItYWRmZDI2ZDFmOTZj
It's really only a couple of changes.
Member — 7th March 2012 #
+1
Member — 7th March 2012 #
+1
Member — 7th March 2012 #
Hej,
There were problems with the last idea.
I changedthe code, and tested it with sandbox, and it looks fine now.
Here is the new code:
Koff
Member — 7th March 2012 #
Hej,
There were problems with the last idea.
I changedthe code, and tested it with sandbox, and it looks fine now.
Here is the new code:
Koff
Member — 7th March 2012 #
Sorry For that
https://docs.google.com/open?id=0B6kj_zUyxc54NVdiOFctNXZUSXUyMWxvNW05OVRwdw
Member — 20th April 2012 #
+1 here as well. A coupon code that would allow for a recurring discount would be great.
Become a member