When the lifetime restrictions check for the users existing orders with that product it only looks at completed orders.

This can be a problem, for example:

If I have a site that offers COD as a payment option and have a product with a lifetime limit of 3.
A user can purchase as many of that product as they like until I have received payment for the first 3 and marked them as completed.
After that they cannot purchase that product anymore but how many more have they ordered already that have been shipped out already?

It would be good if it looked at other order statuses as well.
Or otherwise give the option when you create the qty restriction feature to select the appropriate statuses.

CommentFileSizeAuthor
#2 payment_received.patch986 bytesstackpr

Comments

savmac’s picture

I have the same issue. In fact, it seems like the default status should be "payment received" for the lifetime restriction to be in effect. I would think that most merchants who need a lifetime restriction would not want their customers to be able to purchase unlimited quantities before the orders ship and the restriction is initiated.

stackpr’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new986 bytes

I have attached a patch for this so the qty test will look at both completed and payment_received orders. It also resolves #728122: PostgreSQL doesn't like double-quotes since that relates to the same line.

agileware’s picture

@witti:
Why patch (to be ported)? What version is your patch for? Should it be needs review?

stackpr’s picture

Status: Patch (to be ported) » Needs review

Good call - wrong status. The patch is against 6.x-2.x.

luketsimmons’s picture

Hi witti/Agileware,

The patch works for me, previously it wasn't checking due to all my order statuses being payment received.

Does it need more than 3 of us to suggest it's been "reviewed & tested by the community" ? :-)

Thanks,
luke

jvieille’s picture

For me, this is not enough.
The quantity must be checked all the way long to the completion of the order.
Currently, the customer still can purchase as many products as he want while the order is pending.

Added ('in_checkout', 'processing', 'pending', in order_status check

$bought_qty = db_result(db_query("SELECT SUM(uop.qty) FROM {uc_orders} uo LEFT JOIN {uc_order_products} uop ON uo.order_id = uop.order_id WHERE uo.order_status IN ('in_checkout', 'processing', 'pending', 'completed', 'payment_received') AND uo.uid = %d AND uop.nid = %d ORDER BY uop.nid", $user->uid, $form_values['nid']));
    $data['rest'] = $data['qty'] - $bought_qty;
raulmuroc’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).