Jump to content
Sign in to follow this  
aarondwyer

Credit Class / Gift Voucher "Easier to Understand" Payment Addon

Recommended Posts

1) If check/money order or paypal is selected as the payment method (not using any gift cert, etc), and I click "redeem" with nothing entered into the input box... Then I am redirected straight on to the confirmation page, af if I had simply clicked "continue".

 

Tried to reproduce this following your example, and it works fine for me.

 

Can anyone else using Mike's 1,2,3,4 steps produce the Redeem button error.?

 

PS As for turning the check box into a radio button, I thought of doing that as well, but then thought that using a voucher should look different - mostly since not every gift voucher covers the whole cost. So it's always an add on to a payment option, not an option in itself. Hope that makes sense.

 

Thanks

Aaron


Aaron Dwyer

Share this post


Link to post
Share on other sites

Mike/Aaron,

 

I tried again using the steps outlined in mikes post, but my site seems to work fine. It returns the invalid voucher code error.

 

Must be something wrong with Mikes code?

 

Jono

Share this post


Link to post
Share on other sites
Mike/Aaron,

 

I tried again using the steps outlined in mikes post, but my site seems to work fine. It returns the invalid voucher code error.

 

Must be something wrong with Mikes code?

 

Jono

 

Ok I think that's nailed it now.

 

I've just posted v1.2 to the contributions section. Thanks for the help. Jonyo should be proud of this, it took a fair bit of effort to get it together. I know I am. I wonder if he's seen this yet? :)

 

Cheers

Aaron


Aaron Dwyer

Share this post


Link to post
Share on other sites
Ok I think that's nailed it now.

 

I've just posted v1.2 to the contributions section. Thanks for the help. Jonyo should be proud of this, it took a fair bit of effort to get it together. I know I am. I wonder if he's seen this yet? :)

 

Cheers

Aaron

 

 

Yes this is a very nice contribution.... I can't wait 'till I get all these little "bugs" worked out on my test site so I can move this to the live one! -I'm still digging through and hacking things up though, so its no wonder I'm finding problems.... I'm glad to see others are successful with this mod and not having the probs I'm running into... Obviously I broke something somewhere. That's okay though, because I'm learning a ton about how ccgv works in the process of tearing through this. :D

 

 

Also, per your previous question Aaron, I'm testing mostly on Firefox, but I do check things out in IE before going live, etc....

 

-MJ

Share this post


Link to post
Share on other sites

WOWEE!!! my dreams have come true!!

 

this is the mod that i requested, i feel so special ;-)

 

my store does ALOT of gift vouchers, so i'm really glad to install this "easier" method.

 

THANKS SO MUCH FOR ALL THE HARD WORK!!

 

www.kpixie.com

Share this post


Link to post
Share on other sites

Hopefully this isn't considered a cross post since it APPLIES THE SAME CONTRIBUTION (MODS)

 

I've added the osCommerce Credit Class and Gift Voucher "Easier to Understand" Payment Addon v1.2

 

Everything works as far as can be seen, but this is the error........i've tried searching for the function on line 84 with this part of the function flagging the error

 

Warning: Missing argument 1 for javascript_validation() in /homepages/2/XXXXXXXXXXX/htdocs/GForce/shopping/includes/classes/payment.php on line 84..........Line 84 is where the function javascript_validation($coversAll) { begins

 

 

// #################### Begin Added CGV JONYO ######################
// 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; alert (\'hey yo\');
} else ';
} else {
$addThis='';
}
$js = '<script language="javascript"><!-- ' . "\n" .
'function check_form() {' . "\n" .
' var error = 0;' . "\n" .
' var error_message = "' . JS_ERROR . '";' . "\n" .
' var payment_value = null;' . "\n" .$addThis . //added by jonyo, yo
' if (document.checkout_payment.payment.length) {' . "\n" .
' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" .
' if (document.checkout_payment.payment[i].checked) {' . "\n" .
' payment_value = document.checkout_payment.payment[i].value;' . "\n" .
' }' . "\n" .
' }' . "\n" .
' } else if (document.checkout_payment.payment.checked) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' } else if (document.checkout_payment.payment.value) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' }' . "\n\n";

reset($this->modules);
while (list(, $value) = each($this->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
$js .= $GLOBALS[$class]->javascript_validation();
}
}

