Jump to content
Strider

Credit Class/Gift Vouchers/Discount Coupons 5.10

Recommended Posts

Not sure if this is how this module is set up, but I added a product with a price of $1. I added a coupon for free shipping for that product. When I enter the coupon code, it doesn't give me free shipping, it gives me a discount for $1 which is the sub-total amount. If I change the price to $2 then it gives me discount for $2. This only happens when the price is less than $3. If I change the price to $3 then it works ok and it gives me the discount for the shipping amount.

 

Any suggestions?

 

Thanks

 

Ricardo

Share this post


Link to post
Share on other sites

I have PayPal Express Checkout Version: 1.2, API Version: 60.0.

 

When I go to paypal the discount is not showing.

 

Has anyone got this addon working with the above version of paypal express.

Share this post


Link to post
Share on other sites

Is anybody really supporting this mod?

 

First, the sql file did not install all the files and had to create them.

 

Installed CCGV latest version and upon checkout, I receive an error;

Fatal error: Cannot redeclare class paypal_standard in /home/content...../html/catalog/includes/modules/payment/paypal_standard.php on line 13

 

I have checked catalog/includes/modules/payment/paypal_standard.php and has not been changed. Is identical to original install.

I have also changed payment methods but get the same error message, just a different file name.

 

I believe there is some code error somewhere within this mod but cannot find it.

 

 

Also, on the checkout_payment.php page display, the columns are now extended and it drops column right down to the bottom and

not at the top as it is designed.

 

Anyone please.... I have no hair left....lol

 

I'm not supporting this mod but I do have some sites with it working. A "cannot redeclare" error is when you call the same class twice. It's likely that you have a line something like

 

require(DIR_WS_CLASSES . 'payment.php');

 

twice in your php code on one of the final checkout pages. I can't remember without looking if it's payment.php that'll be the filename but if you call a file twice you're redeclaring the classes within it. Anyway, hope that gives you a big enough clue to let you get some hair back before the cold winter winds start... :rolleyes:

Share this post


Link to post
Share on other sites

I installed the CCGV newst version (5.21)

All is working just fine, can redeem, can add, buy and pay BUT

When someone want to send the gift and click the Send Gift Voucher link in the basket I get an almost blank page with 4 fields (Recipients Name, E-mail, Amount nad message) and below that:

Error!

 

Unable to determine the page link!

 

What can be wrong??

It's on a test part of a website so you can see and login if you want to help:

 

http://www.alfablue.com/osc/index.php

login for members:

adwin@vankastel.com

9s5r8

After login click the link in the right colom in the basket:

http://www.alfablue.com/osc/gv_send.php

And you get the error

 

Please advice

hello,

i have same problem. did you find a solution to it?

let me know please

thanks

valerif

Share this post


Link to post
Share on other sites

Thats because of the 'back' link in your gv send page (and alike)

 

If you arrive at the page straight from the URL without clicking a link in any other page to get there, then it doesn't know where you came from and therefore cannot add a 'back' link - that's all... nothing to worry about

 

Hellow,

 

I am getting the same message on the gv_send.php. I get it any time when enter the page via a link or direct. WOuld you have any suggestion on how to resolve this?

 

thanks

valerif

 

The message is:

 

Error!

Unable to determine the page link!

Share this post


Link to post
Share on other sites

This is probably a very easy problem, but I'm stuck. I'm receiving the following message:

 

Parse error: syntax error, unexpected T_STRING in /home/fabrih5/public_html/shop/includes/classes/payment.php on line 89

 

// Start - CREDIT CLASS Gift Voucher Contribution

// function javascript_validation() {

function javascript_validation($coversAll) {

//added the $coversAll to be able to pass whether or not the voucher will cover the whole

//price or not. If it does, then let checkout proceed when just it is passed.

$js = '';

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

if ($coversAll) {

$addThis='if (document.checkout_payment.cot_gv.checked) {

payment_value='cot_gv'; ( LINE 89 )

} else ';

} else {

$addThis='';

}

 

// End - CREDIT CLASS Gift Voucher Contribution

 

Any Help would be appreciated.

 

Julie

Share this post


Link to post
Share on other sites

This is probably a very easy problem, but I'm stuck. I'm receiving the following message:

 

Parse error: syntax error, unexpected T_STRING in /home/fabrih5/public_html/shop/includes/classes/payment.php on line 89

 

