Customer has a balance due - prevent new orders
Has anyone ever tried to do this? Is it even possible to do so?
Input appreciated
~Mo
Customer has a balance due - prevent new orders
Customer has a balance due - prevent new orders
~Mo
Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Ablecommerce Gold R11 Catalog LIVE
Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Ablecommerce Gold R11 Catalog LIVE
Re: Customer has a balance due - prevent new orders
It's certainly possible but it's going to create a lot of hits to the SQL database.
Able doesn't store a specific 'customer balance' amount in the User table. So every balance amount would have to be derived by looping through all orders and all payments of a given customer order history. Every time you want to check the balance.
Design-wise, it's pretty straight forward:
1. Add a UserSettings field to the Edit-User page for 'Allow Purchase when customer has a balance?'
2. Create a helper class to compute the current balance of a given UserId
3. Create a helper class to quickly determine if a UserId has the Allow-purchase-with-a-balance flag set or not set
4. Modify checkout to call the helper classes and respond accordingly
You'd still have to decide what to do on checkout if they have a balance. I.e. dump the shopper to a 'pay your balance now' page, or just throw up a message 'Sorry you can't buy my stuff' etc.
Able doesn't store a specific 'customer balance' amount in the User table. So every balance amount would have to be derived by looping through all orders and all payments of a given customer order history. Every time you want to check the balance.
Design-wise, it's pretty straight forward:
1. Add a UserSettings field to the Edit-User page for 'Allow Purchase when customer has a balance?'
2. Create a helper class to compute the current balance of a given UserId
3. Create a helper class to quickly determine if a UserId has the Allow-purchase-with-a-balance flag set or not set
4. Modify checkout to call the helper classes and respond accordingly
You'd still have to decide what to do on checkout if they have a balance. I.e. dump the shopper to a 'pay your balance now' page, or just throw up a message 'Sorry you can't buy my stuff' etc.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- NC Software
- AbleCommerce Partner
- Posts: 4620
- Joined: Mon Sep 13, 2004 6:06 pm
- Contact:
Re: Customer has a balance due - prevent new orders
Maureen,
I have thought about having something like this too, however, it only blocks that one account. What's to prevent the user from creating a new account and purchasing under a different e-mail? So before you go through a lot of work or expense, think about if it will really achieve your goal.
What you may need to do is like Able does, all orders are pending and they approve each one individually. So if you take on the same approach, depending on the order load, you could prevent an order from occurring by moderation.
I have thought about having something like this too, however, it only blocks that one account. What's to prevent the user from creating a new account and purchasing under a different e-mail? So before you go through a lot of work or expense, think about if it will really achieve your goal.
What you may need to do is like Able does, all orders are pending and they approve each one individually. So if you take on the same approach, depending on the order load, you could prevent an order from occurring by moderation.
Neal Culiner
NC Software, Inc.
NC Software, Inc.
Re: Customer has a balance due - prevent new orders
Thank you for the input, but it's too time consuming to manually check the customers account to see if there is a balance, so that's probably not the solution we need.
Joe's probably got the best answer, but he's right about bogging down the SQL with hits. I'll probably have to shelve this idea for the moment.
Thanks!
Joe's probably got the best answer, but he's right about bogging down the SQL with hits. I'll probably have to shelve this idea for the moment.
Thanks!
~Mo
Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Ablecommerce Gold R11 Catalog LIVE
Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Ablecommerce Gold R11 Catalog LIVE
Re: Customer has a balance due - prevent new orders
If you limited the balance check to the checkout page, and thus just disable the checkout button, your SQL hits would not be that much tbh, just one SQL call per checkout page performing a SUM of the TotalCharges - TotalPayments within the Orders table. If you have a positive number, then you have a balance and disable the button.