// ############ Added CCGV Contribution ##########
// $js .= "\n" . ' if (payment_value == null) {' . "\n" .
$js .= "\n" . ' if (payment_value == null && submitter != 1) {' . "\n" . // CCGV Contribution
// ############ End Added CCGV Contribution ##########
' error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" .
' error = 1;' . "\n" .
' }' . "\n\n" .
// ############ Added CCGV Contribution ##########
// ICW CREDIT CLASS Gift Voucher System Line below amended
// ' if (error == 1) {' . "\n" .
' if (error == 1 && submitter != 1) {' . "\n" .
// ############ End Added CCGV Contribution ##########
' alert(error_message);' . "\n" .
' return false;' . "\n" .
' } else {' . "\n" .
' return true;' . "\n" .
' }' . "\n" .
'}' . "\n" .
'//--></script>' . "\n";
}

return $js;
}
// #################### End Added CGV JONYO ######################

Share this post


Link to post
Share on other sites

I found that if I used another version that is slightly modified to a "purer" form?? that it kills the error.......it seems the java arguement is invalid or I missed something. Here is the code that kills the error but I'm sure the mod isn't 100%...........any ideas ......???

 

function javascript_validation() {
$js = '';
if (is_array($this->modules)) {
$js = '<script language="javascript"><!-- ' . "\n" .
'function check_form() {' . "\n" .
' var error = 0;' . "\n" .
' var error_message = "' . JS_ERROR . '";' . "\n" .
' var payment_value = null;' . "\n" .
' if (document.checkout_payment.payment.length) {' . "\n" .
' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" .
' if (document.checkout_payment.payment[i].checked) {' . "\n" .
' payment_value = document.checkout_payment.payment[i].value;' . "\n" .
' }' . "\n" .
' }' . "\n" .
' } else if (document.checkout_payment.payment.checked) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' } else if (document.checkout_payment.payment.value) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' }' . "\n\n";

reset($this->modules);
while (list(, $value) = each($this->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
$js .= $GLOBALS[$class]->javascript_validation();
}
}

$js .= "\n" . ' if (payment_value == null) {' . "\n" .
' error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" .
' error = 1;' . "\n" .
' }' . "\n\n" .
' if (error == 1 && submitter != 1) {' . "\n" . // GV Code Start/End
' alert(error_message);' . "\n" .
' return false;' . "\n" .
' } else {' . "\n" .
' return true;' . "\n" .
' }' . "\n" .
'}' . "\n" .
'//--></script>' . "\n";
}

return $js;
}

Share this post


Link to post
Share on other sites
Hopefully this isn't considered a cross post since it APPLIES THE SAME CONTRIBUTION (MODS)

 

I've added the osCommerce Credit Class and Gift Voucher "Easier to Understand" Payment Addon v1.2

 

Everything works as far as can be seen, but this is the error........i've tried searching for the function on line 84 with this part of the function flagging the error

 