// Start - CREDIT CLASS Gift Voucher Contribution

// function javascript_validation() {

function javascript_validation($coversAll) {

//added the $coversAll to be able to pass whether or not the voucher will cover the whole

//price or not. If it does, then let checkout proceed when just it is passed.

$js = '';

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

if ($coversAll) {

$addThis='if (document.checkout_payment.cot_gv.checked) {

payment_value='cot_gv'; ( LINE 89 )

} else ';

} else {

$addThis='';

}

 

// End - CREDIT CLASS Gift Voucher Contribution

 

Any Help would be appreciated.

 

Julie

 

Found this fix and seems to work:

 

// Start - CREDIT CLASS Gift Voucher Contribution

// function javascript_validation() {

function javascript_validation($coversAll) {

//added the $coversAll to be able to pass whether or not the voucher will cover the whole

//price or not. If it does, then let checkout proceed when just it is passed.

$js = '';

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

if ($coversAll) {

$addThis='if (document.checkout_payment.cot_gv.checked) {

payment_value='cot_gv';

} else ';

} else {

$addThis='';

}

// End - CREDIT CLASS Gift Voucher Contribution

 

REPLACE WITH THIS

 

// Start - CREDIT CLASS Gift Voucher Contribution

// function javascript_validation() {

function javascript_validation($coversAll) {

//added the $coversAll to be able to pass whether or not the voucher will cover the whole

//price or not. If it does, then let checkout proceed when just it is passed.

$js = '';

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

if ($coversAll) {

$addThis='if (document.checkout_payment.cot_gv.checked) {

payment_value=\'cot_gv\';

} else ';

} else {

$addThis='';

}

// End - CREDIT CLASS Gift Voucher Contribution

Share this post


Link to post
Share on other sites

Hi guys,

 

I am having an issue with CCGV 5.21 and Paypal Standard.

Everything seems work fine till you get redirect to the Paypal website.

Once there you complete your transaction and then you click Return to Merchant Store.

Then the problem arise: I receive a blank page (in IE an HTTP 500 error).

 

If I check in admin I can see that the order and the payment come through correctly and as well if I typer in the web-browser mysite/checkoutconfirmation the process seems to complete.

I suspect that the problem is somewhere in checkoutprocess.php but I am not sure how to troubleshoot this.

 

Not sure if it is related but it if I check the shopping cart I still have all the products there and as well in the admin it looks like that none use any voucher at all.

 

Any idea?

What can I do to troubleshoot this?

Can someone have a quick scan of my code?I might do something really silly.

 

Thanks in advance for all your help.

Cheers

JK

Share this post


Link to post
Share on other sites

After hours of troubleshooting it seems I have narrowed down the problem.

The code get stuck when calling the following function from paypal_standard.php to order_total.php:

 

$order_total_modules->update_credit_account($i);

 

I cannot see the reason why this function is not called correctly.

 

Any ideas?

Cheers

JK

 

 

Hi guys,

 

I am having an issue with CCGV 5.21 and Paypal Standard.

Everything seems work fine till you get redirect to the Paypal website.

Once there you complete your transaction and then you click Return to Merchant Store.

Then the problem arise: I receive a blank page (in IE an HTTP 500 error).

 

If I check in admin I can see that the order and the payment come through correctly and as well if I typer in the web-browser mysite/checkoutconfirmation the process seems to complete.

I suspect that the problem is somewhere in checkoutprocess.php but I am not sure how to troubleshoot this.

 

Not sure if it is related but it if I check the shopping cart I still have all the products there and as well in the admin it looks like that none use any voucher at all.

 

Any idea?

What can I do to troubleshoot this?

Can someone have a quick scan of my code?I might do something really silly.

 

Thanks in advance for all your help.

Cheers

JK

Share this post


Link to post
Share on other sites

And I think I have found the solution as well....it seems there was a global variable missing....

 

Within the function before_process()

 

