Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

burt

Building a Store Credit System

53 posts in this topic

Thread showing customised code for "store credit" being thought out and built, trying to keep as few core changes as possible.

 

Comments and opinions welcomed.

Share this post


Link to post
Share on other sites

Need a way to;

 

1.  assign credit balance to individual customers

2.  allow customers to see their available balance

3.  use store credit to pay for all or part of the total

4.  reduce available balance by the used amount

Share this post


Link to post
Share on other sites

Hi

 

You could run with either the code (to start with) or the basic idea of Points & Rewards http://addons.oscommerce.com/info/3220 and just use the Points side of things.

 

That would allow you to assign X credits to a customer and then set them up to be used in an order_total module as an adjuct to a normal payment module.

 

That one does require a lot  of core code edits though - I think if you are going to add more hooks/templating to 2.4 then you could minimise those a bit - I am not too aware of where/how those are going to work but the addon above pops code into customer_account, checkout_process and checkout_payment at the very least.

 

edit: and the admin side has no hook into the customers page

Share this post


Link to post
Share on other sites

Any "gift card" add-ons that might either do the whole thing, or at least be a good start? The toughest part might be having it automatically applied so that the customer doesn't have to enter in a long string of digits.

Share this post


Link to post
Share on other sites

Great idea !!!

 

For customers an advantage must be to use it

 

like ...

 

- free shipping 

- special discount

- something like -> Order 3 Pay 2

- spezial "Spezials"

 

There must be incentives - for customers and for shopowner, to place it as a part of their advertising.

Share this post


Link to post
Share on other sites

Thanks for the comments.

 

@@Bob Terveuren

The main "problem" as I see it is how to make sure that external payment processors (eg Paypal) don't choke if there is zero to pay - in other words if the credit balance exceeds the order total.  The rest should be fairly straightforward.

 

Looking at that addon is the exact reason why I have to write something else -> over-engineered in the first place, and updated by multple people.  Avoid, avoid, avoid.

 

@@MrPhil

Some sort of voucher system could have been hacked up but it's better to use a square peg in a square hole.

 

@@chilinotes

What you seem to need is a voucher system as Phil points out.

Share this post


Link to post
Share on other sites

How to store an available Credit Balance?

 

Obvious place is in the customers table.  Notice new customers_credit entry:

 

post-69-0-37526000-1431679071_thumb.jpg

 

Easy enough. 

 

 

Share this post


Link to post
Share on other sites

And now we need to change some core code in admin/customers.php to allow Shopowner to add/remove credit on a per customer basis.  Open up customers.php and add in new code for customers_credit.  Basically by copying what is done for (eg) customers_fax.

 

A couple of new defines in the accompanying language file and we have a new input box where we can add/change the Credit Amount:

 

post-69-0-91828500-1431679412_thumb.jpg

 

I'll set it 100 (in other words $100 of Credit).

Share this post


Link to post
Share on other sites

Allowing customers to see their balance, without core code changes.  Any ideas ?

Share this post


Link to post
Share on other sites

@@burt

@@MrPhil

 

Sorry, I have perhaps not understood correctly, therefore I ask for.

What is the advantage for the customer, what is the difference to Paypal.

Did I use the term "Credit System" wrong and you mean credit for customers -> commercial credit?

Share this post


Link to post
Share on other sites

Hi

 

sorry I can't help do any codings... not enough skills ...

 

.... like "you already bought this"-module -> after customer login -> message "100$ available for your purchase" currently to cart content

...  like "your reviews" in customer account a balance for credit

Share this post


Link to post
Share on other sites

(...)

A couple of new defines in the accompanying language file and we have a new input box where we can add/change the Credit Amount:

 

I'll set it 100 (in other words $100 of Credit).

 

Hi,

 

please, don't add a store credit by yourself into a customer account.

 

Let the customer do this. Send them an e-mail with a link and add the amount to the account when the customer clicks the link. Save the date and time when the customer did this in the database, too. Use a unique ID for each store credit and disable this ID after the amount has been added to the account.

 

If your really want to add the amount by yourself, save the date and time when you added the amount and send an e-mail to the customer that a store-credit has been added to his account. Send this e-mail to yourself, too.

 

This way, no one can say they didn't receive the store credit.

 

AD

Share this post


Link to post
Share on other sites

I put it to you M'Lud that @@AngusD is guilty.  Guilty of overthinking.  :thumbsup:

Share this post


Link to post
Share on other sites

I also know that I need to do "other things" with the Credit Balance (eg, show it elsewhere, reduce it, and so on).  I don't really want to have to write out a SQL everytime I want to do something with Credit, so what options do I have? Make a lot of new functions ? 

Share this post


Link to post
Share on other sites

1.Put the Credit (as you did)

2.Before checkout give customer option to use his credit.