Warning: Missing argument 1 for javascript_validation() in /homepages/2/XXXXXXXXXXX/htdocs/GForce/shopping/includes/classes/payment.php on line 84..........Line 84 is where the function javascript_validation($coversAll) { begins

 

There were one or two little warnings etc from javascript. But I ignored them since it wasn't an error. No time for warnings. :)

 

If you can fix them without loosing any functionality, post just what you changed (rather than the whole function) and we'll all give it a go. If it's good it should be wrapped into the mod.

 

Aaron


Aaron Dwyer

Share this post


Link to post
Share on other sites

Actually my fix was a removal of code which I don't think the author intended:

 

This code works:

 

function javascript_validation() {
$js = '';
if (is_array($this->modules)) {

 

This codes give the warning:

 

function javascript_validation($coversAll) {	 <<<<<<<Removed $coversAll
$js = ''; <<<<<<<SAME
if (is_array($this->modules)) { <<<<<<<<<<SAME
if ($coversAll) {	<<<<<<<Removed
$addThis='if (document.checkout_payment.cot_gv.checked) {	<<<<<<<Removed
payment_value=cot_gv; alert (\'hey yo\');	<<<<<<<Removed
} else ';	<<<<<<<Removed
} else {	<<<<<<<Removed
$addThis='';	<<<<<<<Removed
}	<<<<<<<Removed

Share this post


Link to post
Share on other sites

Aaron, et al...

 

I've installed this contribution and it works wonderfully (on its own). However, I've tried to install the PWA (purchase without account) contribution and now in my php error log I get a PHP error* which manifests to the user as the browser appearing blank on checkout_payment.php.

 

When I remove line 191 from checkout_payment.php the problem goes away but so does the coupon redemption feature. :-(

 

I also attempted to install the FEC (Fast Easy Checkout) contribution seperately (my FEC and PWA installs do not overlap and are completely and totally seperate - I need PWA functionality so I'm running mirrors of my production site in test to get PWA functionality going) and the same PHP error* occurs.

 

* = PHP Fatal error: Call to a member function mod_process() on a non-object in c:\htdocs\store\checkout_payment.php on line 191

 

Line 191 = $testing=$GLOBALS['ot_gv']->mod_process();

 

Any ideas?

 

Help!

Share this post


Link to post
Share on other sites

Hi,

 

I am trying to install this contribution but am getting the following error.

 

Parse error: parse error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in

/includes/classes/order_total.php on line 306

 

line 306 is: // if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$order->info['tax'];

 

 

and part of the file..

 

 

 

// Called at various times. This function calulates the total value of the order that the

// credit will be appled aginst. This varies depending on whether the credit class applies

// to shipping & tax

//

function get_order_total_main($class, $order_total) {

global $credit, $order;

// if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$order->info['tax'];

// if ($GLOBALS[$class]->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost'];

return $order_total;

}

// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - END ADDITION

}

 

 

 

Hope someone can help.

 

 

Thanks

Share this post


Link to post
Share on other sites

You should check through the install again. You must have missed or added a } somewhere

 

Aaron

 

Hi,

 

I am trying to install this contribution but am getting the following error.

 

Parse error: parse error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in

/includes/classes/order_total.php on line 306

 

line 306 is: // if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$order->info['tax'];

and part of the file..

// Called at various times. This function calulates the total value of the order that the

// credit will be appled aginst. This varies depending on whether the credit class applies

// to shipping & tax

//

function get_order_total_main($class, $order_total) {

global $credit, $order;

// if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$order->info['tax'];

// if ($GLOBALS[$class]->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost'];

return $order_total;

}

// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - END ADDITION

}

Hope someone can help.

Thanks

 

 

Sorry you may be on your own working in those other contributions.

 

In the past I've always tried to get troublesome contributions working on there own first with a clean install of osCommerce, then merge them in from there.

 

Aaron

 

Aaron, et al...

 

I've installed this contribution and it works wonderfully (on its own). However, I've tried to install the PWA (purchase without account) contribution and now in my php error log I get a PHP error* which manifests to the user as the browser appearing blank on checkout_payment.php.

 

When I remove line 191 from checkout_payment.php the problem goes away but so does the coupon redemption feature. :-(

 

I also attempted to install the FEC (Fast Easy Checkout) contribution seperately (my FEC and PWA installs do not overlap and are completely and totally seperate - I need PWA functionality so I'm running mirrors of my production site in test to get PWA functionality going) and the same PHP error* occurs.

 

* = PHP Fatal error: Call to a member function mod_process() on a non-object in c:\htdocs\store\checkout_payment.php on line 191

 

Line 191 = $testing=$GLOBALS['ot_gv']->mod_process();

 

Any ideas?

 

Help!


Aaron Dwyer

Share this post


Link to post
Share on other sites

What a nice contribution and as clean of an install as I have seen. Nice job aarondwyer.

 

Because I am not a programmer I can't answer this question myself, but I would like to see the gift voucher redeem option as the first payment choice on the payment screen. Can you advise how to move it to the top of the list. It we be much appreciated. :)

 

Rick

Edited by RGStephens

Share this post


Link to post
Share on other sites

Great contribution to all who have pulled this discount/voucher class together. I've been using it for a couple of weeks now and would like to make some comments for future development considerations.

 

1.) Allow for Automatic Discout Coupons to be redeemed through links:

 

This would only be allowed for discounts that don't need a user to be logged in; such as a general 15% off discount. The trick here would be to create the store session and then bring the user into the store from an outside page or advertisement.

 

2.) Shopping Cart Confusions:

 

Some users have told us that the cart pricing was misleading, as it shows the full price. We added the following note to logic of the cart and it seemed to help.

 

Note: Pricing shown is full price. Your fully discounted / adjusted total

will be shown on the confirmation page, prior to completing your order.

 

It would be great to be able to integrate the discount module into the shopping cart to display the discount pricing. This might create issues with the shippnig/tax logic. The idea would be to show the full price with a red line through it. Then show the discounted price after that. This would all take place in the shopping cart, not in the order process. I "really" think this would help drive sales!

 

3.) Billing Information Page:

 

Again, more "wording" needs to be added for people who are too stupid to figure out the obvious. Also, I moved the credit/discount section up above the payment method section.

 

 

Shipping & Sales Tax:

 

I can see the reason for the free shipping, but why is the sales tax involved in the calculation? I would assume that discounts/vouchers are pre-tax to give the user the best deal.

Share this post


Link to post
Share on other sites

I really like this addition but have a question. Regarding the onclick="clearRadeos()" feature that can clears the payment options if there the available GV balance exceeds the cart total:

 

Has anyone else noticed that you can't click the actual checkbox? I can click anywhere else on that line, but not the checkbox. If I remove the onclick="clearRadeos()", changing this line:

								  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)"  onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .

to this:

								  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)"  onmouseout="rowOutEffect(this)" >' . "\n" .

 

then that feature is disabled, allowing me to click the checkbox. I'm not that good with javascript, so if Aaron has a quick fix I'd appreciate not knocking my head against the table tonight. :)

 

