Customer has a balance due - prevent new orders

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
Mizmo67
Commander (CMDR)
Commander (CMDR)
Posts: 155
Joined: Wed Mar 16, 2005 5:35 pm
Location: NJ
Contact:

Customer has a balance due - prevent new orders

Post by Mizmo67 » Thu Jun 28, 2012 1:54 pm

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
~Mo

Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Image
Ablecommerce Gold R11 Catalog LIVE

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Customer has a balance due - prevent new orders

Post by AbleMods » Tue Jul 03, 2012 10:26 am

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.
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

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Re: Customer has a balance due - prevent new orders

Post by NC Software » Wed Jul 04, 2012 11:29 am

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.
Neal Culiner
NC Software, Inc.

User avatar
Mizmo67
Commander (CMDR)
Commander (CMDR)
Posts: 155
Joined: Wed Mar 16, 2005 5:35 pm
Location: NJ
Contact:

Re: Customer has a balance due - prevent new orders

Post by Mizmo67 » Wed Jul 25, 2012 4:38 pm

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!
~Mo

Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Image
Ablecommerce Gold R11 Catalog LIVE

DG433
Ensign (ENS)
Ensign (ENS)
Posts: 7
Joined: Tue Aug 07, 2012 2:04 pm

Re: Customer has a balance due - prevent new orders

Post by DG433 » Thu Aug 09, 2012 1:03 pm

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.

Post Reply