Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Class/Gift Vouchers/Discount Coupons 5.10


Strider

Recommended Posts

Primadude,

Just used your ot_coupon.php that you posted and is does seem to address the 2x click issue but it stilll has a problem (at least on my site).

 

When I successfully redeem a coupon, odd thing: the 'Congratulations' message that is generated uses the text from ERROR_REDEEMED_AMOUNT?

 

So, it tells us that even though it is applying the coupon correctly, it is generating text using an ERROR redeem message which, in theory, means the coupon wasn't redeemed properly (although it seems to apply the correct coupon discount). Note: instead of fixing this problem, it appears someone just changed the ERROR_REDEEMED_AMOUNT message to a positive 'Congratulations' message instead.

 

Maybe the ERROR_REDEEMED_AMOUNT is just mislabeled and should be called REDEEMED_AMOUNT_TEXT?

 

I don't think this is the case because as i mentioned earlier, the message comes from Rigalin's code:

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT), 'SSL')); // Added in v5.13a by Rigadin

 

Ideas anyone?

Link to comment
Share on other sites

  • Replies 4.8k
  • Created
  • Last Reply

Top Posters In This Topic

Primadude,

Just used your ot_coupon.php that you posted and is does seem to address the 2x click issue but it stilll has a problem (at least on my site).

 

When I successfully redeem a coupon, odd thing: the 'Congratulations' message that is generated uses the text from ERROR_REDEEMED_AMOUNT?

 

So, it tells us that even though it is applying the coupon correctly, it is generating text using an ERROR redeem message which, in theory, means the coupon wasn't redeemed properly (although it seems to apply the correct coupon discount). Note: instead of fixing this problem, it appears someone just changed the ERROR_REDEEMED_AMOUNT message to a positive 'Congratulations' message instead.

 

Maybe the ERROR_REDEEMED_AMOUNT is just mislabeled and should be called REDEEMED_AMOUNT_TEXT?

 

I don't think this is the case because as i mentioned earlier, the message comes from Rigalin's code:

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT), 'SSL')); // Added in v5.13a by Rigadin

 

Ideas anyone?

 

Paul,

 

I am glad the 2x fix worked for you! Yep, I see what you mean. My successful redeem message uses the ERROR_REDEEMED_AMOUNT text too. In fact, when a successful redemption is acheived, the URL posts it too:

 

https://<your_web_site>/catalog//checkout_payment.php?payment_error=ot_coupon&error=Congratulations%2C+you+have+redeemed+%243.30.&osCsid=968bd89c71570baef0e3dc18ada1c5cd

 

I have changed my ERROR_REDEEMED_AMOUNT text to just say:

 

Congratulations, you have redeemed $x.xx.

 

So the problem is cosmetic and should be fixed but this is pretty easy to do. I'll work on it this weekend and post it if you don't get to it already.

 

---------

 

Here is a tip for those that develop on local Windows workstations like I do and then upload to their provider production site. When I want to find some particular code and search all .php files on my dev site for a text string, I use thhe following windows command.

 

This is an example running this command from from my local dev site directory on d:\server\apache\htdocs\catalog:

 

findstr /s /c:"ERROR_REDEEMED_AMOUNT" *.php

 

This will show you every php file that contains the string "ERROR_REDEEMED_AMOUNT". I use this all the time and it works great to track down what php file has the code you are looking for. Hope this tip helps someone... :D

 

Joe

Link to comment
Share on other sites

Quick Question: any reason not to change a file from:

 

........... <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

....... </tr>

............ <tr>

........ <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

....... <tr class="infoBoxContents">

... <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

.............. <tr>

................... <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

.................... <td class="main"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>

........................... <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

 

To:

 

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>

<td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

 

(periods added to hold position)

PLMK,

 

Thanks

Edited by shanejackson
Link to comment
Share on other sites

Quick Question: any reason not to change a file from:

shanejackson,

I assume you are asking about properly indenting code? Yes, there is a reason...while coding, properly indenting makes it easier to determine where a particular <td>, <tr>, etc begins and ends. Hard to explain/show using this bulletin board (easier to see visually) but basically, it makes it easier for people to determine visually where part of you code blaock begin and end(See a quick discussion here).

 

Separately, primadude that's a great search tip. I was using Frontpage by default to search for code but hated to do it (it adds that crapp _vti to every folder)

 