-jared

Edited by jcall

Share this post


Link to post
Share on other sites

(should be noted that I'm using this on a site CCGV 5.10), I know, I know . . .

 

I notice that I can select to use my gift voucher balance, with no other payment and check out successfully even when I've configured CCGV to not apply the balance to tax or shipping. The order total shows that I still owe for tax and shipping, but I'm not required to pay it.

 

Anyone else seeing that?

 

-jared

Share this post


Link to post
Share on other sites
I really like this addition but have a question. Regarding the onclick="clearRadeos()" feature that can clears the payment options if there the available GV balance exceeds the cart total:

 

Has anyone else noticed that you can't click the actual checkbox? I can click anywhere else on that line, but not the checkbox.

 

Jared

 

I've tested this with Firefox and IE 6. No problems for me. Check over your install again, and perhaps you have conflicting code from other contributions.

 

Sorry looks like you're going to have that sore head after all. :(

 

Aaron


Aaron Dwyer

Share this post


Link to post
Share on other sites

Thanks for the reply, Aaron. I think I'm going to have to hold off until I upgrade to 5.14 anyway, because of the checkout allowing me to use ONLY funds in my CCGV balance, even if they are limited to not cover tax & shipping.

 

Would you mind posting your checkout_payment here? It will save me some time deciding.

 

Thanks!

 

-jared

Share this post


Link to post
Share on other sites

Thank you Aaron et al for a great modification to a great contribution!

 

One little thing I can't figure out is how to move the checkbox to precede the text.

 

I read this and the main CCGV thread completely; for about the tenth time, and couldn't find an answer anywhere. Sorry if I missed it somewhere along the line...

 

I have installed a modification that places the radio buttons in front of the payment method but cannot find how to put the check box in front of the "$XX.YY to be used from Gift Vouchers" text. See screen capture:

 

screencapccgv.jpg

 

I have tried numerous "let me try this and see what happens" hacks in various files but to no avail.

 

I did manage to place the voucher redemption payment method above the other payment methods I have available.

 

If anyone wants to see where I moved the code just let me know; though most people in this thread seem to know how to perform such a formatting change.

 

Any news on changing the checkbox to a radio button so it matches the other methods (as discussed previously either in this thread or the main CCGV thread)?

 

That would make this already great modification the real bee's knees.

 

BFC

Edited by bfcase

Share this post


Link to post
Share on other sites
Thank you Aaron et al for a great modification to a great contribution!

 

One little thing I can't figure out is how to move the checkbox to precede the text.

 

I read this and the main CCGV thread completely; for about the tenth time, and couldn't find an answer anywhere. Sorry if I missed it somewhere along the line...

 

I have installed a modification that places the radio buttons in front of the payment method but cannot find how to put the check box in front of the "$XX.YY to be used from Gift Vouchers" text. See screen capture:

 

screencapccgv.jpg

 

I have tried numerous "let me try this and see what happens" hacks in various files but to no avail.

 

I did manage to place the voucher redemption payment method above the other payment methods I have available.

 

If anyone wants to see where I moved the code just let me know; though most people in this thread seem to know how to perform such a formatting change.

 

Any news on changing the checkbox to a radio button so it matches the other methods (as discussed previously either in this thread or the main CCGV thread)?

 

That would make this already great modification the real bee's knees.

 

BFC

 

 

 

Hi - I would like to see how you changed the code to move the voucher to the top. I am not much with code. I would appreciate your assistance. Thanks.

 

Rick

Share this post


Link to post
Share on other sites
Hi - I would like to see how you changed the code to move the voucher to the top. I am not much with code. I would appreciate your assistance. Thanks.

 

Rick

 

Rick,

 

The very last subsection of "Step #4 - In /catalog/checkout_payment.php" in the (very well written by the way) readme.html install file says to do do this:

 

	$radio_buttons++;
 }