3.There must be a rule to allow/disallow usage of the credit (if have $100 credit... do you allow purchase for a $5,- product... so it is sort of free?...

   (ifso you need check if must goto payment or skip the payment)

4.Do you want to force usage of the Credit (to it's full value)  once user told to use his credit.

   What i try to say is.... if have $100 credit and have $200 worth of products in cart....once user choosed to use his credit.... can he say... i wanna use $50 of his credit... or automaticly use the full credit?

5. to decrease the credit, must use a order total menu (like a discount module that decrease the order total by it's (used) credit value).

 

 

**5 . An all in 1 solution would be to ONLY create a order total menu that shows a dropdown( or Checkbox/Radio-button) if user has any credit...

inside the dropdown.... could say... use credit.

or.........

if want to allow partial usage of credit.....make a dropdown like for example:

-Choose:

--- 5

---10

---20

---30

---Take All my credit

 

I think the order total module is the most easyest/simplest way to accomplish this task.

Share this post


Link to post
Share on other sites

Make it simple:   credit is always used, the buyer has no choice.

 

If he has $50 credit, and the cost or the order is $40, he is then left with $10 to spend next time.  <-- how do we deal with the zero payment, bear in mind that payment choice is made before order_totalisation...

 

If he has $50 credit, and the cost is $75, he has to pay $25.  Easy enough, he already chose his payment method.

Share this post


Link to post
Share on other sites

The substraction of the credit is as same as how a discount coupon works.

So... to see how the payment is handled when would have used a coupon, it would be wise to lookup how it is done in a coupon add-on.(depanding if the coupon add-on handles such cases lol).

 

If now all that is covered in a coupon add-on....

you could convert that module to allow usage of a :

 

-coupon code

-the users credit balance.

 

Then have a 2 in 1 module .......tadaaaaa

 

in theory you create a base for any kind of discount that could occure... handled by type of discount....

 

use a coupon (group coupons)

use credit balance (group users balances)

use fixed discount (group fixed discounts if user is assigned to that group)

.........etc etc........ whatever you can imagine for any other discount.

 

But then we ofcourse go over the initial subject, however it is something that could be considered (if can do it all-in-1.... why not?)

Share this post


Link to post
Share on other sites

The point is not to copy any coupon addon, none of them work as they should do.

 

So, back to the question:  how to deal with a zero payment ?

Share this post


Link to post
Share on other sites

if i remember correct, a coupon add-on looks up the order total once entered a coupon code, BEFORE choose a payment.

If follow the same procedure, but then instead let look up the order total if have a balance, your good to go.

Share this post


Link to post
Share on other sites

I put it to you M'Lud that @@AngusD is guilty.  Guilty of overthinking.   :thumbsup:

 

Maybe, maybe not. If a system can be exploited, people try to expoit it.

 

Now I'm overhinking. ;)

 

How to deal with zero payments?

 

Ideal: order_total == 0 -> checkout_confirmation directs directly to checkout_process without touching the payment modules. You just don't need them. Unfortunately this doesn't work without changing the checkout_confirmation-script.

 

Possible solution: checkout_confirmation.php (unaltered file: line 100)



if (isset($$payment->form_action_url)  && $order->info['total'] > 0) { // If order_total is larger than zero use the selected payment option,
    $form_action_url = $$payment->form_action_url;
  } else {  //else direct the customer directly to checkout_process
    $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
  } 

I think you need to make adjustments to the checkout_process-file, too. It needs to know, that the zero-payment-order is ok and can be processed.

 

AD

Share this post


Link to post
Share on other sites

With some advice from @@wHiTeHaT I've gotten this finished with no core code changes other than the necessary core code change in admin/customers.php

 

Will post more about what was done after the weekend.

Share this post


Link to post
Share on other sites

Ah...no one is gonna like this solutions...but I used a CCVG version 5.8 hack. Yes, massive core codes change...I don't use the gift card feature, but I use its mail gift voucher and gift voucher sent as a way to manager store credit...now, something else to think about...if you are offering free shipping...do you want to offer it when customers are using store credit? Our avg shipping cost is $12 and sometimes up to $16USD so we couldn't offer free shipping when store credit was being applied...so another painful hack was necessary...but the store credit works for years now...CCVG is a good start but a lot more clean up work is needed...

 

in the pics customer can see her credit after login...

 

 

 

 

post-30493-0-55430000-1431722922_thumb.jpg

post-30493-0-08978700-1431722945_thumb.jpg

post-30493-0-48921000-1431722960_thumb.jpg

Share this post


Link to post
Share on other sites

Just a thought...

 

To avoid misunderstandings the customer should get a statement of account as pdf send by email after purchase.

Plus an extra copy send to the shopower. This may simplify the work, all is in the files.

Share this post


Link to post
Share on other sites

Oh, also...CCVG's gift voucher sent page can give a good audit trail on credit issued...especially important if you have employees...using the admin login id we can track who issued the credit and who redeemed it...no chance for embezzlement...we also setup a store credit liability account to keep track of things...

post-30493-0-87370800-1431730878_thumb.jpg

Share this post


Link to post
Share on other sites