Finally, don' think the problem is cosmetic...

So the problem is cosmetic and should be fixed but this is pretty easy to do. I'll work on it this weekend and post it if you don't get to it already.

because it is actually using the 'payment_error' function whihc would lead me to beleive that the code is saying the my coupon redeem has an error (even though the message says Congrats)?

Link to comment
Share on other sites

shanejackson,

I assume you are asking about properly indenting code? Yes, there is a reason...while coding, properly indenting makes it easier to determine where a particular <td>, <tr>, etc begins and ends. Hard to explain/show using this bulletin board (easier to see visually) but basically, it makes it easier for people to determine visually where part of you code blaock begin and end(See a quick discussion here).

 

Separately, primadude that's a great search tip. I was using Frontpage by default to search for code but hated to do it (it adds that crapp _vti to every folder)

 

Finally, don' think the problem is cosmetic...

 

because it is actually using the 'payment_error' function whihc would lead me to beleive that the code is saying the my coupon redeem has an error (even though the message says Congrats)?

 

Paul,

 

Yes, you are correct. I looked at this tonight and determined that this is not a cosmetic (easy) issue. Here is the line of code in /catalog/includes/modules/order_total/ot_coupon.php that produces the "success" message:

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode($err_msg), 'SSL'));

 

If you temporarily comment this code out and enter a good redeem code, the success message is not displayed (but the redeem valuse is successfully deducted), proving this code is considered the "success" message. The code above this line is a gauntlet of error checks and messages. If there are no errors, this final line of code is executed and treated as a success. It seems to me that the success message is using the error code functions by design (unfortunately).

 

So the question is, what is the benefit of working a fix for this? This is all I can think of so far:

 

1) The URL produced when redeeming the code would not indicate it is an "Error".

 

2) It might be nice to have a green box around a successful redemption code instead of using the red error code box.

 

What do you think?

 

Joe

Link to comment
Share on other sites

Question:

 

When you redeem a coupon, what is supposed to happen?

 

In my store, you are returned to the checkout_payment page, and the cart in the RH column is updated showing the coupon name but that's it.

 

 

Anyone?

 

When a coupon is redeemed, is the coupon redemption area on the checkout_payment form supposed to go away?

 

What else happens?

 

A quick explanation of the process would help me out tremendously.

John Skurka

Link to comment
Share on other sites

I have a strange problem. This is the results I am getting when someone checks out:

 

Sub-Total: $153.79

United Parcel Service (1 x 11lbs) (Ground): $9.55

Tax (Texas Only): $13.48

Total: $176.03

 

 

If you add it up it should be: 176.82. The total is not adding in the tax on the shipping charges. In the tax portion it is added in. But that addiontional .79 for the taxable shipping is not carried on to the total.

 

Any ideas on this? I believe this started happening when I installed CCGV. I know it worked before.

 

Thanks in advance,

Shawn

Link to comment
Share on other sites

Hello,

 

My client's sites are experiencing the same issues?

 

It only seems to appear when a credit card is used however?

 

For example, say they order a product for $10 that has $5 shipping. The order summary shows the correct amounts:

 

Subtotal: $10.00

Shipping: $5.00

Taxes (15%): $2.25

Total: $17.25

 

However what is sent to cc company is only $16.50 which is $10x1.15+$5 shipping. The tax is not applied to shipping.

 

Now what is stored in the database for the order is correct....as is confirmation email etc but the client is only charged the $16.50 to their card.

 