// #################### Begin Added CGV JONYO ######################
/*
if (tep_session_is_registered('customer_id')) {
if ($testing['value']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main"><b>';
 echo $testing['text'].' ';//var_dump ( $testing);
 echo $order_total_modules->sub_credit_selection();
 }
}
*/

if (tep_session_is_registered('customer_id')) {
// if ($testing['value']>0){
if ($gv_result['amount']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2>' . "\n" .
							  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main">' . $testing['text'];

 echo $order_total_modules->sub_credit_selection();
 }
}


// #################### End Added CGV JONYO ######################

?>
		</table></td>

 

Instead of placing the code there, I placed it here:

 

<?php
 } else {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td>
					  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					</tr>
<?php
 }

// #################### Begin Added CGV JONYO ######################
/*
if (tep_session_is_registered('customer_id')) {
if ($testing['value']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main"><b>';
 echo $testing['text'].' ';//var_dump ( $testing);
 echo $order_total_modules->sub_credit_selection();
 }
}
*/

if (tep_session_is_registered('customer_id')) {
// if ($testing['value']>0){
if ($gv_result['amount']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2>' . "\n" .
							  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main">' . $testing['text'];

 echo $order_total_modules->sub_credit_selection();
 }
}
// #################### End Added CGV JONYO ######################

 $radio_buttons = 0;
 for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
?>

 

The method above works for me just fine and is the only change I made for the formatting.

 

Brian

Share this post


Link to post
Share on other sites
Rick,

 

The very last subsection of "Step #4 - In /catalog/checkout_payment.php" in the (very well written by the way) readme.html install file says to do do this:

 

	$radio_buttons++;
 }

// #################### Begin Added CGV JONYO ######################
/*
if (tep_session_is_registered('customer_id')) {
if ($testing['value']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main"><b>';
 echo $testing['text'].' ';//var_dump ( $testing);
 echo $order_total_modules->sub_credit_selection();
 }
}
*/

if (tep_session_is_registered('customer_id')) {
// if ($testing['value']>0){
if ($gv_result['amount']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2>' . "\n" .
							  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main">' . $testing['text'];

 echo $order_total_modules->sub_credit_selection();
 }
}
// #################### End Added CGV JONYO ######################

?>
		</table></td>

 

Instead of placing the code there, I placed it here:

 

<?php
 } else {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td>
					  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					</tr>
<?php
 }

// #################### Begin Added CGV JONYO ######################
/*
if (tep_session_is_registered('customer_id')) {
if ($testing['value']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2><table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main"><b>';
 echo $testing['text'].' ';//var_dump ( $testing);
 echo $order_total_modules->sub_credit_selection();
 }
}
*/

if (tep_session_is_registered('customer_id')) {
// if ($testing['value']>0){
if ($gv_result['amount']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2>' . "\n" .
							  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main">' . $testing['text'];

 echo $order_total_modules->sub_credit_selection();
 }
}
// #################### End Added CGV JONYO ######################

 $radio_buttons = 0;
 for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
?>

 

The method above works for me just fine and is the only change I made for the formatting.

 

Brian

 

 

Thanks Brian - You da man! It works like a champ. Now I also like the idea of moving the check boxes/radio buttons to the left also. I'll keep watching this thread until someone gets it done. Was it difficult to move the Radio Buttons?

 

Thanks Again,

 

Rick

Share this post


