Jump to content
Sign in to follow this  
Ian

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

Recommended Posts

i know I have the bug too where the payment options are checked even when the voucher pays the amount so not sure what version will check thanks.

Share this post


Link to post
Share on other sites
I also intend to revert back to having separate boxes for GV and discount coupon redeems. The current code that shows only one box is a pretty poor kludge and I can't abide the code that does that. It also may affect future credit class modules, so it has to go.

 

I think that is a really good idea for another reason that may not have been thought of. What if a user has a GV and a DC to use on the same order? That is currently not possible. Having separate boxes for each resolves this dilemma!

 

Take some Valerian Root and get a good 6 hours sleep and you will be amazed at how much better your mind and body works. ;)


"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Share this post


Link to post
Share on other sites

Just a quick observation after installing 5.0.3:

 

In adminincludesadd_ccgvdc_application_top.php look for:

 

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

 

it should be:

 

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

 

(there is one bracket missing)

 

Cheers and thanx Ian for this outstanding contribution!

 

- D. Michael

Share this post


Link to post
Share on other sites

Ian,

 

DO you have two versions of the 5.0.3 going around

 

 

Just a quick observation after installing 5.0.3:  

 

In adminincludesadd_ccgvdc_application_top.php look for:  

 

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

 

it should be:  

 

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

 

(there is one bracket missing)  

 

I just downloaded the version here http://www.oscommerce.com/community/contributions,282

 

and the code in that file reads diffrent :

 

  function tep_gv_account_update($customer_id, $gv_id) {

   $customer_gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");

   $coupon_gv_query = tep_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");

   $coupon_gv = tep_db_fetch_array($coupon_gv_query);

   if (tep_db_num_rows($customer_gv_query) > 0) {

     $customer_gv = tep_db_fetch_array($customer_gv_query);

     $new_gv_amount = $customer_gv['amount'] + $coupon_gv['coupon_amount'];

     $gv_query = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $new_gv_amount . "'");

   } else {

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

   }

 }

 

And if so which is the most recent?

 

Thank for the wonderful work. It's a piece of art :lol:

Share this post


Link to post
Share on other sites

You are right

 

DO you have two versions of the 5.0.3 going around

 

There must be two versions, the one I remember had no bugs at all in it :lol:

 

If you look at the last line of the code you posted

 

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

 

it should be

 

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

Share this post


Link to post
Share on other sites

Melinda

 

It's there, but you need to get in the right frame of mind.

 

Drink 5 bottles of grolsch lager and then while downloading you must chant continually.

 

If peter piper picked a peck of pickled peppers, where's the peck of pickled peppers peter piper picked.

 

If you make a mistake with the chant you will be damned to the version with bugs :twisted:


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites

I guess thats what I get for looking to close LOL

 

I was looking for 2 lines because thats the way it wraped in the first message.....

 

I just need to step back and put on some sunscreen and aloe to protect form the radiation off the monitor.

 

Cheers,

Share this post


Link to post
Share on other sites

hello, great mod Ian, i'm having one problem tho, everything seems to be working except paying from my GV account.

 

i just bought ?30 of vouchers, they are showing in the account but when i want to purchase something with them i cant see any box to tick. what page should it be on? i hope someone can help bcos my php is zero :oops:

 

thx

Kinky.

Share this post


Link to post
Share on other sites

Ian, I have a suggestion regarding the GV FAQ page.

 

As everyone likes things different ways, I wanted to put it here in the forum to get everyone else's opinion.

 

Could you make the page have the FAQ topics at the top, then a horizontal rule, and then the contents of the FAQ? When a user clicks on a topic, they are moved to the appropriate bookmarked answer within the same page?

 

I personally hate pages that make me click for every answer instead of being able to scroll through the list of answers. Such is the reason for my request.

 

Let me know if the above does not make sense or if you would like any additional information.


"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Share this post


Link to post
Share on other sites

Hi Ian all the rest,