function before_process() {

global $customer_id, $order, $order_total_modules, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID;

global $$payment;

 

$order_total_modules was missing...I can't believe none noticed that.

Now the process complete succesfully and everything works perfectly.

 

I have only a small little problem when the voucher is inserted and it failed any of the check, instead of getting the error message I get an empty pink line....

 

I think I have narrowed down the problem but I still did not manage to solve it:

 

Checkout_payment.php call the following functions:

 

<?php

// Start - CREDIT CLASS Gift Voucher Contribution

echo $order_total_modules->credit_selection();

// End - CREDIT CLASS Gift Voucher Contribution ?>

<?php

 

order_total.php will call the same function in ot_coupon:

 

while (list(, $value) = each($this->modules)) {

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {

if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();

if ( ($use_credit_string !='' ) || ($selection_string != '') ) {

$output_string .= '<tr colspan="4"><td colspan="4" width="100%">' . tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';

$output_string = ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .

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

' <td class="main"><b>' . $GLOBALS[$class]->header . '</b></td>' . $use_credit_string;

$output_string .= '<td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';

$output_string .= ' </tr>' . "\n";

$output_string .= $selection_string;

 

ot_coupon does all the checks to verify that the coupoon is correct and set the error if any of the check it fails:

 

 

function collect_posts() {

// All tep_redirect URL parameters modified for this function in v5.13 by Rigadin

global $HTTP_POST_VARS, $customer_id, $currencies, $cc_id;

if ($HTTP_POST_VARS['gv_redeem_code']) {

 

// get some info from the coupon table

$coupon_query=tep_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_COUPONS . " where coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."' and coupon_active='Y'");

$coupon_result=tep_db_fetch_array($coupon_query);

 

if ($coupon_result['coupon_type'] != 'G') {

 

if (tep_db_num_rows($coupon_query)==0) {

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

}

 

$date_query=tep_db_query("select coupon_start_date from " . TABLE_COUPONS . " where coupon_start_date <= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'");

 

if (tep_db_num_rows($date_query)==0) {

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

}

 

$date_query=tep_db_query("select coupon_expire_date from " . TABLE_COUPONS . " where coupon_expire_date >= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'");

 

if (tep_db_num_rows($date_query)==0) {

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

}

 

$coupon_count = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."'");

$coupon_count_customer = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."' and customer_id = '" . $customer_id . "'");

 

if (tep_db_num_rows($coupon_count)>=$coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_COUPON . $coupon_result['uses_per_coupon'] . TIMES ), 'SSL'));

}

 

if (tep_db_num_rows($coupon_count_customer)>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_user'] . TIMES ), 'SSL'));

}

 

//**si** 09-11-05

/*

if ($coupon_result['coupon_type']=='S') {

$coupon_amount = $order->info['shipping_cost'];

} else {

$coupon_amount = $currencies->format($coupon_result['coupon_amount']) . ' ';

}

if ($coupon_result['coupon_type']=='P') $coupon_amount = $coupon_result['coupon_amount'] . '% ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount .= 'on orders greater than ' . $coupon_result['coupon_minimum_order'];

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id'); //Fred - this was commented out before

$cc_id = $coupon_result['coupon_id']; //Fred ADDED, set the global and session variable

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

*/

global $order,$ot_coupon,$currency;

// BEGIN >>> CCVG 5.15 - Custom Modification - fix Coupon code redemption error

// Moved code up a few lines

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id');

$cc_id = $coupon_result['coupon_id'];

// END <<< CCVG 5.15 - Custom Modification - fix Coupon code redemption error

 

$coupon_amount= tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places']); // $cc_id

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

if ($coupon_result['coupon_type']=='S') {

//if not zero rated add vat to shipping

$coupon_amount = tep_add_tax($coupon_amount, '17.5');

}

*/

$coupon_amount_out = $currencies->format($coupon_amount) . ' ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount_out .= 'on orders greater than ' . $currencies->format($coupon_result['coupon_minimum_order']);

 

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id');

$cc_id = $coupon_result['coupon_id'];

 

if ( strlen($cc_id)>0 && $coupon_amount==0 ) {

// ccgv coupon restrictions error fix

// $err_msg = ERROR_REDEEMED_AMOUNT.ERROR_REDEEMED_AMOUNT_ZERO;

$err_msg = ERROR_REDEEMED_AMOUNT_ZERO;

} else {

$err_msg = ERROR_REDEEMED_AMOUNT.$coupon_amount_out;

}

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

//**si** 09-11-05 end

 

// $_SESSION['cc_id'] = $coupon_result['coupon_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

} // ENDIF valid coupon code

} // ENDIF code entered

