Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Credit Class/Gift voucher/Discount Coupon v5


Ian

Recommended Posts

Now combined into one contribution.

 

Download at http://www.oscommerce.com/community/contributions,282

 

The changes to the previous versions are as follows.

 

Core Credit Class Code.

 

The whole database structure has been changed. This was needed to help with the single redeem box,

and to provide better reporting possibilities.

Changes to the order_total ouput to allow for a single redeem box.

 

Gift Voucher System

 

Thanks to gdfwilliams, I've done away with separate box to show the amount in a customers Gift Voucher Account.

This is now shown in the shopping cart box.

 

The code now uses the get_content_type function to skip shipping selection if the Gift Voucher is the only item

in the cart.

 

The decision to queue purchases of Gift Vouchers is now set in admin rather than having to edit a DEFINE in

add_application_top.php

 

A new tax option has been added to treat Gift Vouchers like credit notes. If you don't know what that

means it probably doesn't concern you.

 

Redemption by email is now much simpler. There is no need to login, as the redeemed value is stored

in a session variable until the user checksout.

 

It is now possible to set a variable (in includes/add_application_top.php) to send a Gift Voucher

to new customers when they create an account.

define('NEW_SIGNUP_GIFT_VOUCHER_AMOUNT', '10');

 

It is also now possible to set the length of the redeem codes generated by the system.

define('SECURITY_CODE_LENGTH', '10');

again this is located in catalog/includes/add_application_top.php

 

If Voucher purchases are queued then the customer is informed by email when the amount is released

by admin.

 

Discount Coupon System

 

Lots of tidying up in the admin area, including the addittion of a proper voucher usage report.

A new Free Shipping Voucher (again thanks to gdfwilliams for the idea).

As for the Gift Voucher a new tax calculation treating the Coupon as a Credit Note.

The whole tax calculation logic has in fact been rewritten.

Again like the GV system, you can now set a Disount Coupon to be sent to a new customer on signup.

define('NEW_SIGNUP_DISCOUNT_COUPON', '3');

the value (e.g. '3') is the coupon id as created in admin.

The discount coupon is now shown in the shopping cart box when redeemed, this also has a 'more info' link

that gives full details of what the Coupon is worth including any category/product restrictions.

 

I'm currently working on a much more intuitive way of defining category/product restiction for the Discount

Coupon system. I will release this as an upgrade file asap.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

  • Replies 499
  • Created
  • Last Reply

Top Posters In This Topic

Hi!

 

I updated to this new contribution but whenever i send a voucher to someone....they get this error whenever they click on the link inthe email:

 

1064 - You have an error in your SQL syntax near '' at line 1

 

