Jump to content



Photo
- - - - -

Building a Store Credit System


  • Please log in to reply
52 replies to this topic

#1   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 14 May 2015 - 19:19

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.


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#2   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 14 May 2015 - 19:21

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


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#3   Bob Terveuren

Bob Terveuren
  • Members
  • 493 posts
  • Real Name:Bob Terveuren
  • Gender:Male

Posted 14 May 2015 - 22:25

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


Edited by Bob Terveuren, 14 May 2015 - 22:29.


#4   MrPhil

MrPhil
  • Members
  • 6,972 posts
  • Real Name:Phil
  • Gender:Male

Posted 14 May 2015 - 23:16

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.


Edited by MrPhil, 14 May 2015 - 23:17.


#5   chilinotes

chilinotes
  • Members
  • 31 posts
  • Real Name:Oliver
  • Gender:Male
  • Location:Frankfurt / Main, Germany

Posted 15 May 2015 - 08:05

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.


Sometimes systems that should not work, work nevertheless.


#6   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 08:21

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.


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#7   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 08:38

How to store an available Credit Balance?

 

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

 

Attached File  customers_credit_1.jpg   27.96KB   0 downloads

 

Easy enough. 

 

 


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#8   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 08:44

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:

 

Attached File  store_credit_2.jpg   10.8KB   0 downloads

 

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


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#9   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 08:45

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


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#10   chilinotes

chilinotes
  • Members
  • 31 posts
  • Real Name:Oliver
  • Gender:Male
  • Location:Frankfurt / Main, Germany

Posted 15 May 2015 - 08:46

@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?


Edited by chilinotes, 15 May 2015 - 08:54.

Sometimes systems that should not work, work nevertheless.


#11   chilinotes

chilinotes
  • Members
  • 31 posts
  • Real Name:Oliver
  • Gender:Male
  • Location:Frankfurt / Main, Germany

Posted 15 May 2015 - 09:09

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


Sometimes systems that should not work, work nevertheless.


#12   AngusD

AngusD
  • Members
  • 79 posts
  • Real Name:Rene
  • Gender:Male

Posted 15 May 2015 - 09:19

(...)

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



#13   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 10:14

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


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#14   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 10:19

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 ? 


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#15   wHiTeHaT

wHiTeHaT
  • Community Team
  • 1,135 posts
  • Real Name:Henry
  • Gender:Male
  • Location:Netherlands

Posted 15 May 2015 - 11:40

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.


Edited by wHiTeHaT, 15 May 2015 - 11:47.

Do you need an osCommerce website? Do you want to have an Responsive osCommerce CONTACT ME as i am for HIRE

#16   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 11:57

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.


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#17   wHiTeHaT

wHiTeHaT
  • Community Team
  • 1,135 posts
  • Real Name:Henry
  • Gender:Male
  • Location:Netherlands

Posted 15 May 2015 - 12:02

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?)


Edited by wHiTeHaT, 15 May 2015 - 12:10.

Do you need an osCommerce website? Do you want to have an Responsive osCommerce CONTACT ME as i am for HIRE

#18   burt

burt

    I drink and I know things

  • Community Team
  • 12,438 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 15 May 2015 - 12:13

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 ?


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#19   wHiTeHaT

wHiTeHaT
  • Community Team
  • 1,135 posts
  • Real Name:Henry
  • Gender:Male
  • Location:Netherlands

Posted 15 May 2015 - 12:17

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.


Do you need an osCommerce website? Do you want to have an Responsive osCommerce CONTACT ME as i am for HIRE

#20   AngusD

AngusD
  • Members
  • 79 posts
  • Real Name:Rene
  • Gender:Male

Posted 15 May 2015 - 13:22

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