// v5.13a If no code entered and coupon redeem button pressed, give an alarm

if ($HTTP_POST_VARS['submit_redeem_coupon_x']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL'));

}

 

I suspect that in the code above the problem arises. I think the payment_error->&error variable is not populated correctly

As you can see all the if redirect back to checkout_payment.php that will print the error on the screen:

 

<?php

if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {

?>

<tr>

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

<tr>

<td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td>

</tr>

</table></td>

</tr>

<tr>

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

<tr class="infoBoxNoticeContents">

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

<tr>

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

<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>

 

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

}

?>

 

You can see from there that to retrieve the error it calls the function get_error() once more from ot_coupon.php:

 

function get_error() {

global $HTTP_GET_VARS;

 

$error = array('title' => MODULE_ORDER_TOTAL_COUPON_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['$error'])));

 

return $error;

}

 

Here $error is populated with a title and and error.

 

$error['title'] is printed correctly on the screen $error ['error'] is not.

 

If instead of using stripslashes(urldecode($HTTP_GET_VARS['$error']))); I manually add some text then even the $error['error'] is printed on the screen. So my suspect is that the error either occurred when:

 

1) error is encoded : 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT), 'SSL'));

 

or

 

2) error is decoded: 'error' => stripslashes(urldecode($HTTP_GET_VARS['$error'])));

 

I so in the forum someone had the same problem. Did anyone manage to resolve it?

Can someone help?

 

Any feedback is really appreciated.

Cheers

JK

Share this post


Link to post
Share on other sites

Found the solution for this problem as well....

The issue is in ot_coupon.php:

 

All the lines:

 

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

 

after each check.

 

It seems this

 

'error' => stripslashes(urldecode($HTTP_GET_VARS['$error'])));

 

cannot remove the "&" symbol and for this reason will not find any variable called error in the URL.

 

Those cause the checkout_payment.php to print an empty line

 

SOLUTION

 

I have replace all those line

 

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

 

with

 

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

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

 

Here the code changed:

 

function collect_posts() {

// All tep_redirect URL parameters modified for this function in v5.13 by Rigadin

global $HTTP_POST_VARS, $customer_id, $currencies, $cc_id;

if ($HTTP_POST_VARS['gv_redeem_code']) {

 

// get some info from the coupon table

$coupon_query=tep_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_COUPONS . " where coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."' and coupon_active='Y'");

$coupon_result=tep_db_fetch_array($coupon_query);

 

if ($coupon_result['coupon_type'] != 'G') {

 

if (tep_db_num_rows($coupon_query)==0) {

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

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

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

}

 

$date_query=tep_db_query("select coupon_start_date from " . TABLE_COUPONS . " where coupon_start_date <= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'");

 

if (tep_db_num_rows($date_query)==0) {

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

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

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

}

 

$date_query=tep_db_query("select coupon_expire_date from " . TABLE_COUPONS . " where coupon_expire_date >= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'");

 

if (tep_db_num_rows($date_query)==0) {

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

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

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

}

 

$coupon_count = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."'");

$coupon_count_customer = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."' and customer_id = '" . $customer_id . "'");

 

if (tep_db_num_rows($coupon_count)>=$coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) {

//tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_COUPON . $coupon_result['uses_per_coupon'] . TIMES ), 'SSL'));

$redirect_link = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_COUPON . $coupon_result['uses_per_coupon'] . TIMES ), 'SSL');

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

}

 