I am trying to get the GV contribution to work with the Paypal IPN (0.971) contribution and could use some ideas from you. My idea is to add the same GV code that you have added to checkout_process.php and checkout_confirmation.php to the Paypal IPN contribution.

 

As you pointed out before, the PayPal IPN contribution use it's own process and confirmation code, which is checkout_paypalipn.php and paypal_notify.php.

 

The things here is that paypal_notify.php is "redirected" from PayPal itself. This means that session vars may be old/deleted etc and you can not trust it's there anymore. My idea then is to update the file checkout_paypalipn.php with the same GV code. The file checkout_paypalipn.php contains code which save an order (with all products and attributes etc) to the database, unregister session vars and redirecting to PayPal. If you update the file checkout_paypalipn.php with:

 

<?php

/*

 $Id: checkout_paypalipn.php,v 0.971 2003-20-02 10:56:31 pablo_pasqualino Exp pablo_pasqualino $

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



...

$order_total_modules->update->credit_account($i);

...

$order_total_modules->apply_credit();

...

if ($credit_covers) $payment='';

$payment_modules = new payment($payment);

$payment_modules->update_status();



$order_total_modules = new order_total;

$order_total_modules->collect_posts();

$order_total_modules->pre_confirmation_check();



if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

 tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}



if (is_array($payment_modules->modules)) {

 $payment_modules->pre_confirmation_check();

}

... 

//unregister session vars

$order_total_modules->clear_posts();

...

tep_redirect("https://www.paypal.com/cgi.....")

 

There is one issue (at least) with this and that is if a customer aborts the confirmation at PayPal then the GV and/or DC will be gone since the coupon/GV is marked as redeemed. I guess that if you inform about this then it's ok.

 

Any thoughts about this? All input on this is appreciated.

 

/Fred

Share this post


Link to post
Share on other sites

plz plz plz anyone know where i can enable or disable or even change the amount that new accounts get?? they currently get ?10. plz help :oops:

 

plz i'm desperate.

Share this post


Link to post
Share on other sites

look in

 

catalog/includes/add_application_top.php or catalog/includes/add_ccgvdc_application_top.php if you have v5.03.


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites

ok i can disable it, what would i need to do to give 10% instead of ?10?

 

 

// Set the coupon ID that will be sent by email to a new signup, if no id is set then no email :)

define('NEW_SIGNUP_DISCOUNT_COUPON', '3');

 

how do i find a coupon id? does this mean i could make a new coupon in admin and assign that to emails?

 

thx

Kinky.

Share this post


Link to post
Share on other sites

I get the following error when truing to check out

 

Error!

 

Unable to determine the page link!

 

How do I fix this?


Keith

 

 

What the hell was I thinkin'?

Share this post


Link to post
Share on other sites

I respect your patience Ian, however, I am concerned to see so many people ask for answers in a demanding manner! I hope you recieve good amounts of Paypal donations... You deserve it! :oops: :shock: :roll:

Share this post


Link to post
Share on other sites

Hello Ian,

 

I installed the v.503 and it works (untill now) without any promlems. With the new install file it is much easier. Thank you!!!

 

I have one question about some files. Do I still need the file gv_redeem.php, since when I click on it, it does not appear even though it is under catalog/gv_redeem.php. And what for is the file coupon_restrict?

 

Thank you in advance

 

Devon

Share this post


Link to post
Share on other sites
I noticed something: I sent a gift voucher as a test. I redeemed the voucher from the email link, but I didn't log into my account & I closed the browser window. The funds from the coupon are gone.

 

Is this fixed in the newest 5.03 version? (I am currently running 5.02)

Share this post


Link to post
Share on other sites

Ian:

 

What happens if the voucher makes the total payment worth $0?

 

If I have Credit Card or paypal setup it still goes to the page.

 

For now I've put in the cash option, but is there a way to add a comment or maybe your script can detect a total price of $0 and put a message to choose the cash option?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×