insert into coupon_gv_customer (customer_id, amount) values ('2', '20.0000'

 

[TEP STOP]

 

The thing is, even though they get this, it still adds to their account and that's cool and all, but THEY CAN"S USE IT.

 

In checkout_payment.php, i changed my file for yours completely but they cant selected Gift Voucher and the Gift Voucher isnt counted towards the purchase......

 

can you please help?

Link to comment
Share on other sites

also in create_account_process.php...

 

 

i get this error...

 

1064 - You have an error in your SQL syntax near '' at line 1

 

insert into coupon_gv_customer (customer_id, amount) values ('32', '20.0000'

 

[TEP STOP]

Link to comment
Share on other sites

Ian,

 

Firstly thanks for the new version, long awaited for, quickly tested with OC MS1 and current snapshot CVS 05-03-2003 and I have found the following problems.

 

Problems encounted with MS1 release

 

1. Redemption problem with newly created user.

User purchases gift voucher and sends it to another person. The receipient receives email and clicks the link to redeem the voucher, the amount is entered in the shopping cart, they then purchase a product, they then get directed to login or create an account, they then create an account and when they submit their details they get the following error on page create_account_process.php

 

1064 - You have an error in your SQL syntax near '' at line 1

 

insert into coupon_gv_customer (customer_id, amount) values ('9', '100.0000'

 

[TEP STOP]

 

2. Redemption problem with existing user redeeming.

 

When this user receives an email for a GV for $100 they click the link, the amount is put in the shopping cart, they login to the site( they already have an account), they then purchase a product for $200 and they checkout and select part payment credit card details and Tick to use gift voucher account balance. They then go to the Order Confirmation page and it says:

 

Total $200

Gift/Vouchers Coupons $100

 

The confusing problem for a buyer on this page, is it's not telling them exactly how they are paying for the $200 amount, There should be another line "Credit Card purchase amout:"

eg lookig like this:

 

Total $200

Gift/Vouchers Coupons $100

Credit Card purchase amout: $100

 

When I go to Admin and look at the orders its showing the Total $200 and GV/Coupons $100, I want to know when the buyers credit card detail go through the payment gateway does the $100 gets debited from their card or is it the full amount of $200.00? I am asking this question because I am currently testing as local host.

 

 

Problems encounted with CVS -5-03-2003

 

1. When I go to either login or create new account from the default page I get the error "page cannot be displayed.

 

regards

 

Tim

ps. Thanks for refining this great contribution, long awaited for a much better redemption method

Link to comment
Share on other sites

okay.....i keep getting htis too....this is horrible...

 

1146 - Table 'greekretreat_com.TABLE_COUPON_REDEEM_TRACK' doesn't exist

 

insert into TABLE_COUPON_REDEEM_TRACK (coupon_id, customer_id, redeem_date, redeem_ip) values ('2', '44', now(),'67.115.86.232')

 

[TEP STOP]

 

 

and the TABLE IS THERE.....this is nuts...i just want to go back to the old one now and i can't everything is all changed and stuff...ic an't even create a new account without getting that error...

Link to comment
Share on other sites

I have found another problem, when you purchase a GV eg. worth $100, you then email it to a recepient, the gv amount is removed from your account and you log out, the recipent receives the amount and purchases something with the gv amount....all said good and done...

 

But when you go back and login you have $100 in your voucher balance, why does it put the $100 back as you have already sent this off.

 

 

regards

 

Tim

Link to comment
Share on other sites

Help - Im having a small problem - Whenever a customer has money in their gv account - I have no where to tick 'Use GV Account' nemore - so therefore the customer is stuck with it unless they send it!!

 

Warren

Link to comment
Share on other sites

OK

 

BUG 1.

 

1064 - You have an error in your SQL syntax near '' at line 1



insert into coupon_gv_customer (customer_id, amount) values ('9', '100.0000'



[TEP STOP]

 

To FIX.

 

edit catalog/includes/add_application_top.php Line 62

      $gv_query = tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $coupon_gv['coupon_amount'] . "'");

 

change to

 

      $gv_query = tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $coupon_gv['coupon_amount'] . "')");

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Tim

 

When this user receives an email for a GV for $100 they click the link, the amount is put in the shopping cart, they login to the site( they already have an account), they then purchase a product for $200 and they checkout and select part payment credit card details and Tick to use gift voucher account balance. They then go to the Order Confirmation page and it says:

 

Total $200

Gift/Vouchers Coupons $100

 

Adjust the sort order of your order_total modules, so that the Gift Voucher/Discount Coupon come before the total.

 

You will then get

 

Gift Voucher $100

Total $100

 

You could even change the text for 'total' to say Balance Outstanding.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Tim

 

I have found another problem, when you purchase a GV eg. worth $100, you then email it to a recepient, the gv amount is removed from your account and you log out, the recipent receives the amount and purchases something with the gv amount....all said good and done...

 

But when you go back and login you have $100 in your voucher balance, why does it put the $100 back as you have already sent this off.

 

This does not happen for me, can you try and reproduce the problem on

 

www.zenwarehouse.com/new_cc_gv/catalog/

 

And let me know.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Ian,

 

Thanks for your prompt replies, I have done the following with MS1:

 

1.

 

1064 - You have an error in your SQL syntax near '' at line 1

 

insert into coupon_gv_customer (customer_id, amount) values ('9', '100.0000'

 

[TEP STOP]

 

I have applied your suggestion and its ok now.

 

2.

 

have found another problem, when you purchase a GV eg. worth $100, you then email it to a recepient, the gv amount is removed from your account and you log out, the recipent receives the amount and purchases something with the gv amount....all said good and done...

 

But when you go back and login you have $100 in your voucher balance, why does it put the $100 back as you have already sent this off

 

I have tried replicating the problem on your site, no luck your site is ok, the only difference being your site hasn't got credit card processing on, cash only.

 

I turned credit card processing off and I have no issues, I then turned credit card processing on no issues, seems to be ok now. Any suggestions why its working.

 

 

3.

 

When I go to Admin and look at the orders its showing the Total $200 and GV/Coupons $100, I want to know when the buyers credit card detail go through the payment gateway does the $100 gets debited from their card or is the full amount of $200.00? I am asking this question because I am currently testing as local host and whant to know what happens when I have a CC payment gateway and my site is live?

 

I will be testing everything again more thouroghly tommorrow.

 

Thanks again for this fantastic contribution, should be released with OC!!

 

Regards

 

Tim

:D

Link to comment
Share on other sites

Tiim

 

Was this the standard Credit Card module. I did in fact have thhe Credit Card module, and authorizenet module enabled while testing. I only switched them off before I gave out the URL.

 

3. The value passed to any final payment method is the balance less any discounts/Gift Vouchers.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

IAN!!

very good job, thanks a bunch for all the work you have done!

waited a long time for this...install went without any problems, pretty simple actually, however, (and its just really a small thing) went into the admin area -coupon admin, and noticed a missing graphic.."Voucher report".

Pulled up the properties and its looking for a file called "button_report." (notice as well, no .gif extension) searched the install files u provided and found no such graphic.

again, really just small thing, but thought u would like to know

thanks again!

d

Link to comment
Share on other sites

also when you click redeem in the admin menu to send the purchased gift voucher to the customer..and then yu confirm it , it sends an email.....that;s all correct but the email reads like this:

 

You recently purchased a Gift Voucher from our online store.

For security reasons this was not made immediately available to you.

However this amount has now been released. You can now visit our store

and sent the value via email to someone else

 

The Gift Voucher(s) you purchased are worth $0.00

 

The gift voucher was actually for $100.00.

 

Any ideas?

Link to comment
Share on other sites

Hi Ian,

 

I have tried your new contribution. The folowing are some problems I encountered in the Discount Coupons.

 

1. Although the discount was shown in during checkout, It's not deducted. The admin/orders modules does not indicate any discount coupon discounts and shows the full price.

 

2. The reports in Coupon Admin does not update for each subsequent purchase. The Redemption "For This Customer" is always =1, iregardless of the number of redemption.

 

Please help.

Link to comment
Share on other sites

hello, having a couple of problems.

 

Receiving an error message when attempting to e-mail a discount coupon. The error is being caused by FILENAME_COUPON , which has a number of references in the file coupon_admin.php.

 

There is no definition in the add_application_top.php!

 

Dave

Link to comment
Share on other sites

Another problem I am experiencing is when mailing a gift voucher amount. The file catalog/gv_send.php loads as far as the message input area and then this error message is displayed

Error!

 

Unable to determine the page link!

 

I am using MS1.

 

This is one hell of a release! You are a champion.

:bigups:

Link to comment
Share on other sites

There definitley seems to be a problem with redeeming coupons. However this seems intermittent.

 

Geoser, can you tell me which PHP version you are using. I'm sure discount coupons were working on my test site. However I upgraded to PHP 4.3.1 and now they are not working. :cry:

 

BTW

 

I've fixed the other bugs relating to emailing in admin. I'll post an update as soon as I sort the Discount Coupon problem

Trust me, I'm an Accountant.

Link to comment
Share on other sites

I've been testing the Gift Voucher,, and there is a couple problems here. I created the Gift Voucher.. As a product just as you said.. Then purchased it.. And it did not show up in my shopping cart automatically.. And so,, on that note, I went to the admin to mail myself a voucher.. So when I did that.. I got a blank page and this link was inside of my Address Bar..

 

http://www.mysite.com/admin/FILENAME_COUPO...iew_email&cid=1

 

I take it that I've found another mistake or bug.. I'm not certain here. So from what I can tell.. The gift vouchers are not being put on que in the admin when purchased from inside the shop.. And a faulty link is at play when you try to email a voucher to someone from the vouchers admin.

 

Ian, I've emailed you this exact text.. Haven't heard back from you.. So I'm going to post this issue in the forum being that everyone else seems to be having similar problems. Sorry to say.. :(

Link to comment
Share on other sites

OK,

 

The problem where coupons do not show in the final order, is definitely a session var problem with php 4.3.x.

 

I've re-written the code to use the $_SESSION array and all seems to be working now. I'll post a new contribution shortly.

 

The update will also fix the FILENAME_COUPON problem and the email problem when releasing a queued GV.

 

For those having problems getting purchased Gift Vouchers to add to the cart. First make sure the product model for the Gift Voucher is set to GIFT?????. Where the ???? can be anything you want.

 

Also check the queue settings in admin->modules->order_total->Gift vouchers

Trust me, I'm an Accountant.

Link to comment
Share on other sites

OK - What about my problem with the customer not ahving the option to use their voucher funds during checkout to get discount??

 

And when will you upload this brilliant contribution?

 

Thanks,

Warren

Link to comment
Share on other sites

I've just uploaded another update

 

Fixes 3 Bugs.

 

Missing define for FILENAME_COUPON

Missing GV Value in coupon redeem release email

PHP 4.3.1 problem affecting Discount Coupons

 

Files affected

 

admin/includes/add_application_top.php

admin/gv_queue.php

catalog/includes/classes/order_total.php

catalog/includes/modules/ot_gv.php

catalog/includes/modules/ot_coupon.php

 

http://www.oscommerce.com/community/contributions,282

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Warren,

 

Do you get any output on checkout_payment.php for Gift Vouchers/Discount coupons at all.

 

e.g. Do you have a redeem box.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...