if (tep_db_num_rows($coupon_count_customer)>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {

//tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_user'] . TIMES ), 'SSL'));

$redirect_link = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_coupon'] . TIMES ), 'SSL');

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

}

 

//**si** 09-11-05

/*

if ($coupon_result['coupon_type']=='S') {

$coupon_amount = $order->info['shipping_cost'];

} else {

$coupon_amount = $currencies->format($coupon_result['coupon_amount']) . ' ';

}

if ($coupon_result['coupon_type']=='P') $coupon_amount = $coupon_result['coupon_amount'] . '% ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount .= 'on orders greater than ' . $coupon_result['coupon_minimum_order'];

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id'); //Fred - this was commented out before

$cc_id = $coupon_result['coupon_id']; //Fred ADDED, set the global and session variable

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

*/

global $order,$ot_coupon,$currency;

// BEGIN >>> CCVG 5.15 - Custom Modification - fix Coupon code redemption error

// Moved code up a few lines

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id');

$cc_id = $coupon_result['coupon_id'];

// END <<< CCVG 5.15 - Custom Modification - fix Coupon code redemption error

 

$coupon_amount= tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places']); // $cc_id

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

if ($coupon_result['coupon_type']=='S') {

//if not zero rated add vat to shipping

$coupon_amount = tep_add_tax($coupon_amount, '17.5');

}

*/

$coupon_amount_out = $currencies->format($coupon_amount) . ' ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount_out .= 'on orders greater than ' . $currencies->format($coupon_result['coupon_minimum_order']);

 

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id');

$cc_id = $coupon_result['coupon_id'];

 

if ( strlen($cc_id)>0 && $coupon_amount==0 ) {

// ccgv coupon restrictions error fix

// $err_msg = ERROR_REDEEMED_AMOUNT.ERROR_REDEEMED_AMOUNT_ZERO;

$err_msg = ERROR_REDEEMED_AMOUNT_ZERO;

} else {

$err_msg = ERROR_REDEEMED_AMOUNT.$coupon_amount_out;

}

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

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

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

//**si** 09-11-05 end

 

// $_SESSION['cc_id'] = $coupon_result['coupon_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

} // ENDIF valid coupon code

} // ENDIF code entered

// v5.13a If no code entered and coupon redeem button pressed, give an alarm

if ($HTTP_POST_VARS['submit_redeem_coupon_x']) {

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

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

$redirect_link = str_replace('&', '&', $redirect_link);

tep_redirect($redirect_link);

}

}

 

 

I saw someone else had this problem so I thought it was worthwhile to share the solution.

Thanks everyone.

Cheers

JK

 

 

And I think I have found the solution as well....it seems there was a global variable missing....

 

Within the function before_process()

 

