Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Class/Gift Vouchers/Discount Coupons 5.10


Strider

Recommended Posts

  • Replies 4.8k
  • Created
  • Last Reply

Top Posters In This Topic

BUG: timeout / infinite loop and missing file

 

I kept getting a timeout when sending gift certificates in my store. I'd exceed the time limit for query completion. Logs showed that create_coupon_code was infinite looping.

 

Additional logging showed that includes/functions/general.php was trying to use the bare string SECURITY_CODE_LENGTH as a number. >_<

 

To fix this bug, open your includes/application_top.php and add this code:

//#### Added CCGV bugfix ####
define('SECURITY_CODE_LENGTH', 6);
//#### Added CCGV bugfix ends ####

 

I added mine right after define('PROJECT_VERSION', 'osCommerce 2.2-MS2'); that's where the admin version adds it, so it only seemed right.

 

Additionally, there's the (miniscule) chance that the coupon code you create will match a code already in the coupon table. A loop already exists to choose a new number if this occurs; however, it always chooses the same number, leading to an infinite loop, and therefore a timeout. :blush:

 

To fix this bug, find this code in admin/includes/functions/general.php and in includes/functions/general.php:

    $random_start = @rand(0, (128-$length));
   $good_result = 0;
   while ($good_result == 0) {
     $id1=substr($ccid, $random_start,$length);
     $query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_code = '" . $id1 . "'");
     if (tep_db_num_rows($query) == 0) $good_result = 1;
   }
   return $id1;

 

and move the $random_start calculation inside the while loop, thusly:

   
   $good_result = 0;
   while ($good_result == 0) {
     $random_start = @rand(0, (128-$length));
     $id1=substr($ccid, $random_start,$length);
     $query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_code = '" . $id1 . "'");
     if (tep_db_num_rows($query) == 0) $good_result = 1;
   }
   return $id1;

 

All will be right with the world.

 

Next, I'll tackle the Purchase Without Account problems.

If this were easy, everybody would do it.

Link to comment
Share on other sites

that is a strange problem.... logic dictates that if it can't be fixed you should add a second payment module to make it work - such as paypal

 

which version of CCGV are you using? you can paste your catalog/checkout_payment.php here and hopefully someone might be able to do something for you :-)

 

Got the payment issue sorted with a fix on page 50 or so-related to only using one payment method. My only remaining issue(fingers creossed) is that a customer must enter credit card information-even if the gift voucher covers the total cost of the item. here's my checkout_payment.php:

 

I'm using CCGV 5.14

 