In order.php class I put "echo "TAX: ".$this->info['tax'];" in at the end of the function cart() { and what it spits out is the tax without the shipping tax?? Something seems to be missing.

 

Any ideas??

 

Thank you ahead of time.

Keith Gallant

Link to comment
Share on other sites

Hello,

 

My client's sites are experiencing the same issues?

 

It only seems to appear when a credit card is used however?

 

For example, say they order a product for $10 that has $5 shipping. The order summary shows the correct amounts:

 

Subtotal: $10.00

Shipping: $5.00

Taxes (15%): $2.25

Total: $17.25

 

However what is sent to cc company is only $16.50 which is $10x1.15+$5 shipping. The tax is not applied to shipping.

 

Now what is stored in the database for the order is correct....as is confirmation email etc but the client is only charged the $16.50 to their card.

 

In order.php class I put "echo "TAX: ".$this->info['tax'];" in at the end of the function cart() { and what it spits out is the tax without the shipping tax?? Something seems to be missing.

 

Any ideas??

 

Thank you ahead of time.

 

Keith,

 

Do you know of a way to test this on a development site that is not connected to a merchant account? I will be going live in a couple of months and will be connecting to a merchant account for cc payments and I want to test if this now. I turned on shipping tax as a test and it all totals correctly on the final confirmation page and in the database also so I have no way to see what will be really sent to the cc provider. Do you have a suggestion?

 

Joe

Link to comment
Share on other sites

Hello,

 

My client's sites are experiencing the same issues?

 

It only seems to appear when a credit card is used however?

 

For example, say they order a product for $10 that has $5 shipping. The order summary shows the correct amounts:

 

Subtotal: $10.00

Shipping: $5.00

Taxes (15%): $2.25

Total: $17.25

 

However what is sent to cc company is only $16.50 which is $10x1.15+$5 shipping. The tax is not applied to shipping.

 

Now what is stored in the database for the order is correct....as is confirmation email etc but the client is only charged the $16.50 to their card.

 

In order.php class I put "echo "TAX: ".$this->info['tax'];" in at the end of the function cart() { and what it spits out is the tax without the shipping tax?? Something seems to be missing.

 

Any ideas??

 

Thank you ahead of time.

 

 

Keith,

 

I just remembered something. In /includes/modules/order_total/ot_coupon.php, in the CCVG code there is a statement as follows:

 

/* you will need to uncomment this if your tax order total module is AFTER shipping eg you have all of your tax, including tax from shipping module, in your tax total.

 

It seems that this could be your scenario here and that you would need to uncomment code to allow for shipping tax to pass through.

 

Joe

Edited by primadude
Link to comment
Share on other sites

hi there, well i think i finally got the ccgv working but in the admin section in

modules>order total

the information for the voucher is french.

I ran the sql that turns the french to english but this part did not change.

Any thoughts?

 

Did you get an answer to this? I have same ish. =(

 

 

Sam

Link to comment
Share on other sites

I'm such a total newbie to all this that I cannot even seem to get started. :( If I am planning to install this contrib, as well as the Paypal IPN contrib, do I need to install that one first, or does it not matter?

 

Also, the following "easy installation" instructions are pretty much non-instructive. :)

 

"The easiest way to do the ccgv install is to install a new copy of the osc 2.2 ms2 and copy these files on top of it. After you have copied the files install the sql. That is it. Well you need to follow the how do you get it running elsewhere in the document."

 

Copy them where? Are all of these files in the same directory? Are they all replacements of existing files? What counts as a "new" copy - if I have added products, etc. but have not added any contribs, is that "new"? What does it mean to "install the sql"? What sql? How?

 

Some more thorough instructions would be hugely appreciated. :) I am determined to do this myself, but I need some help getting past the tech-speak.

Link to comment
Share on other sites

I'm answering my own question - I think.

 

The files in the catalog section are written to my main Oscommerce directory (for me, public_html/shop/), the others in the appropriate folders as suggested by the hierarchy in the RAR file, overwriting where necessary. Then, "installing the sql" is installing the modules in the Admin area. Yes? Did I do this right? I have not yet installed the Paypal IPN module, so I skipped that file (otherwise, I got errors in admin), and will copy it back in after I install that. Also, I skipped the foreign language PHP files and directories, as my shop is available only in English. Will that break anything?

 

Another oddity: When I installed the GV module, all of the editable options are in French.

Link to comment
Share on other sites

Also, I'm getting the following error whenever I attempt to administrate any of the coupon/voucher options. What did I overlook?

 

 

1146 - Table 'homework_osc1.coupons' doesn't exist

 

select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_p

roducts, restrict_to_categories, date_created,date_modified from coupons where coupon_type != 'G'

 

[TEP STOP]

Link to comment
Share on other sites

During my continuing my testing of CCVG v5.15 and I have found yet another bug. This bug speficially affects CCVG with the "Credit Class and Gift Voucher 'Easier to Understand' Payment Addon" v1.2 contribution installed. I believe this affects all versions of CCVG. In fact, it likely affects CCCVG without this add-on contribution.

 

As we know CCVG provides the opportunity to provide Gift Vouchers and Discount Coupons. I have found a bug when both a Gift Voucher and a Coupon are applied at the same time to an order. This likely affects anyone using CCVG in this scenario. Here are the specifics:

 

The problem:

 

When a Gift Voucher total is more than the Grand Total (sub-total + tax + shipping) but is less than the Grand Total - Coupon amount and the Gift Voucher Tick Box is checked to cover the entire Grand Total the following payment error is produced:

 

Please select a payment method for your order.

If a credit card had already been selected before the Tick box was checked to cover the total amount, this error is produced:

 

Credit Card Error!

The first four digits of the number entered are: . If that number is correct, we do not accept that type of credit card. If it is wrong, please try again.

 

The customer is unable to pay for the item and the order cannot be placed.

 

Example:

 

Sub-Total: $59.98

Shipping: $5.50

Tax: $2.34

Discount Coupons (1234): -$6.00

Total: $61.82

Gift Voucher Amount: $65.00

 

I found the problem to be located where the $credit_covers variable is set in /catalog/includes/classes/order_total.php in "Function Pre_Confirmation_Check". I resolved the problem as follows. Note: this fix addresses CCVG with the Easier 2 Understand Pament Add-on v1.2 Contribution installed:

 

Find this code:

 

global $payment, $order, $credit_covers, $customer_id;

 

Replace it with this code:

 

global $payment, $order, $credit_covers, $customer_id, $gv_payment_amount, $ot_coupon, $currency, $currencies;

 

Find this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

if ($order->info['total'] - $total_deductions <= 0 ) {

 

Replace it with this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

if ( (tep_round($order->info['total'], $currencies->currencies[$currency]['decimal_places']) - tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places'])) - tep_round($gv_payment_amount, $currencies->currencies[$currency]['decimal_places']) <= 0 ) {

 

What was happening here is that the $credit_covers variable is set to true when the Gift Voucher is greater than the grand total. However, when there was a coupon applied, the grand total was less but this was not taken into account. So the change I made here was to make this calculation to set the $credit_covers variable:

 

This is what it was doing:

Order Total - Gift Voucher

 

This is what is is doing now:

(Order Total - Coupon) - Gift Voucher

 

Joe

Link to comment
Share on other sites

I'm answering my own question - I think.

 

The files in the catalog section are written to my main Oscommerce directory (for me, public_html/shop/), the others in the appropriate folders as suggested by the hierarchy in the RAR file, overwriting where necessary. Then, "installing the sql" is installing the modules in the Admin area. Yes? Did I do this right? I have not yet installed the Paypal IPN module, so I skipped that file (otherwise, I got errors in admin), and will copy it back in after I install that. Also, I skipped the foreign language PHP files and directories, as my shop is available only in English. Will that break anything?

 

Another oddity: When I installed the GV module, all of the editable options are in French.

 

 

I believe what you may have missed here is to execute the SQL commands to add the CCVG tables to your database. You will need to launch your PHPMyAdmin, select your OSC database, Select the SQL tab, paste the SQL commands into the query window and click go

 

Joe

Link to comment
Share on other sites

I found the problem to be located where the $credit_covers variable is set in /catalog/includes/classes/order_total.php in "Function Pre_Confirmation_Check". I resolved the problem as follows. Note: this fix addresses CCVG with the Easier 2 Understand Pament Add-on v1.2 Contribution installed:

 

Find this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

if ($order->info['total'] - $total_deductions <= 0 ) {

 

Hi Joe

 

Your file says

if ($order->info['total'] - $total_deductions <= 0 )

My file says

// if ($order->info['total'] - $total_deductions <= 0 ) {

if ($order->info['total'] - $gv_payment_amount <= 0 ) {

 

I don't understand why they are different.

Link to comment
Share on other sites

I have a working CCVG v5.15 (with a few fixes) and recently have been testing use of the Coupon Admin settings:

 

Valid Product List

Valid Categories List

 

I first found that when the View button was checked I received a file not found error. Research showed that the CCVG v5.15 contribution is correctly configured to use the "CCVG Treeview". However, the Treeview add-on files needed to make this contribution work were missing. Once the CCVG Treeview contribution add-on files were added, it functioned properly with a graphical tree view ans select capability of all categories and products.

 

Testing of a 10% coupon redemption functioned normally until I tried to restrict the coupon to specific products or categories using the Valid Product List or Valid Categories List. When I redeemed coupons that were in the Valid Product List or Valid Category List, the redeem produced an error indicating the coupon was good:

 

***HOWEVER:No reducion available, please see the coupon restrictions***

 

So I have resolved the problem as follows:

 

In /catalog/includes/modules/order_total/ot_coupon.php, find this line in two places in "Function calculate_credit($amount)"

 

$pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

 

Comment the lines out and replace it with this:

 

$pr_c = ($order->products[$i]['final_price'] * $order->products[$i]['qty']);

 

If you experience Coupons not being Redeemed when using the Valid Product List or Valid Category List settings, this does resolve it. I will be doing more testing over the next several days and will post more as I find it. Hope this helps and if someone has a better answer of if I have made an error, please do bring it up. I can take it. :-"

 

Joe

Hi Joe

 

My file has this

//$od_amount = round($amount*10)/10*$c_deduct/100;

//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pr_c = $this->product_price(tep_get_prid($order->products[$i]['id'])); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

 

BTW the line

***HOWEVER:No reducion available, please see the coupon restrictions***

should say

***HOWEVER:No reduction available, please see the coupon restrictions***

Link to comment
Share on other sites

Hi. I'm very sorry to interrupt the discussions, but I wanted to ask really quickly what the 'best' version of this contribution is to install. I noticed that the CRE Loaded version uses Credit Class/Gift Voucher/Discount Coupons 5.10b, but I see here (http://www.oscommerce.com/community/contributions,282) that there are many updates since then. I'm just trying to figure out what the best version is to try and install.

 

Thanks!

 

-- Josh

Link to comment
Share on other sites

I found the problem to be located where the $credit_covers variable is set in /catalog/includes/classes/order_total.php in "Function Pre_Confirmation_Check". I resolved the problem as follows. Note: this fix addresses CCVG with the Easier 2 Understand Pament Add-on v1.2 Contribution installed:

 

Find this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

if ($order->info['total'] - $total_deductions <= 0 ) {

 

Hi Joe

 

Your file says

if ($order->info['total'] - $total_deductions <= 0 )

My file says

// if ($order->info['total'] - $total_deductions <= 0 ) {

if ($order->info['total'] - $gv_payment_amount <= 0 ) {

 

I don't understand why they are different.

 

 

It is because I somehow made an error. Sorry about that. You are correct. Here is the fix corrected:

 

Find this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

// if ($order->info['total'] - $total_deductions <= 0 ) {

if ($order->info['total'] - $gv_payment_amount <= 0 ) {

 

Replace it with this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

// if ($order->info['total'] - $total_deductions <= 0 ) {

if ( (tep_round($order->info['total'], $currencies->currencies[$currency]['decimal_places']) - tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places'])) - tep_round($gv_payment_amount, $currencies->currencies[$currency]['decimal_places']) <= 0 ) {

Link to comment
Share on other sites

Hi Joe

 

My file has this

//$od_amount = round($amount*10)/10*$c_deduct/100;

//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pr_c = $this->product_price(tep_get_prid($order->products[$i]['id'])); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

 

BTW the line

***HOWEVER:No reducion available, please see the coupon restrictions***

should say

***HOWEVER:No reduction available, please see the coupon restrictions***

 

 

Leslie,

 

Hmmm...I went and checked the code that was in the original CCVG v5.15 Contribution and this is a snippet of code directly from ot_coupon.php showing it matches my code:

 

if ($get_result['coupon_type'] == 'P') {

/* Fixes to Gift Voucher module 5.03

=================================

Submitted by Rob Cote, [email protected]

original code: $od_amount = round($amount*10)/10*$c_deduct/100;

$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

*/

//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

$od_amount = $od_amount + $pod_amount;

} else {

$od_amount = $c_deduct;

}

}

 

Can you tell me what version of CCVG you started with and check that original version ot_coupon.php? I am interested in seeing if the code changed before or after CCVG v5.15.

 

Joe

 

PS. That spelling error is in CCVG v5.15 too...Thanks.

Link to comment
Share on other sites

Hi. I'm very sorry to interrupt the discussions, but I wanted to ask really quickly what the 'best' version of this contribution is to install. I noticed that the CRE Loaded version uses Credit Class/Gift Voucher/Discount Coupons 5.10b, but I see here (http://www.oscommerce.com/community/contributions,282) that there are many updates since then. I'm just trying to figure out what the best version is to try and install.

 

Thanks!

 

-- Josh

 

Hi Josh,

 

That is a loaded question :-" . I am sure everyone here will have a different opinion. When I decided to load this contribution about a month ago, v5.15 was the latest version but I had been reading that it also had problems. I read that v5.13 was considered stable at the time so, I started with v5.13 and found a ton of bugs. Then I upgraded to v5.15 and it fixed a lot of issues but I have still been fixing bugs with v5.15 for the last three weeks.

 

This is the most difficult contribution I have implemented yet but I am finally seeing light at the end of the tunnel. I do not believe there is a fully working version that anyone could install even onto a stock OSC site yet. You will have to make an educated guess and plan on fixing bugs afterwards. The problem is that there are so many variables to test that it takes a lot of time to set up and test each potential situation that a customer would experience.

 

I hope I didn't ruin it for you...It can be done, it is worth it, and I think there are a lot of sites with CCVG working. Just plan on spending some time on it...

 

Joe

Link to comment
Share on other sites

Leslie,

 

Hmmm...I went and checked the code that was in the original CCVG v5.15 Contribution and this is a snippet of code directly from ot_coupon.php showing it matches my code:

 

if ($get_result['coupon_type'] == 'P') {

/* Fixes to Gift Voucher module 5.03

=================================

Submitted by Rob Cote, [email protected]

original code: $od_amount = round($amount*10)/10*$c_deduct/100;

$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

*/

//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];

$pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

$pod_amount = round($pr_c*10)/10*$c_deduct/100;

$od_amount = $od_amount + $pod_amount;

} else {

 

$od_amount = $c_deduct;

}

}

 