function before_process() {

global $customer_id, $order, $order_total_modules, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID;

global $$payment;

 

$order_total_modules was missing...I can't believe none noticed that.

Now the process complete succesfully and everything works perfectly.

 

I have only a small little problem when the voucher is inserted and it failed any of the check, instead of getting the error message I get an empty pink line....

 

I think I have narrowed down the problem but I still did not manage to solve it:

 

Checkout_payment.php call the following functions:

 

<?php

// Start - CREDIT CLASS Gift Voucher Contribution

echo $order_total_modules->credit_selection();

// End - CREDIT CLASS Gift Voucher Contribution ?>

<?php

 

order_total.php will call the same function in ot_coupon:

 

while (list(, $value) = each($this->modules)) {

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {

if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();

if ( ($use_credit_string !='' ) || ($selection_string != '') ) {

$output_string .= '<tr colspan="4"><td colspan="4" width="100%">' . tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';

$output_string = ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .

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

' <td class="main"><b>' . $GLOBALS[$class]->header . '</b></td>' . $use_credit_string;

$output_string .= '<td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';

$output_string .= ' </tr>' . "\n";

$output_string .= $selection_string;

 

ot_coupon does all the checks to verify that the coupoon is correct and set the error if any of the check it fails:

 

 

function collect_posts() {

// All tep_redirect URL parameters modified for this function in v5.13 by Rigadin

global $HTTP_POST_VARS, $customer_id, $currencies, $cc_id;

if ($HTTP_POST_VARS['gv_redeem_code']) {

 

// get some info from the coupon table

$coupon_query=tep_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_COUPONS . " where coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."' and coupon_active='Y'");

$coupon_result=tep_db_fetch_array($coupon_query);

 

if ($coupon_result['coupon_type'] != 'G') {

 

if (tep_db_num_rows($coupon_query)==0) {

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

}

 

$date_query=tep_db_query("select coupon_start_date from " . TABLE_COUPONS . " where coupon_start_date <= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'");

 

if (tep_db_num_rows($date_query)==0) {

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

}

 

$date_query=tep_db_query("select coupon_expire_date from " . TABLE_COUPONS . " where coupon_expire_date >= now() and coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."'");

 

if (tep_db_num_rows($date_query)==0) {

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

}

 

$coupon_count = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."'");

$coupon_count_customer = tep_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon_result['coupon_id']."' and customer_id = '" . $customer_id . "'");

 

if (tep_db_num_rows($coupon_count)>=$coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_COUPON . $coupon_result['uses_per_coupon'] . TIMES ), 'SSL'));

}

 

if (tep_db_num_rows($coupon_count_customer)>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_user'] . TIMES ), 'SSL'));

}

 

//**si** 09-11-05

/*

if ($coupon_result['coupon_type']=='S') {

$coupon_amount = $order->info['shipping_cost'];

} else {

$coupon_amount = $currencies->format($coupon_result['coupon_amount']) . ' ';

}

if ($coupon_result['coupon_type']=='P') $coupon_amount = $coupon_result['coupon_amount'] . '% ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount .= 'on orders greater than ' . $coupon_result['coupon_minimum_order'];

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id'); //Fred - this was commented out before

$cc_id = $coupon_result['coupon_id']; //Fred ADDED, set the global and session variable

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

*/

global $order,$ot_coupon,$currency;

// BEGIN >>> CCVG 5.15 - Custom Modification - fix Coupon code redemption error

// Moved code up a few lines

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id');

$cc_id = $coupon_result['coupon_id'];

// END <<< CCVG 5.15 - Custom Modification - fix Coupon code redemption error

 

$coupon_amount= tep_round($ot_coupon->pre_confirmation_check($order->info['subtotal']), $currencies->currencies[$currency]['decimal_places']); // $cc_id

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

if ($coupon_result['coupon_type']=='S') {

//if not zero rated add vat to shipping

$coupon_amount = tep_add_tax($coupon_amount, '17.5');

}

*/

$coupon_amount_out = $currencies->format($coupon_amount) . ' ';

if ($coupon_result['coupon_minimum_order']>0) $coupon_amount_out .= 'on orders greater than ' . $currencies->format($coupon_result['coupon_minimum_order']);

 

if (!tep_session_is_registered('cc_id')) tep_session_register('cc_id');

$cc_id = $coupon_result['coupon_id'];

 

if ( strlen($cc_id)>0 && $coupon_amount==0 ) {

// ccgv coupon restrictions error fix

// $err_msg = ERROR_REDEEMED_AMOUNT.ERROR_REDEEMED_AMOUNT_ZERO;

$err_msg = ERROR_REDEEMED_AMOUNT_ZERO;

} else {

$err_msg = ERROR_REDEEMED_AMOUNT.$coupon_amount_out;

}

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

//**si** 09-11-05 end

 

// $_SESSION['cc_id'] = $coupon_result['coupon_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.

} // ENDIF valid coupon code

} // ENDIF code entered

// v5.13a If no code entered and coupon redeem button pressed, give an alarm

if ($HTTP_POST_VARS['submit_redeem_coupon_x']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL'));

}

 

I suspect that in the code above the problem arises. I think the payment_error->&error variable is not populated correctly

As you can see all the if redirect back to checkout_payment.php that will print the error on the screen:

 

<?php

if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {

?>

<tr>

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

<tr>

<td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td>

</tr>

</table></td>

</tr>

<tr>

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

<tr class="infoBoxNoticeContents">

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

<tr>

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

<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>

 

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

}

?>

 

You can see from there that to retrieve the error it calls the function get_error() once more from ot_coupon.php:

 

function get_error() {

global $HTTP_GET_VARS;

 

$error = array('title' => MODULE_ORDER_TOTAL_COUPON_TEXT_ERROR,

'error' => stripslashes(urldecode($HTTP_GET_VARS['$error'])));

 

return $error;

}

 

Here $error is populated with a title and and error.

 

$error['title'] is printed correctly on the screen $error ['error'] is not.

 

If instead of using stripslashes(urldecode($HTTP_GET_VARS['$error']))); I manually add some text then even the $error['error'] is printed on the screen. So my suspect is that the error either occurred when:

 

1) error is encoded : 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT), 'SSL'));

 

or

 

2) error is decoded: 'error' => stripslashes(urldecode($HTTP_GET_VARS['$error'])));

 

I so in the forum someone had the same problem. Did anyone manage to resolve it?

Can someone help?

 

Any feedback is really appreciated.

Cheers

JK

Share this post


Link to post
Share on other sites

Guys,

 

Quick question regarding something that I have noticed testing the app.

If you select free shipping it simply ignores the coupon amount, making impossible to have free shipping + a discount on the product.

Is that normal?

Anyone noticed this?

 

Thanks in advance for your help.