<?php
/*
 $Id: checkout_payment.php,v 1.113 2003/06/29 23:03:27 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// 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_CREATE_ACCOUNT, '', '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;
     }
   }
 }

// 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>
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v1.0
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v1.0
?>
<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) {
 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;
 }
}

function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
<?php echo $payment_modules->javascript_validation(); ?>
</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 width="64" border="0" cellspacing="0" cellpadding="0">
     <tr>
    	 <td width="175"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
  	 </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
 }
?>
     <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++;
 }
?>
           </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 RIGHT_BOX_WIDTH; ?>" valign="top">
	 <table width="64" border="0" cellspacing="0" cellpadding="0">
   <tr>
  	 <td width="175"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
   </tr>
	 </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'); ?>

Quidquid latine dictum sit, profundum viditur.

Link to comment
Share on other sites

Got the payment issue sorted with a fix on page 50 or so-related to only using one payment method.  My only remaining issue(fingers creossed) is that a customer must enter credit card information-even if the gift voucher covers the total cost of the item.  here's my checkout_payment.php:

 

I'm using CCGV 5.14

 

The only key piece of code you seem to be missing in on lines 82, 83 and 84. This is what you have:

 

LINE 82 // #################### Added CGV ######################

 

LINE 83$total_count = $cart->count_contents_virtual(); //ICW ADDED FOR CREDIT CLASS SYSTEM

 

LINE 84 // #################### End Added CGV ######################

 

 

 

 

I think what you should have is:

 

LINE 82 // #################### Added CGV ######################

 

LINE 83 $total_count = $cart->count_contents_virtual(); //ICW ADDED FOR CREDIT CLASS SYSTEM

 

LINE 84 $total_count = $cart->count_contents();

 

LINE 85 // #################### End Added CGV ######################

 

 

Let me know what happens when you try it

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Still requires card information... I'm assuming that some code should be in place to skip the use of my credit card module, but it doesn't seem to be working. Any other ideas?

Quidquid latine dictum sit, profundum viditur.

Link to comment
Share on other sites

Still requires card information...  I'm assuming that some code should be in place to skip the use of my credit card module, but it doesn't seem to be working.  Any other ideas?

 

that is the only piece of code missing from your file....

 

i suppose if i take away my payment mods and keep just one then maybe that'll happen to me too?

 

sorry, only php programmer can tell how to type "if voucher balance is equal to or greater than checkout price then ship CC request!"

 

(i wonder that is written in php)

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Hi, I just upgraded to v5.14 to try and resolve a problem I had with an older version. The new version didn't resolve the issue, so I'm hoping somebody can help me here.

 

On my site's checkout_payment.php page, the customer is asked to supply the credit card info, then after that, the coupon code is taken. If I put in the coupon code, then hit redeem, it says "Congrats...", but the credit card information is now gone. So I re-enter the credit card information, hit the Continue Checkout Procedure button and on the next page, the coupon is not redeemed.

 

My site is at http://www.hellynewport.com if you care to take a look. It is a live site...

 

My assumption was that I did something wrong in the previous installation and that the coupon should appear BEFORE the credit card information is taken... but in looking at the checkout_payment.php page for the contribution, this appears to be correct.

 

Any ideas out there? Many thanks!

 

Janet

Link to comment
Share on other sites

Updating on this issue, I put the coupon code above the credit card information. The same thing happens checkout_payment page which is:

 

1. Enter the coupon code... hit redeem, the message say Congrats, you have redeemed, and the coupon code field is now blank (doesn't hold the info)

 

2. I enter the credit card info and hit Continue. The next page does not contain the discount.

 

3. I hit the back button and reenter the info... sometimes I can get the coupon to be recognized by futzing with it.

 

Again, this is the 5.14 install from July 22. Has anybody gotten this working correctly?

 

Thanks,

Janet

Link to comment
Share on other sites

Okay, I'm making progress, but I may have discovered a bug... here's what I found:

 

The statement "Congratulations, you have redeemed" is actually from here:

 

define('ERROR_REDEEMED_AMOUNT', 'Congratulations, you have redeemed ');

and sure enough, when I change it to :

define('ERROR_REDEEMED_AMOUNT', 'Error there is a problem ');

the site shows that the coupon is not working. (this is in file: catalog/includes/languages/english.php

 

Then, I looked in the Administration section under Modules/Order Totals and see the following errors:

 

Warning: main(..//includes/languages/english/modules/order_total/ot_coupon_513a.php): failed to open stream: No such file or directory in D:\inetpub\hellynewport\admin\modules.php on line 128

 

Warning: main(..//includes/languages/english/modules/order_total/ot_coupon_513a.php): failed to open stream: No such file or directory in D:\inetpub\hellynewport\admin\modules.php on line 128

 

Warning: main(): Failed opening '..//includes/languages/english/modules/order_total/ot_coupon_513a.php' for inclusion (include_path='.;c:\php4\pear') in D:\inetpub\hellynewport\admin\modules.php on line 128

 

Fatal error: Cannot redeclare class ot_coupon in D:\inetpub\hellynewport\includes\modules\order_total\ot_coupon_513a.php on line 17

 

I don't know where the call to ot_coupon_513a.php is coming from, but to see what happened, I started to hack... I renamed ot_coupon.php to ot_coupon_513a.php and tried that. Now I am down to one error:

 

Fatal error: Cannot redeclare class ot_coupon in D:\inetpub\hellynewport\includes\modules\order_total\ot_coupon_513a.php on line 17

 

I'd rather not have such a hack, so if anybody can point me to where I correct my first error I'd appreciate the help. Meanwhile, I'll keep hacking away!

 

Janet

Link to comment
Share on other sites

Sorry for all the postings. I've resolved the errors I posted previously and am now back to the original problem I was trying to resolve, which is the coupon code not taking unless I enter it twice. I've gone through the forums looking for any assistance and found this, along with several other people with the same problem.

 

1) On the checkout_payment screen you enter the redeem code: fine.  The error message reporting is all working fine and you get a message saying 'congrats - successful'.  But, it doesn't update and appear in either the shopping cart infobox or the following checkout_confirmation screen.  But if you enter the code a second time - BAM.  It works and updates on both.  It NEVER works the first time, only every subsequent time after that.

 

Anyone else out there experienced/fixed either of the above?

 

Thanks in advance,

Christian

 

Has anybody found the resolution to this? I am also using the Register Globals patch, but not the Cash on Delivery Module.

 

Any advice is greatly appreciated as my client really wants to send a coupon to his email list. Thank you!

Janet

Link to comment
Share on other sites

Still requires card information...  I'm assuming that some code should be in place to skip the use of my credit card module, but it doesn't seem to be working.  Any other ideas?

 

I was having a similar problem with my store; turned out I had merged in a chunk of code from some other version of osCommerce (maybe from CVS?) when I merged the rest of the CCGV stuff. Luckily, I had annotated it, so it was easy to find and replace.

 

My particular offending code looked like this, in checkout_process.php:

      } else {
       $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
     }

 

Mine was located at line 190, but I also have the Quantity Tracker Pro (QTPro) contribution installed, which messes up my line counts. It looks like the stock/CVS checkout_process.php -- included with CCGV -- is trying to say: "if this product is downloadable, skip quantity check; otherwise, use $stock_query to find out how many there are." QTPro is replacing that with a huge query for attribute combinations and such.

 

Anywho. If you installed QTPro, then CCGV, you might have made the same mistake, and your code may include this mishmash of osCommerce and QTPro stock checking. In that case, removing it should allow your customers to use their gift certificate balances without having to enter credit card info. At least, it does for me.

If this were easy, everybody would do it.

Link to comment
Share on other sites

I'm sorry, I am having a terrible time trying to figure out how to get this posted in the right place! I hope I have it right now... :blush:

 

I am in the process of testing my ccgv 5.14 and sent myself a coupon for $10.00 off of a minumum $35 order.

 

1. The redeem worked fine except it also redeemed the coupon for a purchase of $21.87! Where do I fix this?

 

2. There is not any record of anything in the Que either. Is this only if someone purchases a Gift Certificate?

 

3. There is nothing recorded in the "GV's Sent" recording that I sent myself a coupon.

 

4. I can also use the coupon more than once even though the "Uses per Coupon" is set to 1 and the "Uses per Customer" is set to 1.

 

5. I have my shipping set to "Price" - do I still need to add weight to ALL my products?

 

Thank you for any help.

 

I am sorry if these questions have already been answered... I have spent several days looking through all these posts and I am terribly CONFUSED!!! :blink:

 

Thank you

Link to comment
Share on other sites

I was having a similar problem with my store; turned out I had merged in a chunk of code from some other version of osCommerce (maybe from CVS?) when I merged the rest of the CCGV stuff.  Luckily, I had annotated it, so it was easy to find and replace. 

 

My particular offending code looked like this, in checkout_process.php:

 ? ? ?} else {
? ? ? ?$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
? ? ?}

 

Mine was located at line 190, but I also have the Quantity Tracker Pro (QTPro) contribution installed, which messes up my line counts.  It looks like the stock/CVS checkout_process.php -- included with CCGV -- is trying to say: "if this product is downloadable, skip quantity check; otherwise, use $stock_query to find out how many there are."  QTPro is replacing that with a huge query for attribute combinations and such. 

 

Anywho.  If you installed QTPro, then CCGV, you might have made the same mistake, and your code may include this mishmash of osCommerce and QTPro stock checking.  In that case, removing it should allow your customers to use their gift certificate balances without having to enter credit card info.  At least, it does for me.

 

Thanks for your reply Judebert. Those lines appear in the stock install. I commented them out, but still had the same problem. No, I don't have QTPro installed. This is a boggler.

 

PS Anyone know how to have the "tick this box to apply gift voucher" default to CHECKED instead of unchecked?

Quidquid latine dictum sit, profundum viditur.

Link to comment
Share on other sites

2. There is not any record of anything in the Que either. Is this only if someone purchases a Gift Certificate?

 

Yes, this area will only hold gift vouchers that are purchased-IF you have the gv module configured to que gift vouchers.

 

3. There is nothing recorded in the "GV's Sent" recording that I sent myself a coupon.

 

You sent yourself a coupon-or a gift voucher?

 

5. I have my shipping set to "Price" - do I still need to add weight to ALL my products?

 

Yes-if you want customers to ship the shipping options when they purchase a gift voucher. I added 0.01 ounces to each product by running this SQL in phpmyadmin:

 

update products set products_weight = 0.01

 

Then go back and change your gv weights to 0.

 

Sorry-haven't a clue about the others-haven't even BEGUN to fight with coupons yet... Still working on the GV side.

Quidquid latine dictum sit, profundum viditur.

Link to comment
Share on other sites

Thanks to Lewis Hill for the latest improvement to the checkout_payment display-MUCH more intuitive!

 

For those who install it, you can change the dividing line color by editing this line in catalog/includes/modules/order_totals/ot_gv.php line 32:

 

$this->checkbox = $this->user_prompt . '<input type="checkbox" class="radio" CHECKED onClick="submitFunction()" name="' . 'c' . $this->code . '"><hr size="1" color="#cccccc"></tr>';

 

In this example I'm using the color code #cccccc to match the default grey borders. Also note that I have added "CHECKED" to this line so that the page loads with the "tick this box" checked-which is more intuitive IMO-change to suit your needs.

 

Also, to fix the slight alignment issue with the button_redeem.gif, I added the align tag to line 152:

 

 ? ? ? ?$image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . DIR_WS_LANGUAGES . $language . '/images/buttons/button_redeem.gif" class="contbutton" align="absbottom" alt="' . IMAGE_REDEEM_VOUCHER . '" title = "' . IMAGE_REDEEM_VOUCHER . '"></td>';

 

Now appears like this:

new_checkout.gif

Edited by akmac

Quidquid latine dictum sit, profundum viditur.

Link to comment
Share on other sites

Issues left to be resolved:

 

Checkout_payment.php requires credit card information to be entered even if GV amount covers purchase.

 

Coupons only work when not restricted to categories or products

 

Checkout_payment shows (incomplete) "The coupon code has been successfully applied for" when using coupons. Works fine with gift vouchers.

 

If anyone has fixes for these issues-please post.

Quidquid latine dictum sit, profundum viditur.

Link to comment
Share on other sites

Thank you so much for your help akmac! :thumbsup:

 

I sent myself a coupon...

 

I am feeling really stupid now - I am not sure of the difference between a coupon and a voucher... :blush: Could someone enlighten me please?

 

Thank you so much for your help! Not having to manually add weight to all my products is really a relief! :D

Link to comment
Share on other sites

Thank you so much for your help akmac!  :thumbsup:

 

I sent myself a coupon...

 

I am feeling really stupid now - I am not sure of the difference between a coupon and a voucher...  :blush:  Could someone enlighten me please?

 

Thank you so much for your help!  Not having to manually add weight to all my products is really a relief!  :D

 

The main difference is that a gift voucher/certificate can be purchased by a customer and sent as a gift, a coupon cannot. I'm guessing that you sent yourself a gift certificate... but sorry, don't know the answer to number 1.

Quidquid latine dictum sit, profundum viditur.

Link to comment
Share on other sites

hi all....

 

i have a question. i saw a site ages back that had the radio-set in product_info.php (from QT) and it actually had a $10, $25 and $50 gift voucher options

 

i have been thinking of a way to try and do this too.. if the gift voucher is on one page (product_info) then really there should be no way to use attributes as the GIFT_10, or GIFT_25 or GIFT_50 can only appear in one product field, right?

 

do you think i may have been hallucinating at the time and that it isn't possible to use the attributes for Gift _vouchers :-)

 

the closest i can to that is to have any onr gift voucher on sale and use the other ones as out of stock - because if they were in stock, how does one differentiate between the vouchers when adding to cart?

 

can anyone please advise on this matter

 

thanks

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Hello,

 

I have been able to use this forum to solve many of the bugs in this contribution. Even the dreaded french problem. :-) BTW the commonly asked for

French Fix is here.

http://www.oscommerce.com/forums/index.php?sho...=158518&st=2440

 

Now I have two questions.

 

I have my module set up to send an email to a person when they set up a new account. For some reason they get an email with no link (clickable or cut&paste) . I thought I found the answer in the contribution list (email link fix) but it did not change anything

Does anyone know what I can do?

 

Also when I go to admin-->Config The Voucher/Coupon Section is showing up twice on the left hand menu/

I put a screen shot at

http://www.seasidelingerie.com/twicemenu.jpg

 

Many Thanks,

Kecia

Edited by SeasideLingerie
Link to comment
Share on other sites

Hello,

 

I have been able to use this forum to solve many of the bugs in this contribution. Even the dreaded french problem. :-) BTW the commonly asked for

French Fix is here.

http://www.oscommerce.com/forums/index.php?sho...=158518&st=2440

 

Now I have two questions.

 

I have my module set up to send an email to a person when they set up a new account. For some reason they get an email with no link (clickable or cut&paste) . I thought I found the answer in the contribution list (email link fix) but it did not change anything

Does anyone know what I can do?

 

Also when I go to admin-->Config The Voucher/Coupon Section is showing up twice on the left hand menu/

I put a screen shot at

http://www.seasidelingerie.com/twicemenu.jpg

 

Many Thanks,

Kecia

 

 

OK I figured out that in left_column.php the link information for the voucher/coupon was there twice so All I had to do was delete the second mention.

 

I also figured out discount coupons are not supposed to have a link in the email. They just have a code in the welcome letter that can be cut and pasted. :-)

 

All fixed here.

 

TC,

Kecia

Link to comment
Share on other sites

I'm hoping someone from this forum can answer my question. I have been trying for weeks to get an answer in the PWA (Purchase Without Account) forum....

 

Does anyone know if the PWA and CCGV are compatible? I have CCGV installed and working beautifully. I'm worried about adding PWA... first impression is that they may not play well together.

 

Signed... Desperate

Anthony David

AllThingsTrendy.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...