Can you tell me what version of CCVG you started with and check that original version ot_coupon.php? I am interested in seeing if the code changed before or after CCVG v5.15.

 

Joe

 

PS. That spelling error is in CCVG v5.15 too...Thanks.

Hi Joe

Thanks for your reply and time.

 

I started with Notes for new install of CCGV, (including updates and forum suggestions) and that did not work.

Then I did Credit Class and Gift Voucher 5.14, (including updates and forum suggestions) and that did not work.

Then CCGV 5.15 (FULL PACKAGE), (including updates and forum suggestions) and that did not work.

Then CCGV 5.15a (Full Package), (including updates) and that did not work.

Then CCGV 5.15a1 Part 1 and Part 2 and that seemed to work.

Finally, I updated with CCGV 5.15a2 Part 1 and 2 (because I wanted the Jonyo stuff), and that seems to work.

There are still problems, but it is almost functional.

So to answer your query, I am pretty sure that it was included in CCGV 5.15a2 Part 1 and 2. Below is the header from the file.

 

<?php

/*

$Id: ot_coupon.php,v 1.1.2.37.3 2004/01/01 22:52:59 Strider Exp $

$Id: ot_coupon.php,v 1.1.2.37 2003/07/24 22:52:59 Strider-Cote Exp $

$Id: ot_coupon.php,v 1.1.2.36 2003/05/14 22:52:59 wilt Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com/

 

Copyright ? 2002 osCommerce

 

Released under the GNU General Public License

*

* v5.13a by Rigadin ([email protected])

---

-- MODS

--

-- 09-11-05 Si Corrections to the redeem message

---

*/

Link to comment
Share on other sites

It is because I somehow made an error. Sorry about that. You are correct. Here is the fix corrected:

 

Find this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

// if ($order->info['total'] - $total_deductions <= 0 ) {

if ($order->info['total'] - $gv_payment_amount <= 0 ) {

 

Replace it with this code:

 

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

$gv_result=tep_db_fetch_array($gv_query);

$gv_payment_amount = $gv_result['amount'];

// if ($order->info['total'] - $total_deductions <= 0 ) {

if ( (tep_round($order->info['total'], $currencies->currencies[$currency]['decimal_places']) - tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places'])) - tep_round($gv_payment_amount, $currencies->currencies[$currency]['decimal_places']) <= 0 ) {

Thanks Joe. I tried the new code but still got the error. I think that the problem is with treeview.

Link to comment
Share on other sites

Sorry Joe

 

What I did not do was replace the two lines in the \catalog\includes\modules\order_total\ot_coupon.php file

as you suggested a few posts ago. When I did both, it worked.

BTW

I just ignored the differences between your and my file and replaced the FRED lines (or where the FRED lines would have been) with your code.

 

More testing now to see what else needs work.

 

Thanks again.

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