Cheers

JK

Share this post


Link to post
Share on other sites

Fatal error: Call to undefined method shoppingCart::show_total()

 

I'm getting this error

 

in /includes/boxes/shopping_cart.php on line 81

Share this post


Link to post
Share on other sites

Hi,

 

Does anyone know anything about this addon and 3d secure?

I have been using this addon perfectly for years and have only just noticed that even though using the newish paypal 3dsecure it still all works fine and actually processes the correct total but on the actual 3d secure page it shows the original total before discount, this obviously stops customers finishing the transaction as they dont know it actually works.

 

Not really sure where to even start with this.

Any help would be great.

 

thanks

Share this post


Link to post
Share on other sites

Hi Guys

 

I have 5.12 installed on RC2a and read through the install instructions and did the necessary - I think

 

When I click on either Valid Product List or Valid Categories List I get Accesd denied to the file valid productslist.php or validcatergories list.php

 

Both files live under the Admin Directory

 

I have aCpanel protection on the Admin Directory and turned it off the same problem occurs either way

 

This si obvously a rights issues - please can anyone give me a steer on CHMOD settings these two files hould have or anything else I should look at?

 

Many thanks

Share this post


Link to post
Share on other sites

Hi,

 

Can someone tell me what I am missing? I installed the Credit Class/Gift Vouchers/Discount Coupons 5.21 on my store and all seems to work well except the credit to the customers account. In the report section of the admin, I can see that the customer has credit, but nowhere in the customers account does it display that they have a gift voucher balance. Where should the customers balance be located and how can they access it. The customer can purchase the gift voucher from my store and after paying via paypal, they return to the store and it states that they have purchased a voucher and they can send to another person if they want too. But that is all I see. No balance or any reference to the gift voucher is listed anywhere.

 

Please help me figure out where I went wrong. Am I missing a file or something?

 

Thanks

Share this post


Link to post
Share on other sites

I have a coupon set up to only apply to items in one top level category. However, that category has many subcategories and there are products in those subcategories that are not in the parent category and I don't want the coupon to apply to those products but it is.

 

How can I change the code to apply the coupon to only the category specified for the coupon but not any subcategories of that category?

 

Dan

Impulse Creations

The Best Online Comic Book Store

Share this post


Link to post
Share on other sites

Hi,

 

Can someone tell me what I am missing? I installed the Credit Class/Gift Vouchers/Discount Coupons 5.21 on my store and all seems to work well except the credit to the customers account. In the report section of the admin, I can see that the customer has credit, but nowhere in the customers account does it display that they have a gift voucher balance. Where should the customers balance be located and how can they access it. The customer can purchase the gift voucher from my store and after paying via paypal, they return to the store and it states that they have purchased a voucher and they can send to another person if they want too. But that is all I see. No balance or any reference to the gift voucher is listed anywhere.

 

Please help me figure out where I went wrong. Am I missing a file or something?

 

Thanks

 

Did you find out the answer to this? Its got me stumped too.

Share this post


Link to post
Share on other sites

Hi all,

We have been using CCGV and Freeamount for quite some time now and offer free shipping on orders over $99. The client now wants to make sure that free shipping is not offered to orders that drop below $99 after discount coupon is applied. So e.g. If the order total was $110 and free shipping was selected at the checkout_shipping page, then a discount coupon was applied on the checkout_payment stage whereby the order total drops to $90, then at the checkout confirmation it should redirect the customer back to checkout_shipping.

Does anybody have any ideas? I have a little idea of how to proceed but sure would appreciate some help with this project.

Thanks

Share this post


Link to post
Share on other sites

Hi

 

Has any one testet "CCGV_2_22_2011.zip" with osCommerce Online Merchant v2.3?

 

Thanks

Torgrim

 

Yes, I have this working with the exception of the shopping cart box. Which is now located in includes/modules/boxes/bm_shopping_cart.php with this version of osc.

Share this post


Link to post
Share on other sites

Is there anyway to generate a series of coupons?

 

Wanting to give away 350 subscriptions as a promo at an event.

 

Don't want people to be able to use the coupon and pass it along to a friend.

 

I'd like to make a coupon code numbered series like CoupOfWM1, CoupOfWM2.....CoupOfWM350.

 

Anyway to do that without making them one by one?

 

Thanks!!

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

×