Link to post
Share on other sites
Thanks Brian - You da man! It works like a champ. Now I also like the idea of moving the check boxes/radio buttons to the left also. I'll keep watching this thread until someone gets it done. Was it difficult to move the Radio Buttons?

 

Thanks Again,

 

Rick

 

Rick,

 

I am glad it helped.

 

Moving the code for applying the gift certificate balance was one of those things I just tried until I got it to work... like everything I seem to do with my site.

 

I tried many different things to swap the text and buttons for this add-on but ended up with errors every time so I had to break down and ask for some help here.

 

There is a contribution for moving the radio buttons to be to the left of the module text.

 

It is called Checkout Payment Fix. It can be found in the Payment Modules contributions area. Original file dated Sept 8 2005 by wdepot, updated October 26, 2005 by brushwood.

 

I used the update to install as my checkou_payment.php was already modifed and couldn't be changed via a drop-in replacement.

 

BFC

Share this post


Link to post
Share on other sites
Thanks Brian - I hope moving the checkbox on the voucher fix happens soon.

 

Rick

 

I figured it out.

 

screencapccgv_working.jpg

 

For anyone who wants to move the checkbox to the left to match radio buttons that have been moved to the left - this is how I did it:

 

In catalog/includes/modules/order_total/ot_gv.php:

 

Look for:

 

$this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="clearRadeos()" name="' . 'c' . $this->code . '">';

 

Change to:

 

$this->checkbox = '<input type="checkbox" onClick="clearRadeos()" name="' . 'c' . $this->code . '">';

 

Also in catalog/includes/modules/order_total/ot_gv.php:

 

Look for:

 

 // #################### Begin Added CGV JONYO ######################
function use_credit_amount() {
	global $cot_gv, $currencies;
//	  $_SESSION['cot_gv'] = false;	 // old code - Strider
  $cot_gv = false;
  if ($this->selection_test()) {
	$output_string = $this->checkbox . '</b>' . '</td>' . "\n";}

  return $output_string;
}

function use_credit_amount_sub() {
	global $cot_gv;
//	  $_SESSION['cot_gv'] = false;	 // old code - Strider
  $cot_gv = false;
  if ($this->selection_test()) {
	$output_string .=  '	<td align="right" class="main" colspan=2>';
	$output_string .= '<b>' . $this->checkbox . '</b>' . '</td>' . "\n";
  }
  return $output_string;
}
// #################### End Added CGV JONYO ######################

 

Change to:

 

 // #################### Begin Added CGV JONYO ######################
function use_credit_amount() {
	global $cot_gv, $currencies;
//	  $_SESSION['cot_gv'] = false;	 // old code - Strider

	$testing= $GLOBALS['ot_gv']->mod_process();
	$testing= $GLOBALS['ot_gv']->my_output[0];

  $cot_gv = false;
  if ($this->selection_test()) {
	$output_string = $this->checkbox . '??' . $testing['text'] . $this->user_prompt . '</b>' . '</td>' . "\n";}

  return $output_string;
}

function use_credit_amount_sub() {
	global $cot_gv;
//	  $_SESSION['cot_gv'] = false;	 // old code - Strider
  $cot_gv = false;
  if ($this->selection_test()) {
	$output_string .=  '	<td align="right" class="main" colspan=2>';
	$output_string .= '<b>' . $this->checkbox . '??' . $testing['text'] . $this->user_prompt . '</b>' . '</td>' . "\n";
  }
  return $output_string;
}
// #################### End Added CGV JONYO ######################

 

In catalog/checkout_payment.php:

 

Look for:

 

if ($gv_result['amount']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2>' . "\n" .
							  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main">' . $testing['text'];

 echo $order_total_modules->sub_credit_selection();

 

Change to:

 

if ($gv_result['amount']>0){
 echo ' <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2>' . "\n" .
							  ' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .
						 '   <td class="main">' . $order_total_modules->sub_credit_selection();


//   echo $order_total_modules->sub_credit_selection();

 

I left the checkbox as a checkbox.

 

I don't know what I was thinking in my previous post - changing it to a radio button will preclude the use of other payment methods if the gift certificate total is less than the total order amount.

 

I have no idea what I am doing but the above has been tested on my site and it works for me.

 

If anyone has a better way or knows if the code above will cause problems please let me know.

 

Brian

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  

×