Closed (fixed)
Project:
Ubercart Discount Coupons
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Dec 2009 at 19:32 UTC
Updated:
10 Oct 2012 at 18:52 UTC
I have a coupon restricted to 1 and it allows a user to use the coupon code twice.
(If it means anything, I'm using user 1 at the moment).
Comments
Comment #1
longwaveWhat is the status of the order where the coupon was first used? The order must move past "in checkout" and "pending" for the coupon to be counted as used; this is by design, so orders that were never completed do not count towards the order total.
Comment #2
tchurch commentedThat was it.
Both orders were pending.
After I changed one to the next step, then a new order couldn't be created.
The only issue I see here is that if a customer makes 2 orders are the same time and should only be allowed to use a coupon once, they will be able to use it more than once until we update an order.
If payment has already been taken for all orders with the coupon applied then we have problems.
Maybe an update is needed so that any order where the order state (not status) is NOT in a cancelled state (which will take care of people with their own statuses) is counted as used.
This way a customer can use the coupon again only if the order was cancelled.
Comment #3
longwaveOrders at "in checkout" must be ignored, as they are often abandoned orders that the user will never pay for. In a number of stores I have worked on there are lots of orders left at "in checkout" because the user decided not to complete them at the last minute, or failed to pay for them for some reason.
Orders should not stay at "pending" for long either, in most stores a Conditional Actions rule should move them to "payment received" or "completed" or another status shortly after checkout.
I think the most flexible way of improving this would be to implement a new action in CA that can mark an order's coupon as used or unused. Default predicates would mark the coupon as used on the "customer completes checkout" trigger and as unused on "order status gets updated" with a condition of "order status is cancelled". This way the store owner is free to configure coupon usage as they see fit, rather than having the current defaults apply to everyone.
Any thoughts on this or any other improvements to this area of uc_coupon are welcome.
Comment #4
tobiberlinsubscribing - I think it is really much better that a coupon is marked as used as soon as a customer completes checkout to avoid double using!
Comment #5
mandreato commented(In My Humble Opinion)
I agree with tobiberlin: as soon as an order leave the "in checkout" status it should be considered confirmed because the customer intends to obtain the products (and coupon should be marked as "used").
Just in case of order cancellation, that coupon should become available again.
Comment #6
checker commentedI also agree with tobiberlin and mandreato. At the moment this module is a little bit dangerous because shop owners have not really control over their coupons.
Comment #7
tfranz commentedCould this work, if i only change the "uos.weight > 0" to "uos.weight >= 0" in MYSQL-Query in uc_coupon.module, line 419?
$used = db_result(db_query("SELECT COUNT(*) FROM {uc_coupons_orders} AS uco LEFT JOIN {uc_orders} AS uo ON uco.oid = uo.order_id LEFT JOIN {uc_order_statuses} AS uos ON uo.order_status = uos.order_status_id WHERE uos.weight >=0 AND uco.cid = %d AND uo.uid = %d", $coupon->cid, $user->uid));I would prefer an option in the edit-form, something like:
"Mark coupon as used when order [ ] completed or [ ] in checkout".
Comment #8
wodenx commentedThat should work - but note the default weight for "In Checkout" orders is -10, so it depends on exactly when you want a coupon to be marked as used. Note also that you can change the weight of each order status at admin/store/settings/orders/edit/workflow - so if you wanted a coupon to be marked as used when an order is "in checkout", you could in theory just change the weight ("list position") of the "in checkout" status to something >0.
With regard to an option on the edit-form - do you think it's necessary to be able to specify this on a per-coupon basis - or would a storewide setting be sufficient?
Comment #9
tfranz commentedThank you for your reply! ... and you're right: "In Checkout" would be better (in my case).
A storewide setting would be sufficient for me – i don't think on a per-coupon basis is necessary ...
Comment #10
omniverse commentedFor sites that don't want the current functionality, why not change 'pending' weight to 1 from 0 on admin/store/settings/orders/edit/workflow? Would that have any significant side effects?
Comment #11
wodenx commentedAs I say, in theory this should work for uc_coupon, but not sure if it would have ramifications elsewhere in ubercart.
Comment #12
BigMike commentedHey guys, I created a similar topic here, "Setting the max # of redemptions per code doesn't seem to work?" (http://drupal.org/node/1250388), and was referred to this thread by wodenx (thank you Sir!).
@tfranz #7:
I would prefer an option in the edit-form, something like:
"Mark coupon as used when order [ ] completed or [ ] in checkout".
X2 on this request. This would be great.
@omniverse #10:
For sites that don't want the current functionality, why not change 'pending' weight to 1 from 0 on admin/store/settings/orders/edit/workflow? Would that have any significant side effects?
and specifically @wodenx #11:
As I say, in theory this should work for uc_coupon, but not sure if it would have ramifications elsewhere in ubercart.
For this very reason I am choosing to hack the module as per #7 so I don't (possibly) break any other feature that depends on Pending being equal to zero.
Thank you everyone for all the replies to this and also thank you to the developers for such a great module. Gonna get on this right now so we can start using this module.
Regards,
BigMike
Comment #13
TooR commented@tfranz #7:
Thank you for this solution.
A "Mark coupon as used when order [ ] completed or [ ] in checkout" feature would be great.
Comment #14
wodenx commentedThe problem with marking a coupon as used when "in_checkout" is that many, many orders are abandoned in the checkout phase. We'd also need to implement some sort of timeout, which marked a coupon as active again if an order was abandoned; either that, or a cron job that marks such orders as "canceled" or "abandoned" (cf #1298550: Create new 'abandoned' order status.).
Comment #15
kierduros commentedHere's another thought along the same lines as has been discussed here...
I've just managed (when using the multiple coupon module) to continuously enter a coupon that should only be able to be entered once.
Perhaps the solution is to have a "use per session" count? For the existing session the coupon would be considered used as soon as it was entered into the system, but if the session expires without the order being completed, it would revert to unused.
Comment #16
wodenx commentedCommitted a fix to DEV branches of both 6.x and 7.x. Admin can now specify the order status at which a coupon is marked used.
When using this in 6.x - be careful of setting the status to 'in_checkout' - you will probably want also to use some combination of rules/uc_views/vbo to mark in_checkout orders as canceled if they have been inactive for a while. This shouldn't be a problem in D7 since the commit of #1298550: Create new 'abandoned' order status..
Comment #18
BigMike commentedI know this was closed almost a year ago, but I forgot to add a response to longwave's reply (#3),
Orders should not stay at "pending" for long either, in most stores a Conditional Actions rule should move them to "payment received" or "completed" or another status shortly after checkout.
I created a "How-To" on this located here: http://www.ubercart.org/comment/64769
Hoping this may help someone in the future,
Mike