bry21317 Posted May 19, 2006 Share Posted May 19, 2006 I am getting an error after installing this Contribution. Can anyone help me ? Here is the error: Fatal error: Call to undefined function: clear_posts() in /home/u2/bry21317/html/osc/checkout_payment.php on line 89 Thanks, Bryan Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 I am getting an error after installing this Contribution. Can anyone help me ? Here is the error: Fatal error: Call to undefined function: clear_posts() in /home/u2/bry21317/html/osc/checkout_payment.php on line 89 Thanks, Bryan What version of CCGV are you installing. In 5.15a2 this area of checkout_payment.php says require(DIR_WS_CLASSES . 'order.php'); $order = new order; // #################### Added CGV ###################### require(DIR_WS_CLASSES . 'order_total.php');//ICW ADDED FOR CREDIT CLASS SYSTEM $order_total_modules = new order_total;//ICW ADDED FOR CREDIT CLASS SYSTEM $order_total_modules->clear_posts(); // ADDED FOR CREDIT CLASS SYSTEM by Rigadin in v5.13 // #################### End Added CGV ###################### It looks like it is referencing catalog\includes\classes\order_total.php at around where it says // Called in checkout process to clear session variables created by each credit class module. // function clear_posts() { global $HTTP_POST_VARS,$HTTP_SESSION_VARS; if (MODULE_ORDER_TOTAL_INSTALLED) { so you may have missed an edit or not uploaded all new and changed files. Quote Link to comment Share on other sites More sharing options...
MoisesZaragoza Posted May 19, 2006 Share Posted May 19, 2006 Look, I don't know what you are doing. The links in the above posts do not serve any purpose. If you are using ie, go to the page that is giving problems. Click view, go to source, press ctrl a, copy and paste into a reply to this post. Did you change the necessary files, upload the new and changed files, and have you ever run the sql. https://coolbugstuff.com/checkout_payment.php? <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html dir="LTR" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Cool Bug Stuff</title> <base href="https://coolbugstuff.com/"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- var selected; var submitter = null; function submitFunction() { submitter = 1; } function selectRowEffect(object, buttonSelect) { // #################### Begin Added CGV JONYO ###################### if (!document.checkout_payment.payment[0].disabled){ // #################### End Added CGV JONYO ###################### if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_payment.payment[0]) { document.checkout_payment.payment[buttonSelect].checked=true; } else { document.checkout_payment.payment.checked=true; } // #################### Begin Added CGV JONYO ###################### } // #################### End Added CGV JONYO ###################### } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } <br /> <b>Fatal error</b>: Call to a member function on a non-object in <b>/home/content/c/o/o/coolbug/html/checkout_payment.php</b> on line <b>175</b><br /> Quote at the end of the day the code will be good Link to comment Share on other sites More sharing options...
bry21317 Posted May 19, 2006 Share Posted May 19, 2006 I am using the 5.15a2 version. Here is the code that is in that order_total.php file. It is correct, and I still have the erorr. Any other help. I have been pulling my hair out on this one. // Called in checkout process to clear session variables created by each credit class module. // function clear_posts() { global $HTTP_POST_VARS,$HTTP_SESSION_VARS; if (MODULE_ORDER_TOTAL_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) { $post_var = 'c' . $GLOBALS[$class]->code; if (tep_session_is_registered($post_var)) tep_session_unregister($post_var); } } } } Thanks, Bryan Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 https://coolbugstuff.com/checkout_payment.php? <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html dir="LTR" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Cool Bug Stuff</title> <base href="https://coolbugstuff.com/"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- var selected; var submitter = null; function submitFunction() { submitter = 1; } function selectRowEffect(object, buttonSelect) { // #################### Begin Added CGV JONYO ###################### if (!document.checkout_payment.payment[0].disabled){ // #################### End Added CGV JONYO ###################### if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_payment.payment[0]) { document.checkout_payment.payment[buttonSelect].checked=true; } else { document.checkout_payment.payment.checked=true; } // #################### Begin Added CGV JONYO ###################### } // #################### End Added CGV JONYO ###################### } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } <br /> <b>Fatal error</b>: Call to a member function on a non-object in <b>/home/content/c/o/o/coolbug/html/checkout_payment.php</b> on line <b>175</b><br /> Do you have this in the checkout_payment.php page? function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } <?php // #################### Begin Added CGV JONYO ###################### ?> <?php if (MODULE_ORDER_TOTAL_INSTALLED) $temp=$order_total_modules->process(); $temp=$temp[count($temp)-1]; $temp=$temp['value']; $testing= $GLOBALS['ot_gv']->mod_process(); $testing=$GLOBALS['ot_gv']->my_output[0]; $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); echo "// temp1 = " . $temp['value'] . "\n"; echo "// temp2 = " . $temp . "\n"; echo "// gvresult = " . $gv_result['amount'] . "\n"; if ($gv_result['amount']>=$temp){ $coversAll=true; ?> function clearRadeos(){ document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked; for (counter = 0; counter < document.checkout_payment.payment.length; counter++) { // If a radio button has been selected it will return true // (If not it will return false) if (document.checkout_payment.cot_gv.checked){ document.checkout_payment.payment[counter].checked = false; document.checkout_payment.payment[counter].disabled=true; //document.checkout_payment.cot_gv.checked=false; } else { document.checkout_payment.payment[counter].disabled=false; //document.checkout_payment.cot_gv.checked=true; } } }<? } else { $coversAll=false;?> function clearRadeos(){ document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked; }<? } ?> <?php // #################### End Added CGV JONYO ###################### ?> //--></script> <?php // #################### Begin Added CGV JONYO ###################### ?> <?php // echo $payment_modules->javascript_validation(); ?> <?php echo $payment_modules->javascript_validation($coversAll); ?> <?php // #################### End Added CGV JONYO ###################### ?> </head> Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 I am using the 5.15a2 version. Here is the code that is in that order_total.php file. It is correct, and I still have the erorr. Any other help. I have been pulling my hair out on this one. // Called in checkout process to clear session variables created by each credit class module. // function clear_posts() { global $HTTP_POST_VARS,$HTTP_SESSION_VARS; if (MODULE_ORDER_TOTAL_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) { $post_var = 'c' . $GLOBALS[$class]->code; if (tep_session_is_registered($post_var)) tep_session_unregister($post_var); } } } } Thanks, Bryan Hi Bryan Can you post your checkout_payment.php contents for me? If you guys doubt that it works, feel free to try it at www.coopco.com.au/catalog Quote Link to comment Share on other sites More sharing options...
MoisesZaragoza Posted May 19, 2006 Share Posted May 19, 2006 Do you have this in the checkout_payment.php page? function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } <?php // #################### Begin Added CGV JONYO ###################### ?> <?php if (MODULE_ORDER_TOTAL_INSTALLED) $temp=$order_total_modules->process(); $temp=$temp[count($temp)-1]; $temp=$temp['value']; $testing= $GLOBALS['ot_gv']->mod_process(); $testing=$GLOBALS['ot_gv']->my_output[0]; $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); echo "// temp1 = " . $temp['value'] . "\n"; echo "// temp2 = " . $temp . "\n"; echo "// gvresult = " . $gv_result['amount'] . "\n"; if ($gv_result['amount']>=$temp){ $coversAll=true; ?> function clearRadeos(){ document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked; for (counter = 0; counter < document.checkout_payment.payment.length; counter++) { // If a radio button has been selected it will return true // (If not it will return false) if (document.checkout_payment.cot_gv.checked){ document.checkout_payment.payment[counter].checked = false; document.checkout_payment.payment[counter].disabled=true; //document.checkout_payment.cot_gv.checked=false; } else { document.checkout_payment.payment[counter].disabled=false; //document.checkout_payment.cot_gv.checked=true; } } }<? } else { $coversAll=false;?> function clearRadeos(){ document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked; }<? } ?> <?php // #################### End Added CGV JONYO ###################### ?> //--></script> <?php // #################### Begin Added CGV JONYO ###################### ?> <?php // echo $payment_modules->javascript_validation(); ?> <?php echo $payment_modules->javascript_validation($coversAll); ?> <?php // #################### End Added CGV JONYO ###################### ?> </head> That is exacly what I have I was checking line 175 $testing= $GLOBALS['ot_gv']->mod_process(); Quote at the end of the day the code will be good Link to comment Share on other sites More sharing options...
bry21317 Posted May 19, 2006 Share Posted May 19, 2006 I know it will work, I believe you. I just am stumped. I have gone through each file and double checked all the mods that were needed to merge this code into my code, that already had some contributions in it. Here is My code: Payment_checkout.php file <?php /* $Id: checkout_payment.php,v 1.2.7 2004/01/01 12:03:27 Strider Exp $ $Id: checkout_payment.php,v 1.113 2003/07/24 23:03:27 Strider Exp $ $Id: checkout_payment.php,v 1.113 2003/06/29 23:03:27 hpdl Exp $ $Id: checkout_payment.php,v 1.6.2.3 2003/05/10 20:12:14 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); // #################### Begin Added CGV JONYO ###################### if (tep_session_is_registered('cot_gv')) tep_session_unregister('cot_gv'); //added to reset whether a gift voucher is used or not on this order // #################### End Added CGV JONYO ###################### // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if (!tep_session_is_registered('shipping')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } // if we have been here before and are coming back get rid of the credit covers variable // #################### Added CGV ###################### if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers'); // CCGV Contribution // #################### End Added CGV ###################### // Stock Check if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) { $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); break; } } } // #################### Begin Added CGV JONYO ###################### // #################### THIS MOD IS OPTIONAL! ###################### // load the selected shipping module require(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping($shipping); // #################### End Added CGV JONYO ###################### // #################### THIS MOD WAS OPTIONAL! ###################### // if no billing destination address was selected, use the customers own address as default if (!tep_session_is_registered('billto')) { tep_session_register('billto'); $billto = $customer_default_address_id; } else { // verify the selected billing address $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $billto = $customer_default_address_id; if (tep_session_is_registered('payment')) tep_session_unregister('payment'); } } require(DIR_WS_CLASSES . 'order.php'); $order = new order; // #################### Added CGV ###################### require(DIR_WS_CLASSES . 'order_total.php');//ICW ADDED FOR CREDIT CLASS SYSTEM $order_total_modules = new order_total;//ICW ADDED FOR CREDIT CLASS SYSTEM $order_total_modules->clear_posts(); // ADDED FOR CREDIT CLASS SYSTEM by Rigadin in v5.13 // #################### End Added CGV ###################### if (!tep_session_is_registered('comments')) tep_session_register('comments'); $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); // #################### Added CGV ###################### $total_count = $cart->count_contents_virtual(); //ICW ADDED FOR CREDIT CLASS SYSTEM // #################### End Added CGV ###################### // load all enabled payment modules require(DIR_WS_CLASSES . 'payment.php'); $payment_modules = new payment; require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT); $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- var selected; <?php // #################### Added CGV ###################### ?> var submitter = null; function submitFunction() { submitter = 1; } <?php // #################### End Added CGV ###################### ?> function selectRowEffect(object, buttonSelect) { // #################### Begin Added CGV JONYO ###################### if (!document.checkout_payment.payment[0].disabled){ // #################### End Added CGV JONYO ###################### if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_payment.payment[0]) { document.checkout_payment.payment[buttonSelect].checked=true; } else { document.checkout_payment.payment.checked=true; } // #################### Begin Added CGV JONYO ###################### } // #################### End Added CGV JONYO ###################### } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } <?php // #################### Begin Added CGV JONYO ###################### ?> <?php if (MODULE_ORDER_TOTAL_INSTALLED) $temp=$order_total_modules->process(); $temp=$temp[count($temp)-1]; $temp=$temp['value']; $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); if ($gv_result['amount']>=$temp){ $coversAll=true; ?> function clearRadeos(){ document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked; for (counter = 0; counter < document.checkout_payment.payment.length; counter++) { // If a radio button has been selected it will return true // (If not it will return false) if (document.checkout_payment.cot_gv.checked){ document.checkout_payment.payment[counter].checked = false; document.checkout_payment.payment[counter].disabled=true; //document.checkout_payment.cot_gv.checked=false; } else { document.checkout_payment.payment[counter].disabled=false; //document.checkout_payment.cot_gv.checked=true; } } }<? } else { $coversAll=false;?> function clearRadeos(){ document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked; }<? } ?> <?php // #################### End Added CGV JONYO ###################### ?> //--></script> <?php // #################### Begin Added CGV JONYO ###################### ?> <?php // echo $payment_modules->javascript_validation(); ?> <?php echo $payment_modules->javascript_validation($coversAll); ?> <?php // #################### End Added CGV JONYO ###################### ?> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_payment.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?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> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <?php // #################### Begin Added CGV JONYO ###################### ?> <?php // #################### THIS MOD IS OPTIONAL! ###################### ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo HEADING_PRODUCTS; ?></b><? echo ' <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td> </tr> </table></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"> <?php //} for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { echo ' <tr>' . "\n" . ' <td width="10%" class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" . ' <td width="60%" class="main" valign="top">' . $order->products[$i]['name']; if (STOCK_CHECK == 'true') { echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']); } if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) { for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) { echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>'; } } echo '</td>' . "\n"; if (sizeof($order->info['tax_groups']) > 1) echo ' <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '% </td>' . "\n"; echo ' <td width="30%"class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . ' </td>' . "\n" . ' </tr>' . "\n"; } ?> <tr> <td COLSPAN="3" valign="top" align="right"> <table border="0" cellspacing="0" cellpadding="3"> <?php if (MODULE_ORDER_TOTAL_INSTALLED) { //$temp=$order_total_modules->process(); echo $order_total_modules->output(); } ?> </table> </td> </tr> </table> </td> </tr> </table></td> </tr> <!-- </table></td> </tr--> <?php // #################### End Added CGV JONYO ###################### ?> <?php // #################### THIS MOD WAS OPTIONAL! ###################### ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></b></td> </tr> </table></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><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="50%" valign="top"><?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br><br><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td> <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" align="center" valign="top"><b><?php echo TITLE_BILLING_ADDRESS; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" valign="top"><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></b></td> </tr> </table></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"> <?php $selection = $payment_modules->selection(); if (sizeof($selection) > 1) { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_PAYMENT_METHOD; ?></td> <td class="main" width="50%" valign="top" align="right"><b><?php echo TITLE_PLEASE_SELECT; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?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 } $radio_buttons = 0; for ($i=0, $n=sizeof($selection); $i<$n; $i++) { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td> <td class="main" align="right"> <?php if (sizeof($selection) > 1) { echo tep_draw_radio_field('payment', $selection[$i]['id']); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> </td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php if (isset($selection[$i]['error'])) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="4"><table border="0" cellspacing="0" cellpadding="2"> <?php for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) { ?> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo $selection[$i]['fields'][$j]['title']; ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo $selection[$i]['fields'][$j]['field']; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } ?> </table></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php } ?> </table></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php $radio_buttons++; } // #################### Begin Added CGV JONYO ###################### if (tep_session_is_registered('customer_id')) { 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">' . $gv_result['text']; echo $order_total_modules->sub_credit_selection(); } } // #################### End Added CGV JONYO ###################### ?> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php // #################### Added CGV ###################### echo $order_total_modules->credit_selection();//ICW ADDED FOR CREDIT CLASS SYSTEM // #################### End Added CGV ###################### ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td> </tr> </table></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><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <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> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> </tr> </table></td> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> </tr> </table></td> <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td> </tr> </table></td> </tr> <tr> <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td> <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td> <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td> <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td> </tr> </table></td> </tr> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Thanks for all your help. Bryan Quote Link to comment Share on other sites More sharing options...
kdenby Posted May 19, 2006 Share Posted May 19, 2006 That is exacly what I have I was checking line 175 $testing= $GLOBALS['ot_gv']->mod_process(); Hmmm ... might have a helpful suggestion - a few posts up I was having trouble with this same line throwing an error and following Coopco's suggestion to look at ot_gv.php in /modules/order_total I checked the code and found no issues ...BUT I had not installed the Voucher part of the contrib, only the Coupon part - so I went into Admin and through to Order Total and ran the Install for Vouchers. That cured the error from line 175 - I realised that 175 was calling a global that hadn't been set . The bad news is that despite all this I still have to enter the coupon redeem code twice for any discount to show up in the shopping cart and product summary. Seem to have been all round the houses and back again. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 That is exacly what I have I was checking line 175 $testing= $GLOBALS['ot_gv']->mod_process(); OK, then in catalog/includes/classes/payment.php do you have @call_user_method('update_status', $GLOBALS[$this->selected_module]); } } } } // #################### 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.checked) {' . "\n" . ' payment_value = document.checkout_payment.payment.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 ###################### function selection() { $selection_array = array(); Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 Hmmm ... might have a helpful suggestion - a few posts up I was having trouble with this same line throwing an error and following Coopco's suggestion to look at ot_gv.php in /modules/order_total I checked the code and found no issues ...BUT I had not installed the Voucher part of the contrib, only the Coupon part - so I went into Admin and through to Order Total and ran the Install for Vouchers. That cured the error from line 175 - I realised that 175 was calling a global that hadn't been set . The bad news is that despite all this I still have to enter the coupon redeem code twice for any discount to show up in the shopping cart and product summary. Seem to have been all round the houses and back again. Good point. I really didn't think that you had to install both in admin, I just did it. This might help someone. I only have to enter the redeem once. If you want a copy of the files that I ftped to my test site, I will email to you. Just send me an email. If you want to try what I have working (it is only working on my test site) go to coopco.com.au/catalog (the shipping modules are still not completed). You can do as mush testing from there as you want. Quote Link to comment Share on other sites More sharing options...
MoisesZaragoza Posted May 19, 2006 Share Posted May 19, 2006 Hmmm ... might have a helpful suggestion - a few posts up I was having trouble with this same line throwing an error and following Coopco's suggestion to look at ot_gv.php in /modules/order_total I checked the code and found no issues ...BUT I had not installed the Voucher part of the contrib, only the Coupon part - so I went into Admin and through to Order Total and ran the Install for Vouchers. That cured the error from line 175 - I realised that 175 was calling a global that hadn't been set . The bad news is that despite all this I still have to enter the coupon redeem code twice for any discount to show up in the shopping cart and product summary. Seem to have been all round the houses and back again. /modules/order_total/ot_gv.php I have <?php /* $Id: ot_gv.php,v 1.37.3 2004/01/01 12:52:59 Strider Exp $ $Id: ot_gv.php,v 1.4.2.12 2003/05/14 22:52:59 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License Added checkout layout mod */ class ot_gv { var $title, $output; function ot_gv() { $this->code = 'ot_gv'; $this->title = MODULE_ORDER_TOTAL_GV_TITLE; $this->header = MODULE_ORDER_TOTAL_GV_HEADER; $this->description = MODULE_ORDER_TOTAL_GV_DESCRIPTION; $this->user_prompt = MODULE_ORDER_TOTAL_GV_USER_PROMPT; $this->enabled = MODULE_ORDER_TOTAL_GV_STATUS; $this->sort_order = MODULE_ORDER_TOTAL_GV_SORT_ORDER; $this->include_shipping = MODULE_ORDER_TOTAL_GV_INC_SHIPPING; $this->include_tax = MODULE_ORDER_TOTAL_GV_INC_TAX; $this->calculate_tax = MODULE_ORDER_TOTAL_GV_CALC_TAX; $this->credit_tax = MODULE_ORDER_TOTAL_GV_CREDIT_TAX; $this->tax_class = MODULE_ORDER_TOTAL_GV_TAX_CLASS; $this->show_redeem_box = MODULE_ORDER_TOTAL_GV_REDEEM_BOX; $this->credit_class = true; // #################### Begin Added CGV JONYO ###################### // $this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="submitFunction()" name="' . 'c' . $this->code . '">'; $this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="clearRadeos()" name="' . 'c' . $this->code . '">'; // #################### End Added CGV JONYO ###################### $this->output = array(); } // #################### Begin Added CGV JONYO ###################### // #################### if you set it in admin to not include tax or shipping in the amount function process() { global $order, $currencies, $cot_gv; // if ($_SESSION['cot_gv']) { // old code Strider if (tep_session_is_registered('cot_gv')) { $order_total = $this->get_order_total(); $od_amount = $this->calculate_credit($order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($order_total, $od_amount, $this->calculate_tax); $od_amount = $this->calculate_credit($order_total); } $this->deduction = $od_amount; // if (($this->calculate_tax == "Credit Note") && (DISPLAY_PRICE_WITH_TAX != 'true')) { // $od_amount -= $tod_amount; // $order->info['total'] -= $tod_amount; // } $order->info['total'] = $order->info['total'] - $od_amount; if ($od_amount > 0) { $this->output[] = array('title' => $this->title . ':', 'text' => '<b>' . $currencies->format($od_amount) . '</b>', 'value' => $od_amount); } } } function mod_process() { global $currencies; $my_order_total = $this->get_order_total(); $my_od_amount = $this->calculate_credit($my_order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($my_order_total, $my_od_amount, $this->calculate_tax); $my_od_amount = $this->calculate_credit($my_order_total); } $this->deduction = $my_od_amount; //$order->info['total'] = $order->info['total'] - $my_od_amount; if ($my_od_amount > 0) { $this->my_output[] = array('title' => $this->title . ':', 'text' => '<b>' . $currencies->format($my_od_amount) . '</b>', 'value' => $my_od_amount); } } // #################### End Added CGV JONYO ###################### function selection_test() { global $customer_id; if ($this->user_has_gv_account($customer_id)) { return true; } else { return false; } } function pre_confirmation_check($order_total) { global $cot_gv, $order; // if ($_SESSION['cot_gv']) { // old code Strider $od_amount = 0; // set the default amount we will send back if (tep_session_is_registered('cot_gv')) { // pre confirmation check doesn't do a true order process. It just attempts to see if // there is enough to handle the order. But depending on settings it will not be shown // all of the order so this is why we do this runaround jane. What do we know so far. // nothing. Since we need to know if we process the full amount we need to call get order total // if there has been something before us then if ($this->include_tax == 'false') { $order_total = $order_total - $order->info['tax']; } if ($this->include_shipping == 'false') { $order_total = $order_total - $order->info['shipping_cost']; } $od_amount = $this->calculate_credit($order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($order_total, $od_amount, $this->calculate_tax); $od_amount = $this->calculate_credit($order_total)+$tod_amount; } } return $od_amount; } // original code /*function pre_confirmation_check($order_total) { if ($SESSION['cot_gv']) { $gv_payment_amount = $this->calculate_credit($order_total); } return $gv_payment_amount; } */ // #################### 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 ###################### function update_credit_account($i) { global $order, $customer_id, $insert_id, $REMOTE_ADDR; if (ereg('^GIFT', addslashes($order->products[$i]['model']))) { $gv_order_amount = ($order->products[$i]['final_price'] * $order->products[$i]['qty']); if ($this->credit_tax=='true') $gv_order_amount = $gv_order_amount * (100 + $order->products[$i]['tax']) / 100; // $gv_order_amount += 0.001; $gv_order_amount = $gv_order_amount * 100 / 100; if (MODULE_ORDER_TOTAL_GV_QUEUE == 'false') { // GV_QUEUE is true so release amount to account immediately $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $customer_gv = false; $total_gv_amount = 0; if ($gv_result = tep_db_fetch_array($gv_query)) { $total_gv_amount = $gv_result['amount']; $customer_gv = true; } $total_gv_amount = $total_gv_amount + $gv_order_amount; if ($customer_gv) { $gv_update=tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $customer_id . "'"); } else { $gv_insert=tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $total_gv_amount . "')"); } } else { // GV_QUEUE is true - so queue the gv for release by store owner $gv_insert=tep_db_query("insert into " . TABLE_COUPON_GV_QUEUE . " (customer_id, order_id, amount, date_created, ipaddr) values ('" . $customer_id . "', '" . $insert_id . "', '" . $gv_order_amount . "', NOW(), '" . $REMOTE_ADDR . "')"); } } } function credit_selection() { global $customer_id, $currencies, $language; $selection_string = ''; $gv_query = tep_db_query("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'"); if (tep_db_num_rows($gv_query)) { $selection_string .= '<tr>' . "\n"; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>'; $selection_string .= ' <td class="main">' . "\n"; $image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . DIR_WS_LANGUAGES . $language . '/images/buttons/button_redeem.gif" border="0" alt="' . IMAGE_REDEEM_VOUCHER . '" title = "' . IMAGE_REDEEM_VOUCHER . '">'; $selection_string .= TEXT_ENTER_GV_CODE . tep_draw_input_field('gv_redeem_code') . '</td>'; $selection_string .= ' <td align="right">' . $image_submit . '</td>'; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>'; $selection_string .= '</tr>' . "\n"; } return $selection_string; } function apply_credit() { global $order, $customer_id, $coupon_no, $cot_gv; if (tep_session_is_registered('cot_gv')) { $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 = $this->deduction; $gv_amount = $gv_result['amount'] - $gv_payment_amount; $gv_update = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $gv_amount . "' where customer_id = '" . $customer_id . "'"); } return $gv_payment_amount; } function collect_posts() { // Security Update + $cot_gv added in Global in v5.13 by Rigadin + updated URL parameters of all tep_redirect function called inside this function global $currencies, $HTTP_POST_VARS, $customer_id, $coupon_no, $REMOTE_ADDR, $cot_gv; if ($HTTP_POST_VARS['gv_redeem_code']) { // Security update by Rigadin in v5.13: add slashes in front of user input $gv_query = tep_db_query("select coupon_id, coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code = '" . tep_db_input($HTTP_POST_VARS['gv_redeem_code']) . "'"); $gv_result = tep_db_fetch_array($gv_query); if (tep_db_num_rows($gv_query) != 0) { $redeem_query = tep_db_query("select * from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result['coupon_id'] . "'"); if ( (tep_db_num_rows($redeem_query) != 0) && ($gv_result['coupon_type'] == 'G') ) { // error, this coupon has been redeemed already. tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), 'SSL')); } } // Next line added by Rigadin in v5.13 to give an error when unknown code entered elseif ($HTTP_POST_VARS['submit_redeem_x']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), 'SSL')); if ($gv_result['coupon_type'] == 'G') { $gv_amount = $gv_result['coupon_amount']; // Things to set // ip address of claimant // customer id of claimant // date // redemption flag // now update customer account with gv_amount $gv_amount_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $customer_gv = false; $total_gv_amount = $gv_amount; if ($gv_amount_result = tep_db_fetch_array($gv_amount_query)) { $total_gv_amount = $gv_amount_result['amount'] + $gv_amount; $customer_gv = true; } $gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_result['coupon_id'] . "'"); $gv_redeem = tep_db_query("insert into " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_result['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')"); if ($customer_gv) { // already has gv_amount so update $gv_update = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $customer_id . "'"); } else { // no gv_amount so insert $gv_insert = tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $total_gv_amount . "')"); } tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT. $currencies->format($gv_amount)), 'SSL')); } } // v5.13a Generates an error if redeem button pressed without code entered if ($HTTP_POST_VARS['submit_redeem_x'] && !$HTTP_POST_VARS['gv_redeem_code']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL')); } function calculate_credit($amount) { global $customer_id, $order; $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']; $gv_amount = $gv_payment_amount; $save_total_cost = $amount; $full_cost = $save_total_cost - $gv_payment_amount; if ($full_cost <= 0) { $full_cost = 0; $gv_payment_amount = $save_total_cost; } return tep_round($gv_payment_amount,2); } function calculate_tax_deduction($amount, $od_amount, $method) { global $order; switch ($method) { case 'Standard': // Amended line, was giving an error when a zero value was arriving here. v5.13 by Rigadin // v5.13 spelling error introduced an error, corrected //$ratio1 = tep_round($od_amount / $amount,2); $ratio1= ($amount==0? 0 : tep_round($od_amount / $amount,2) ); $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $tax_rate = tep_get_tax_rate_from_desc($key); $total_net += $tax_rate * $order->info['tax_groups'][$key]; } if ($od_amount > $total_net) $od_amount = $total_net; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $tax_rate = tep_get_tax_rate_from_desc($key); $net = $tax_rate * $order->info['tax_groups'][$key]; if ($net > 0) { $god_amount = $order->info['tax_groups'][$key] * $ratio1; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } $order->info['tax'] -= $tod_amount; $order->info['total'] -= $tod_amount; break; case 'Credit Note': $tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tod_amount = $this->deduction / (100 + $tax_rate)* $tax_rate; $order->info['tax_groups'][$tax_desc] -= $tod_amount; // $order->info['total'] -= $tod_amount; //// ????? Strider break; default: } return $tod_amount; } function user_has_gv_account($c_id) { $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $c_id . "'"); if ($gv_result = tep_db_fetch_array($gv_query)) { if ($gv_result['amount']>0) { return true; } } return false; } function get_order_total() { global $order; $order_total = $order->info['total']; if ($this->include_tax == 'false') $order_total = $order_total - $order->info['tax']; if ($this->include_shipping == 'false') $order_total = $order_total - $order->info['shipping_cost']; return $order_total; } // START added by Rigadin in v5.13, needed to show module errors on checkout_payment page function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_ORDER_TOTAL_GV_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } // END added by Rigadin function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_GV_STATUS'"); $this->check = tep_db_num_rows($check_query); } return $this->check; } function keys() { return array('MODULE_ORDER_TOTAL_GV_STATUS', 'MODULE_ORDER_TOTAL_GV_SORT_ORDER', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'MODULE_ORDER_TOTAL_GV_CALC_TAX', 'MODULE_ORDER_TOTAL_GV_TAX_CLASS', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Affichage', 'MODULE_ORDER_TOTAL_GV_STATUS', 'true', 'Voulez-vous autoriser l\'affichage de la remise pour les chèques cadeaux ?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Ordre de tri', 'MODULE_ORDER_TOTAL_GV_SORT_ORDER', '740', 'Ordre de tri pour l\'affichage (Le plus petit nombre est montrer en premier).<br>', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Chèques en attente', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'true', 'Voulez-vous mettre les chèques en attente de validation ?', '6', '3','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Livraison', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'true', 'Voulez-vous inclure la livraison dans le caclule ?', '6', '5', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Taxe', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'true', 'Voulez-vous inclure la taxe dans le calcule ?', '6', '6','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Mode de calcule', 'MODULE_ORDER_TOTAL_GV_CALC_TAX', 'None', 'Quel mode utiliser pour recalculer la taxe ?', '6', '7','tep_cfg_select_option(array(\'None\', \'Standard\', \'Credit Note\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Type de Taxe', 'MODULE_ORDER_TOTAL_GV_TAX_CLASS', '0', 'Quel type de taxe voulez-vous utiliser pour les coupons de réduction ?<br>', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Inclure taxe', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX', 'false', 'Voulez-vous ajouter la taxe sur le chèque cadeau ?', '6', '8','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?> I belive that i dont have any errors Quote at the end of the day the code will be good Link to comment Share on other sites More sharing options...
MoisesZaragoza Posted May 19, 2006 Share Posted May 19, 2006 Hmmm ... might have a helpful suggestion - a few posts up I was having trouble with this same line throwing an error and following Coopco's suggestion to look at ot_gv.php in /modules/order_total I checked the code and found no issues ...BUT I had not installed the Voucher part of the contrib, only the Coupon part - so I went into Admin and through to Order Total and ran the Install for Vouchers. That cured the error from line 175 - I realised that 175 was calling a global that hadn't been set . The bad news is that despite all this I still have to enter the coupon redeem code twice for any discount to show up in the shopping cart and product summary. Seem to have been all round the houses and back again. /modules/order_total/ot_gv.php I have <?php /* $Id: ot_gv.php,v 1.37.3 2004/01/01 12:52:59 Strider Exp $ $Id: ot_gv.php,v 1.4.2.12 2003/05/14 22:52:59 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License Added checkout layout mod */ class ot_gv { var $title, $output; function ot_gv() { $this->code = 'ot_gv'; $this->title = MODULE_ORDER_TOTAL_GV_TITLE; $this->header = MODULE_ORDER_TOTAL_GV_HEADER; $this->description = MODULE_ORDER_TOTAL_GV_DESCRIPTION; $this->user_prompt = MODULE_ORDER_TOTAL_GV_USER_PROMPT; $this->enabled = MODULE_ORDER_TOTAL_GV_STATUS; $this->sort_order = MODULE_ORDER_TOTAL_GV_SORT_ORDER; $this->include_shipping = MODULE_ORDER_TOTAL_GV_INC_SHIPPING; $this->include_tax = MODULE_ORDER_TOTAL_GV_INC_TAX; $this->calculate_tax = MODULE_ORDER_TOTAL_GV_CALC_TAX; $this->credit_tax = MODULE_ORDER_TOTAL_GV_CREDIT_TAX; $this->tax_class = MODULE_ORDER_TOTAL_GV_TAX_CLASS; $this->show_redeem_box = MODULE_ORDER_TOTAL_GV_REDEEM_BOX; $this->credit_class = true; // #################### Begin Added CGV JONYO ###################### // $this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="submitFunction()" name="' . 'c' . $this->code . '">'; $this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="clearRadeos()" name="' . 'c' . $this->code . '">'; // #################### End Added CGV JONYO ###################### $this->output = array(); } // #################### Begin Added CGV JONYO ###################### // #################### if you set it in admin to not include tax or shipping in the amount function process() { global $order, $currencies, $cot_gv; // if ($_SESSION['cot_gv']) { // old code Strider if (tep_session_is_registered('cot_gv')) { $order_total = $this->get_order_total(); $od_amount = $this->calculate_credit($order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($order_total, $od_amount, $this->calculate_tax); $od_amount = $this->calculate_credit($order_total); } $this->deduction = $od_amount; // if (($this->calculate_tax == "Credit Note") && (DISPLAY_PRICE_WITH_TAX != 'true')) { // $od_amount -= $tod_amount; // $order->info['total'] -= $tod_amount; // } $order->info['total'] = $order->info['total'] - $od_amount; if ($od_amount > 0) { $this->output[] = array('title' => $this->title . ':', 'text' => '<b>' . $currencies->format($od_amount) . '</b>', 'value' => $od_amount); } } } function mod_process() { global $currencies; $my_order_total = $this->get_order_total(); $my_od_amount = $this->calculate_credit($my_order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($my_order_total, $my_od_amount, $this->calculate_tax); $my_od_amount = $this->calculate_credit($my_order_total); } $this->deduction = $my_od_amount; //$order->info['total'] = $order->info['total'] - $my_od_amount; if ($my_od_amount > 0) { $this->my_output[] = array('title' => $this->title . ':', 'text' => '<b>' . $currencies->format($my_od_amount) . '</b>', 'value' => $my_od_amount); } } // #################### End Added CGV JONYO ###################### function selection_test() { global $customer_id; if ($this->user_has_gv_account($customer_id)) { return true; } else { return false; } } function pre_confirmation_check($order_total) { global $cot_gv, $order; // if ($_SESSION['cot_gv']) { // old code Strider $od_amount = 0; // set the default amount we will send back if (tep_session_is_registered('cot_gv')) { // pre confirmation check doesn't do a true order process. It just attempts to see if // there is enough to handle the order. But depending on settings it will not be shown // all of the order so this is why we do this runaround jane. What do we know so far. // nothing. Since we need to know if we process the full amount we need to call get order total // if there has been something before us then if ($this->include_tax == 'false') { $order_total = $order_total - $order->info['tax']; } if ($this->include_shipping == 'false') { $order_total = $order_total - $order->info['shipping_cost']; } $od_amount = $this->calculate_credit($order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($order_total, $od_amount, $this->calculate_tax); $od_amount = $this->calculate_credit($order_total)+$tod_amount; } } return $od_amount; } // original code /*function pre_confirmation_check($order_total) { if ($SESSION['cot_gv']) { $gv_payment_amount = $this->calculate_credit($order_total); } return $gv_payment_amount; } */ // #################### 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 ###################### function update_credit_account($i) { global $order, $customer_id, $insert_id, $REMOTE_ADDR; if (ereg('^GIFT', addslashes($order->products[$i]['model']))) { $gv_order_amount = ($order->products[$i]['final_price'] * $order->products[$i]['qty']); if ($this->credit_tax=='true') $gv_order_amount = $gv_order_amount * (100 + $order->products[$i]['tax']) / 100; // $gv_order_amount += 0.001; $gv_order_amount = $gv_order_amount * 100 / 100; if (MODULE_ORDER_TOTAL_GV_QUEUE == 'false') { // GV_QUEUE is true so release amount to account immediately $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $customer_gv = false; $total_gv_amount = 0; if ($gv_result = tep_db_fetch_array($gv_query)) { $total_gv_amount = $gv_result['amount']; $customer_gv = true; } $total_gv_amount = $total_gv_amount + $gv_order_amount; if ($customer_gv) { $gv_update=tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $customer_id . "'"); } else { $gv_insert=tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $total_gv_amount . "')"); } } else { // GV_QUEUE is true - so queue the gv for release by store owner $gv_insert=tep_db_query("insert into " . TABLE_COUPON_GV_QUEUE . " (customer_id, order_id, amount, date_created, ipaddr) values ('" . $customer_id . "', '" . $insert_id . "', '" . $gv_order_amount . "', NOW(), '" . $REMOTE_ADDR . "')"); } } } function credit_selection() { global $customer_id, $currencies, $language; $selection_string = ''; $gv_query = tep_db_query("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'"); if (tep_db_num_rows($gv_query)) { $selection_string .= '<tr>' . "\n"; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>'; $selection_string .= ' <td class="main">' . "\n"; $image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . DIR_WS_LANGUAGES . $language . '/images/buttons/button_redeem.gif" border="0" alt="' . IMAGE_REDEEM_VOUCHER . '" title = "' . IMAGE_REDEEM_VOUCHER . '">'; $selection_string .= TEXT_ENTER_GV_CODE . tep_draw_input_field('gv_redeem_code') . '</td>'; $selection_string .= ' <td align="right">' . $image_submit . '</td>'; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>'; $selection_string .= '</tr>' . "\n"; } return $selection_string; } function apply_credit() { global $order, $customer_id, $coupon_no, $cot_gv; if (tep_session_is_registered('cot_gv')) { $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 = $this->deduction; $gv_amount = $gv_result['amount'] - $gv_payment_amount; $gv_update = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $gv_amount . "' where customer_id = '" . $customer_id . "'"); } return $gv_payment_amount; } function collect_posts() { // Security Update + $cot_gv added in Global in v5.13 by Rigadin + updated URL parameters of all tep_redirect function called inside this function global $currencies, $HTTP_POST_VARS, $customer_id, $coupon_no, $REMOTE_ADDR, $cot_gv; if ($HTTP_POST_VARS['gv_redeem_code']) { // Security update by Rigadin in v5.13: add slashes in front of user input $gv_query = tep_db_query("select coupon_id, coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code = '" . tep_db_input($HTTP_POST_VARS['gv_redeem_code']) . "'"); $gv_result = tep_db_fetch_array($gv_query); if (tep_db_num_rows($gv_query) != 0) { $redeem_query = tep_db_query("select * from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result['coupon_id'] . "'"); if ( (tep_db_num_rows($redeem_query) != 0) && ($gv_result['coupon_type'] == 'G') ) { // error, this coupon has been redeemed already. tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), 'SSL')); } } // Next line added by Rigadin in v5.13 to give an error when unknown code entered elseif ($HTTP_POST_VARS['submit_redeem_x']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), 'SSL')); if ($gv_result['coupon_type'] == 'G') { $gv_amount = $gv_result['coupon_amount']; // Things to set // ip address of claimant // customer id of claimant // date // redemption flag // now update customer account with gv_amount $gv_amount_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $customer_gv = false; $total_gv_amount = $gv_amount; if ($gv_amount_result = tep_db_fetch_array($gv_amount_query)) { $total_gv_amount = $gv_amount_result['amount'] + $gv_amount; $customer_gv = true; } $gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_result['coupon_id'] . "'"); $gv_redeem = tep_db_query("insert into " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_result['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')"); if ($customer_gv) { // already has gv_amount so update $gv_update = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $customer_id . "'"); } else { // no gv_amount so insert $gv_insert = tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $total_gv_amount . "')"); } tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT. $currencies->format($gv_amount)), 'SSL')); } } // v5.13a Generates an error if redeem button pressed without code entered if ($HTTP_POST_VARS['submit_redeem_x'] && !$HTTP_POST_VARS['gv_redeem_code']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL')); } function calculate_credit($amount) { global $customer_id, $order; $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']; $gv_amount = $gv_payment_amount; $save_total_cost = $amount; $full_cost = $save_total_cost - $gv_payment_amount; if ($full_cost <= 0) { $full_cost = 0; $gv_payment_amount = $save_total_cost; } return tep_round($gv_payment_amount,2); } function calculate_tax_deduction($amount, $od_amount, $method) { global $order; switch ($method) { case 'Standard': // Amended line, was giving an error when a zero value was arriving here. v5.13 by Rigadin // v5.13 spelling error introduced an error, corrected //$ratio1 = tep_round($od_amount / $amount,2); $ratio1= ($amount==0? 0 : tep_round($od_amount / $amount,2) ); $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $tax_rate = tep_get_tax_rate_from_desc($key); $total_net += $tax_rate * $order->info['tax_groups'][$key]; } if ($od_amount > $total_net) $od_amount = $total_net; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $tax_rate = tep_get_tax_rate_from_desc($key); $net = $tax_rate * $order->info['tax_groups'][$key]; if ($net > 0) { $god_amount = $order->info['tax_groups'][$key] * $ratio1; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } $order->info['tax'] -= $tod_amount; $order->info['total'] -= $tod_amount; break; case 'Credit Note': $tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tod_amount = $this->deduction / (100 + $tax_rate)* $tax_rate; $order->info['tax_groups'][$tax_desc] -= $tod_amount; // $order->info['total'] -= $tod_amount; //// ????? Strider break; default: } return $tod_amount; } function user_has_gv_account($c_id) { $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $c_id . "'"); if ($gv_result = tep_db_fetch_array($gv_query)) { if ($gv_result['amount']>0) { return true; } } return false; } function get_order_total() { global $order; $order_total = $order->info['total']; if ($this->include_tax == 'false') $order_total = $order_total - $order->info['tax']; if ($this->include_shipping == 'false') $order_total = $order_total - $order->info['shipping_cost']; return $order_total; } // START added by Rigadin in v5.13, needed to show module errors on checkout_payment page function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_ORDER_TOTAL_GV_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } // END added by Rigadin function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_GV_STATUS'"); $this->check = tep_db_num_rows($check_query); } return $this->check; } function keys() { return array('MODULE_ORDER_TOTAL_GV_STATUS', 'MODULE_ORDER_TOTAL_GV_SORT_ORDER', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'MODULE_ORDER_TOTAL_GV_CALC_TAX', 'MODULE_ORDER_TOTAL_GV_TAX_CLASS', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Affichage', 'MODULE_ORDER_TOTAL_GV_STATUS', 'true', 'Voulez-vous autoriser l\'affichage de la remise pour les chèques cadeaux ?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Ordre de tri', 'MODULE_ORDER_TOTAL_GV_SORT_ORDER', '740', 'Ordre de tri pour l\'affichage (Le plus petit nombre est montrer en premier).<br>', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Chèques en attente', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'true', 'Voulez-vous mettre les chèques en attente de validation ?', '6', '3','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Livraison', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'true', 'Voulez-vous inclure la livraison dans le caclule ?', '6', '5', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Taxe', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'true', 'Voulez-vous inclure la taxe dans le calcule ?', '6', '6','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Mode de calcule', 'MODULE_ORDER_TOTAL_GV_CALC_TAX', 'None', 'Quel mode utiliser pour recalculer la taxe ?', '6', '7','tep_cfg_select_option(array(\'None\', \'Standard\', \'Credit Note\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Type de Taxe', 'MODULE_ORDER_TOTAL_GV_TAX_CLASS', '0', 'Quel type de taxe voulez-vous utiliser pour les coupons de réduction ?<br>', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Inclure taxe', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX', 'false', 'Voulez-vous ajouter la taxe sur le chèque cadeau ?', '6', '8','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?> I belive that i dont have any errors Quote at the end of the day the code will be good Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 /modules/order_total/ot_gv.php I have <?php /* $Id: ot_gv.php,v 1.37.3 2004/01/01 12:52:59 Strider Exp $ $Id: ot_gv.php,v 1.4.2.12 2003/05/14 22:52:59 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License Added checkout layout mod */ class ot_gv { var $title, $output; function ot_gv() { $this->code = 'ot_gv'; $this->title = MODULE_ORDER_TOTAL_GV_TITLE; $this->header = MODULE_ORDER_TOTAL_GV_HEADER; $this->description = MODULE_ORDER_TOTAL_GV_DESCRIPTION; $this->user_prompt = MODULE_ORDER_TOTAL_GV_USER_PROMPT; $this->enabled = MODULE_ORDER_TOTAL_GV_STATUS; $this->sort_order = MODULE_ORDER_TOTAL_GV_SORT_ORDER; $this->include_shipping = MODULE_ORDER_TOTAL_GV_INC_SHIPPING; $this->include_tax = MODULE_ORDER_TOTAL_GV_INC_TAX; $this->calculate_tax = MODULE_ORDER_TOTAL_GV_CALC_TAX; $this->credit_tax = MODULE_ORDER_TOTAL_GV_CREDIT_TAX; $this->tax_class = MODULE_ORDER_TOTAL_GV_TAX_CLASS; $this->show_redeem_box = MODULE_ORDER_TOTAL_GV_REDEEM_BOX; $this->credit_class = true; // #################### Begin Added CGV JONYO ###################### // $this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="submitFunction()" name="' . 'c' . $this->code . '">'; $this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="clearRadeos()" name="' . 'c' . $this->code . '">'; // #################### End Added CGV JONYO ###################### $this->output = array(); } // #################### Begin Added CGV JONYO ###################### // #################### if you set it in admin to not include tax or shipping in the amount function process() { global $order, $currencies, $cot_gv; // if ($_SESSION['cot_gv']) { // old code Strider if (tep_session_is_registered('cot_gv')) { $order_total = $this->get_order_total(); $od_amount = $this->calculate_credit($order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($order_total, $od_amount, $this->calculate_tax); $od_amount = $this->calculate_credit($order_total); } $this->deduction = $od_amount; // if (($this->calculate_tax == "Credit Note") && (DISPLAY_PRICE_WITH_TAX != 'true')) { // $od_amount -= $tod_amount; // $order->info['total'] -= $tod_amount; // } $order->info['total'] = $order->info['total'] - $od_amount; if ($od_amount > 0) { $this->output[] = array('title' => $this->title . ':', 'text' => '<b>' . $currencies->format($od_amount) . '</b>', 'value' => $od_amount); } } } function mod_process() { global $currencies; $my_order_total = $this->get_order_total(); $my_od_amount = $this->calculate_credit($my_order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($my_order_total, $my_od_amount, $this->calculate_tax); $my_od_amount = $this->calculate_credit($my_order_total); } $this->deduction = $my_od_amount; //$order->info['total'] = $order->info['total'] - $my_od_amount; if ($my_od_amount > 0) { $this->my_output[] = array('title' => $this->title . ':', 'text' => '<b>' . $currencies->format($my_od_amount) . '</b>', 'value' => $my_od_amount); } } // #################### End Added CGV JONYO ###################### function selection_test() { global $customer_id; if ($this->user_has_gv_account($customer_id)) { return true; } else { return false; } } function pre_confirmation_check($order_total) { global $cot_gv, $order; // if ($_SESSION['cot_gv']) { // old code Strider $od_amount = 0; // set the default amount we will send back if (tep_session_is_registered('cot_gv')) { // pre confirmation check doesn't do a true order process. It just attempts to see if // there is enough to handle the order. But depending on settings it will not be shown // all of the order so this is why we do this runaround jane. What do we know so far. // nothing. Since we need to know if we process the full amount we need to call get order total // if there has been something before us then if ($this->include_tax == 'false') { $order_total = $order_total - $order->info['tax']; } if ($this->include_shipping == 'false') { $order_total = $order_total - $order->info['shipping_cost']; } $od_amount = $this->calculate_credit($order_total); if ($this->calculate_tax != "None") { $tod_amount = $this->calculate_tax_deduction($order_total, $od_amount, $this->calculate_tax); $od_amount = $this->calculate_credit($order_total)+$tod_amount; } } return $od_amount; } // original code /*function pre_confirmation_check($order_total) { if ($SESSION['cot_gv']) { $gv_payment_amount = $this->calculate_credit($order_total); } return $gv_payment_amount; } */ // #################### 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 ###################### function update_credit_account($i) { global $order, $customer_id, $insert_id, $REMOTE_ADDR; if (ereg('^GIFT', addslashes($order->products[$i]['model']))) { $gv_order_amount = ($order->products[$i]['final_price'] * $order->products[$i]['qty']); if ($this->credit_tax=='true') $gv_order_amount = $gv_order_amount * (100 + $order->products[$i]['tax']) / 100; // $gv_order_amount += 0.001; $gv_order_amount = $gv_order_amount * 100 / 100; if (MODULE_ORDER_TOTAL_GV_QUEUE == 'false') { // GV_QUEUE is true so release amount to account immediately $gv_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $customer_gv = false; $total_gv_amount = 0; if ($gv_result = tep_db_fetch_array($gv_query)) { $total_gv_amount = $gv_result['amount']; $customer_gv = true; } $total_gv_amount = $total_gv_amount + $gv_order_amount; if ($customer_gv) { $gv_update=tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $customer_id . "'"); } else { $gv_insert=tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $total_gv_amount . "')"); } } else { // GV_QUEUE is true - so queue the gv for release by store owner $gv_insert=tep_db_query("insert into " . TABLE_COUPON_GV_QUEUE . " (customer_id, order_id, amount, date_created, ipaddr) values ('" . $customer_id . "', '" . $insert_id . "', '" . $gv_order_amount . "', NOW(), '" . $REMOTE_ADDR . "')"); } } } function credit_selection() { global $customer_id, $currencies, $language; $selection_string = ''; $gv_query = tep_db_query("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'"); if (tep_db_num_rows($gv_query)) { $selection_string .= '<tr>' . "\n"; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>'; $selection_string .= ' <td class="main">' . "\n"; $image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . DIR_WS_LANGUAGES . $language . '/images/buttons/button_redeem.gif" border="0" alt="' . IMAGE_REDEEM_VOUCHER . '" title = "' . IMAGE_REDEEM_VOUCHER . '">'; $selection_string .= TEXT_ENTER_GV_CODE . tep_draw_input_field('gv_redeem_code') . '</td>'; $selection_string .= ' <td align="right">' . $image_submit . '</td>'; $selection_string .= ' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>'; $selection_string .= '</tr>' . "\n"; } return $selection_string; } function apply_credit() { global $order, $customer_id, $coupon_no, $cot_gv; if (tep_session_is_registered('cot_gv')) { $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 = $this->deduction; $gv_amount = $gv_result['amount'] - $gv_payment_amount; $gv_update = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $gv_amount . "' where customer_id = '" . $customer_id . "'"); } return $gv_payment_amount; } function collect_posts() { // Security Update + $cot_gv added in Global in v5.13 by Rigadin + updated URL parameters of all tep_redirect function called inside this function global $currencies, $HTTP_POST_VARS, $customer_id, $coupon_no, $REMOTE_ADDR, $cot_gv; if ($HTTP_POST_VARS['gv_redeem_code']) { // Security update by Rigadin in v5.13: add slashes in front of user input $gv_query = tep_db_query("select coupon_id, coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code = '" . tep_db_input($HTTP_POST_VARS['gv_redeem_code']) . "'"); $gv_result = tep_db_fetch_array($gv_query); if (tep_db_num_rows($gv_query) != 0) { $redeem_query = tep_db_query("select * from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result['coupon_id'] . "'"); if ( (tep_db_num_rows($redeem_query) != 0) && ($gv_result['coupon_type'] == 'G') ) { // error, this coupon has been redeemed already. tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), 'SSL')); } } // Next line added by Rigadin in v5.13 to give an error when unknown code entered elseif ($HTTP_POST_VARS['submit_redeem_x']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), 'SSL')); if ($gv_result['coupon_type'] == 'G') { $gv_amount = $gv_result['coupon_amount']; // Things to set // ip address of claimant // customer id of claimant // date // redemption flag // now update customer account with gv_amount $gv_amount_query=tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'"); $customer_gv = false; $total_gv_amount = $gv_amount; if ($gv_amount_result = tep_db_fetch_array($gv_amount_query)) { $total_gv_amount = $gv_amount_result['amount'] + $gv_amount; $customer_gv = true; } $gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_result['coupon_id'] . "'"); $gv_redeem = tep_db_query("insert into " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_result['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')"); if ($customer_gv) { // already has gv_amount so update $gv_update = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $customer_id . "'"); } else { // no gv_amount so insert $gv_insert = tep_db_query("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $customer_id . "', '" . $total_gv_amount . "')"); } tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_REDEEMED_AMOUNT. $currencies->format($gv_amount)), 'SSL')); } } // v5.13a Generates an error if redeem button pressed without code entered if ($HTTP_POST_VARS['submit_redeem_x'] && !$HTTP_POST_VARS['gv_redeem_code']) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL')); } function calculate_credit($amount) { global $customer_id, $order; $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']; $gv_amount = $gv_payment_amount; $save_total_cost = $amount; $full_cost = $save_total_cost - $gv_payment_amount; if ($full_cost <= 0) { $full_cost = 0; $gv_payment_amount = $save_total_cost; } return tep_round($gv_payment_amount,2); } function calculate_tax_deduction($amount, $od_amount, $method) { global $order; switch ($method) { case 'Standard': // Amended line, was giving an error when a zero value was arriving here. v5.13 by Rigadin // v5.13 spelling error introduced an error, corrected //$ratio1 = tep_round($od_amount / $amount,2); $ratio1= ($amount==0? 0 : tep_round($od_amount / $amount,2) ); $tod_amount = 0; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $tax_rate = tep_get_tax_rate_from_desc($key); $total_net += $tax_rate * $order->info['tax_groups'][$key]; } if ($od_amount > $total_net) $od_amount = $total_net; reset($order->info['tax_groups']); while (list($key, $value) = each($order->info['tax_groups'])) { $tax_rate = tep_get_tax_rate_from_desc($key); $net = $tax_rate * $order->info['tax_groups'][$key]; if ($net > 0) { $god_amount = $order->info['tax_groups'][$key] * $ratio1; $tod_amount += $god_amount; $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount; } } $order->info['tax'] -= $tod_amount; $order->info['total'] -= $tod_amount; break; case 'Credit Note': $tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); $tod_amount = $this->deduction / (100 + $tax_rate)* $tax_rate; $order->info['tax_groups'][$tax_desc] -= $tod_amount; // $order->info['total'] -= $tod_amount; //// ????? Strider break; default: } return $tod_amount; } function user_has_gv_account($c_id) { $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $c_id . "'"); if ($gv_result = tep_db_fetch_array($gv_query)) { if ($gv_result['amount']>0) { return true; } } return false; } function get_order_total() { global $order; $order_total = $order->info['total']; if ($this->include_tax == 'false') $order_total = $order_total - $order->info['tax']; if ($this->include_shipping == 'false') $order_total = $order_total - $order->info['shipping_cost']; return $order_total; } // START added by Rigadin in v5.13, needed to show module errors on checkout_payment page function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_ORDER_TOTAL_GV_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } // END added by Rigadin function check() { if (!isset($this->check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_GV_STATUS'"); $this->check = tep_db_num_rows($check_query); } return $this->check; } function keys() { return array('MODULE_ORDER_TOTAL_GV_STATUS', 'MODULE_ORDER_TOTAL_GV_SORT_ORDER', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'MODULE_ORDER_TOTAL_GV_CALC_TAX', 'MODULE_ORDER_TOTAL_GV_TAX_CLASS', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Affichage', 'MODULE_ORDER_TOTAL_GV_STATUS', 'true', 'Voulez-vous autoriser l\'affichage de la remise pour les chèques cadeaux ?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Ordre de tri', 'MODULE_ORDER_TOTAL_GV_SORT_ORDER', '740', 'Ordre de tri pour l\'affichage (Le plus petit nombre est montrer en premier).<br>', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Chèques en attente', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'true', 'Voulez-vous mettre les chèques en attente de validation ?', '6', '3','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Livraison', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'true', 'Voulez-vous inclure la livraison dans le caclule ?', '6', '5', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Taxe', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'true', 'Voulez-vous inclure la taxe dans le calcule ?', '6', '6','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Mode de calcule', 'MODULE_ORDER_TOTAL_GV_CALC_TAX', 'None', 'Quel mode utiliser pour recalculer la taxe ?', '6', '7','tep_cfg_select_option(array(\'None\', \'Standard\', \'Credit Note\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Type de Taxe', 'MODULE_ORDER_TOTAL_GV_TAX_CLASS', '0', 'Quel type de taxe voulez-vous utiliser pour les coupons de réduction ?<br>', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Inclure taxe', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX', 'false', 'Voulez-vous ajouter la taxe sur le chèque cadeau ?', '6', '8','tep_cfg_select_option(array(\'true\', \'false\'), ', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?> I belive that i dont have any errors Keith was saying to enable BOTH coupons and vouchers in your admin. Quote Link to comment Share on other sites More sharing options...
MoisesZaragoza Posted May 19, 2006 Share Posted May 19, 2006 OK, then in catalog/includes/classes/payment.php do you have @call_user_method('update_status', $GLOBALS[$this->selected_module]); } } } } // #################### 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.checked) {' . "\n" . ' payment_value = document.checkout_payment.payment.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 ###################### function selection() { $selection_array = array(); THat's is exacly the coode that i hace Quote at the end of the day the code will be good Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 THat's is exacly the coode that i hace OK, following Keith's suggestion, do you have BOTH coupons and vouchers installed in the admin of your store? Quote Link to comment Share on other sites More sharing options...
bry21317 Posted May 19, 2006 Share Posted May 19, 2006 Ok, Now I found another issue. Just went to do as stated a few posts back by enabling the Coupons and Gift Vouchers. I found that when I go into Admin, click on Modules, Order Totals, I get the following errors. It seems that I need to install something else, to make this work, I am guessing? Warning: main(/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_coupon.php): failed to open stream: No such file or directory in /home/u2/bry21317/html/osc/admin/modules.php on line 128 Warning: main(): Failed opening '/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_coupon.php' for inclusion (include_path='.:') in /home/u2/bry21317/html/osc/admin/modules.php on line 128 MODULE_ORDER_TOTAL_COUPON_TITLE Warning: main(/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_gv.php): failed to open stream: No such file or directory in /home/u2/bry21317/html/osc/admin/modules.php on line 128 Warning: main(): Failed opening '/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_gv.php' for inclusion (include_path='.:') in /home/u2/bry21317/html/osc/admin/modules.php on line 128 I looked and I do have a file called modules.php under Admin. I don't see any changes that I need to make to this, can you tell me where I find the changes? I also don't see this in the package I downloaded for the CCGV 5.15A. Thanks, Bryan Quote Link to comment Share on other sites More sharing options...
MoisesZaragoza Posted May 19, 2006 Share Posted May 19, 2006 OK, following Keith's suggestion, do you have BOTH coupons and vouchers installed in the admin of your store? Ok in the admin I see a box that say :Vouchers/Coupons that has 4 liks Coupon Admin Gift Voucher Queue Mail Gift Voucher Gift Vouchers sent I have a Discount Coupons and I have a Gift Voucher's Sent I will re Up Load the addmin files that you sent me Quote at the end of the day the code will be good Link to comment Share on other sites More sharing options...
bry21317 Posted May 19, 2006 Share Posted May 19, 2006 Ok, Disregard the Error in Admin control panel. I just found I was missing 2 files in the Languages directory. I now fixed that. I still can't get past this error though. Thanks, Bryan Fatal error: Call to undefined function: clear_posts() in /home/u2/bry21317/html/osc/checkout_payment.php on line 89 Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 Ok,Now I found another issue. Just went to do as stated a few posts back by enabling the Coupons and Gift Vouchers. I found that when I go into Admin, click on Modules, Order Totals, I get the following errors. It seems that I need to install something else, to make this work, I am guessing? Warning: main(/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_coupon.php): failed to open stream: No such file or directory in /home/u2/bry21317/html/osc/admin/modules.php on line 128 Warning: main(): Failed opening '/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_coupon.php' for inclusion (include_path='.:') in /home/u2/bry21317/html/osc/admin/modules.php on line 128 MODULE_ORDER_TOTAL_COUPON_TITLE Warning: main(/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_gv.php): failed to open stream: No such file or directory in /home/u2/bry21317/html/osc/admin/modules.php on line 128 Warning: main(): Failed opening '/home/com/karaoke-computers/html/osc/includes/languages/english/modules/order_total/ot_gv.php' for inclusion (include_path='.:') in /home/u2/bry21317/html/osc/admin/modules.php on line 128 I looked and I do have a file called modules.php under Admin. I don't see any changes that I need to make to this, can you tell me where I find the changes? I also don't see this in the package I downloaded for the CCGV 5.15A. Thanks, Bryan I agree that no changes were made to admin/modules.php. Did you ftp the admin changed/ new files correctly? Some stores have catalog and admin in the root directory, some have root/catalog/admin, some have root/ admin and catalog files. The root directory is usually your domain name. Quote Link to comment Share on other sites More sharing options...
bry21317 Posted May 19, 2006 Share Posted May 19, 2006 Coopco, I was missing two files in the Languages\English\Modules\order_total folder. I have checked back through all the files, and I now have all the files on the site. I just can't get past this error: Fatal error: Call to undefined function: clear_posts() in /home/u2/bry21317/html/osc/checkout_payment.php on line 89 Any other Ideas, or did you look at my checkout_payment.php file, that I posted a few posts back? Thanks for all the help. Bryan Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 Coopco,I was missing two files in the Languages\English\Modules\order_total folder. I have checked back through all the files, and I now have all the files on the site. I just can't get past this error: Fatal error: Call to undefined function: clear_posts() in /home/u2/bry21317/html/osc/checkout_payment.php on line 89 Any other Ideas, or did you look at my checkout_payment.php file, that I posted a few posts back? Thanks for all the help. Bryan Sorry Bryan I did miss the post. Mine says function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } <?php // #################### Begin Added CGV JONYO ###################### ?> <?php if (MODULE_ORDER_TOTAL_INSTALLED) $temp=$order_total_modules->process(); $temp=$temp[count($temp)-1]; $temp=$temp['value']; $testing= $GLOBALS['ot_gv']->mod_process(); $testing=$GLOBALS['ot_gv']->my_output[0]; $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); echo "// temp1 = " . $temp['value'] . "\n"; echo "// temp2 = " . $temp . "\n"; echo "// gvresult = " . $gv_result['amount'] . "\n"; if ($gv_result['amount']>=$temp){ $coversAll=true; ?> function clearRadeos(){ I have not checked the entire file though. Quote Link to comment Share on other sites More sharing options...
bry21317 Posted May 19, 2006 Share Posted May 19, 2006 I just changed mine to match your exactly and I get the same error message. Any other ideas? Do you know where this function should be defined? Fatal error: Call to undefined function: clear_posts() Thanks, Bryan Quote Link to comment Share on other sites More sharing options...
Guest Posted May 19, 2006 Share Posted May 19, 2006 I just changed mine to match your exactly and I get the same error message. Any other ideas? Do you know where this function should be defined? Fatal error: Call to undefined function: clear_posts() Thanks, Bryan Hi Bryan I am at a loss. Will talk tomorrow. Send me your email if you want my files. Quote Link to comment Share on other sites More sharing options...
MoisesZaragoza Posted May 19, 2006 Share Posted May 19, 2006 Ok I re uploaded the admin I had errors actualy 3 they were all previously declared function so i comment them out of add_ccgvdc_application_top.php cannot redeclare create_coupon_code() (previously declared in /home/content/c/o/o/coolbug/html/admin/includes/functions/general.php:21) in /home/content/c/o/o/coolbug/html/admin/includes/add_ccgvdc_application_top.php on line 25 Quote at the end of the day the code will be good Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.