Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

I installed the module, but I'm not sure how to use it. How do I issue coupon codes? How do customer's enter them? I don't see a place when I checkout on my site to enter it and I also don't see on my admin site how I use the module.

Share this post


Link to post
Share on other sites

Hi Breanna,

 

If installed correctly you will see a link in your admin under /catalog/Discount Coupons here you can create your coupons codes

They should appear for the customer on checkout_payment.php

 

 

Regards

Joli

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Joli,

I have now been able to successfully create coupons, but the discount is not showing in the order total on the checkout_php page. I have already made sure that I have a unique sort order and changed the code as specified in the instructions.Also, the text reading "Do you have a promotional code or discount coupon?" is off center on the checkout_payment.php page. Any idea how to fix these things?

Share this post


Link to post
Share on other sites

First thing is to check your /checkout_payment.php something has been done wrong there


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

here is what I have in /checkout_payment.php

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 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_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'));
   }
 }
// 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
   if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {
  $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;
 if (!tep_session_is_registered('comments')) tep_session_register('comments');
 if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) {
   $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
 }
 $total_weight = $cart->show_weight();
 $total_count = $cart->count_contents();
// 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'));
 require(DIR_WS_INCLUDES . 'template_top.php');
?>
<script type="text/javascript"><!--
var selected;
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(); ?>
<h1><?php echo HEADING_TITLE; ?></h1>
<?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?>
<div class="contentContainer">
<?php
 if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
?>
 <div class="contentText">
   <?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?>
   <p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p>
 </div>
<?php
 }
?>
 <h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2>
 <div class="contentText">
   <div class="ui-widget infoBoxContainer" style="float: right;">
  <div class="ui-widget-header infoBoxHeading"><?php echo TITLE_BILLING_ADDRESS; ?></div>
  <div class="ui-widget-content infoBoxContents">
    <?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />'); ?>
  </div>
   </div>
   <?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br /><br /><?php echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); ?>
 </div>
 <div style="clear: both;"></div>
 <h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2>
<?php
 $selection = $payment_modules->selection();
 if (sizeof($selection) > 1) {
?>
 <div class="contentText">
   <div style="float: right;">
  <?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?>
   </div>
   <?php echo TEXT_SELECT_PAYMENT_METHOD; ?>
 </div>
<?php
   } elseif ($free_shipping == false) {
?>
 <div class="contentText">
   <?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?>
 </div>
<?php
   }
?>
 <div class="contentText">
 <?php
 if(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_STATUS == 'True'){
 ?>
 <div><img alt="Credit Card Types" width="230px" src="images/creditcard_logos.png" style="border:1px solid #000000;padding:2px;margin-bottom:10px;"></div>
 <?php
 }
 ?>
<?php
 $radio_buttons = 0;
 for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
?>
   <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><strong><?php echo $selection[$i]['module']; ?></strong></td>
    <td align="right">
<?php
   if (sizeof($selection) > 1) {
  echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment));
   } else {
  echo tep_draw_hidden_field('payment', $selection[$i]['id']);
   }
?>
    </td>
  </tr>
<?php
   if (isset($selection[$i]['error'])) {
?>
  <tr>
    <td colspan="2"><?php echo $selection[$i]['error']; ?></td>
  </tr>
<?php
   } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {
?>
  <tr>
    <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
<?php
  for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
?>
	  <tr>
	    <td><?php echo $selection[$i]['fields'][$j]['title']; ?></td>
	    <td><?php echo $selection[$i]['fields'][$j]['field']; ?></td>
	  </tr>
<?php
  }
?>
    </table></td>
  </tr>
<?php
   }
?>
   </table>
<?php
   $radio_buttons++;
 }
?>
 </div>
 <h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>
 <div class="contentText">
   <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>
 </div>
 <div class="contentText">
   <div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
  <div id="coProgressBar" style="height: 5px;"></div>
  <table border="0" width="100%" cellspacing="0" cellpadding="2">
    <tr>
	  <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
	  <td align="center" width="33%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
	  <td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
    </tr>
  </table>
   </div>
   <div style="float: right;"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></div>
 </div>
</div>
<script type="text/javascript">
$('#coProgressBar').progressbar({
 value: 66
});
</script>
</form>
<?php

//* kgt - discount coupons */
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
<h2><?php echo TABLE_HEADING_COUPON; ?></h2>
 <div class="contentText">
   </div>

    <div class="contentText">
    <?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"', $coupon); ?>
   </div>

<?php
}
/* end kgt - discount coupons */
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Share this post


Link to post
Share on other sites

Not sure what you have done with the file it is wrong there seems to be missing table tags and the code is in the wrong place can not say for certain maybe you have some template!!!

 

Well x 2 files attached one with the code in the right place and one with the code and the missing tags etc fixed (maybe) !!!

 

See which works best for you

 

when modifying it is important to follow instructions exactly

 

Regards

Joli

checkout_payment.php


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

I had to put the code there. When I placed it per the instructions it didn't work. The instructions say to add after <h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>

 

<div class="contentText">

<?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>

</div>

<?php

However, in my file the last <?php was missing so I scrolled down and found the next occurrence of <?php and inserted the discount code after that. This worked, the other way gave me an error, but the spacing of the text is wrong. I will try to upload an image.

 

Also, my discount is still not showing up in the order total on the checkout_confirmation page

Share this post


Link to post
Share on other sites

yes noticed the instruction is slightly confusing download the files I sent and test

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Sorry, I'm bombarding you with questions. I've been at this for days running into one problem after another. I really do appreciate all of the help.

 

Here is my checkout_confirmation page code. I made all of the changes and have a unique sort order. Any other possible causes of of the discount not showing on this page?

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 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(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
   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));
 }
// 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 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'));
 }
 if (!tep_session_is_registered('payment')) tep_session_register('payment');
 if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];
 if (!tep_session_is_registered('comments')) tep_session_register('comments');
 if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) {
   $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
 }
//kgt - discount coupons
 if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
 //this needs to be set before the order object is created, but we must process it after
 $coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
 //end kgt - discount coupons
// load the selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment($payment);
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
 if (tep_not_null($HTTP_POST_VARS['coupon'])) {
    $coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
 }
 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;
 $payment_modules->update_status();
 if ( ($payment_modules->selected_module != $payment) || ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
 }
 if (is_array($payment_modules->modules)) {
   $payment_modules->pre_confirmation_check();
 }
//kgt - discount coupons
 if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field
   $order->coupon->verify_code();
   if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
   if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
 if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
   } else {
 if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session
 tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page
   }
   }
} else { //if the coupon field is empty, unregister the coupon from the session
 if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it
  tep_session_unregister('coupon');
  //now check to see if we need to recalculate shipping:
  require_once( DIR_WS_CLASSES.'discount_coupon.php' );
  if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method
   }
}
//end kgt - discount coupons
// load the selected shipping module
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping($shipping);
 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;
 $order_total_modules->process();
// Stock Check
 $any_out_of_stock = false;
 if (STOCK_CHECK == 'true') {
   for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
    $any_out_of_stock = true;
  }
   }
   // Out of Stock
   if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
  tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
   }
 }
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);
 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2);
 require(DIR_WS_INCLUDES . 'template_top.php');
?>
<h1><?php echo HEADING_TITLE; ?></h1>
<?php
 if (isset($$payment->form_action_url)) {
   $form_action_url = $$payment->form_action_url;
 } else {
   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 }
 echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
?>
<div class="contentContainer">
 <h2><?php echo HEADING_SHIPPING_INFORMATION; ?></h2>
 <div class="contentText">
   <table border="0" width="100%" cellspacing="1" cellpadding="2">
  <tr>
<?php
 if ($sendto != false) {
?>
    <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
	    <td><?php echo '<strong>' . HEADING_DELIVERY_ADDRESS . '</strong> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
	  </tr>
	  <tr>
	    <td><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br />'); ?></td>
	  </tr>
<?php
   if ($order->info['shipping_method']) {
?>
	  <tr>
	    <td><?php echo '<strong>' . HEADING_SHIPPING_METHOD . '</strong> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
	  </tr>
	  <tr>
	    <td><?php echo $order->info['shipping_method']; ?></td>
	  </tr>
<?php
   }
?>
    </table></td>
<?php
 }
?>
    <td width="<?php echo (($sendto != false) ? '70%' : '100%'); ?>" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if (sizeof($order->info['tax_groups']) > 1) {
?>
	  <tr>
	    <td colspan="2"><?php echo '<strong>' . HEADING_PRODUCTS . '</strong> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
	    <td align="right"><strong><?php echo HEADING_TAX; ?></strong></td>
	    <td align="right"><strong><?php echo HEADING_TOTAL; ?></strong></td>
	  </tr>
<?php
 } else {
?>
	  <tr>
	    <td colspan="3"><?php echo '<strong>' . HEADING_PRODUCTS . '</strong> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
	  </tr>
<?php
 }
 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
   echo '		  <tr>' . "\n" .
	 '		    <td align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
	 '		    <td 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 valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";
   echo '		    <td align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n" .
	 '		  </tr>' . "\n";
 }
?>
    </table></td>
  </tr>
   </table>
 </div>
 <h2><?php echo HEADING_BILLING_INFORMATION; ?></h2>
 <div class="contentText">
   <table border="0" width="100%" cellspacing="1" cellpadding="2">
  <tr>
    <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
	    <td><?php echo '<strong>' . HEADING_BILLING_ADDRESS . '</strong> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
	  </tr>
	  <tr>
	    <td><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br />'); ?></td>
	  </tr>
	  <tr>
	    <td><?php echo '<strong>' . HEADING_PAYMENT_METHOD . '</strong> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
	  </tr>
	  <tr>
	    <td><?php echo $order->info['payment_method']; ?></td>
	  </tr>
    </table></td>
    <td width="70%" valign="top" align="right"><table border="0" cellspacing="0" cellpadding="2">
<?php
 if (MODULE_ORDER_TOTAL_INSTALLED) {
   echo $order_total_modules->output();
 }
?>
    </table></td>
  </tr>
   </table>
 </div>
<?php
 if (is_array($payment_modules->modules)) {
   if ($confirmation = $payment_modules->confirmation()) {
?>
 <h2><?php echo HEADING_PAYMENT_INFORMATION; ?></h2>
 <div class="contentText">
   <table border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td colspan="4"><?php echo $confirmation['title']; ?></td>
  </tr>
<?php
  if (isset($confirmation['fields'])) {
    for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
?>
  <tr>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
    <td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
    <td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>
  </tr>
<?php
    }
  }
?>
   </table>
 </div>
<?php
   }
 }
 if (tep_not_null($order->info['comments'])) {
?>
 <h2><?php echo '<strong>' . HEADING_ORDER_COMMENTS . '</strong> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></h2>
 <div class="contentText">
   <?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?>
 </div>
<?php
 }
?>
 <div class="contentText">
   <div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
  <div id="coProgressBar" style="height: 5px;"></div>
  <table border="0" width="100%" cellspacing="0" cellpadding="2">
    <tr>
	  <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
	  <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_PAYMENT . '</a>'; ?></td>
	  <td align="center" width="33%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
    </tr>
  </table>
   </div>
   <div style="float: right;">
<?php
 if (is_array($payment_modules->modules)) {
   echo $payment_modules->process_button();
 }
 echo tep_draw_button(IMAGE_BUTTON_CONFIRM_ORDER, 'check', null, 'primary');
?>
   </div>
 </div>
</div>
<script type="text/javascript">
$('#coProgressBar').progressbar({
 value: 100
});
</script>
</form>
<?php
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

.

Share this post


Link to post
Share on other sites

I have installed this add-on and after fiddling with it (I have modified alot of my code) got it to work in all ways but 1. When I get to the checkout_payment.php, where it should say something about entering the coupon code, it echos back TABLE_HEADING_COUPON. I know that there is a file somewhere in here that will define the TABLE_HEADING_COUPON echo but I am unsure which file it is.

 

Any ideas?

Share this post


Link to post
Share on other sites

catalog/includes/languages/english/checkout_payment.php

 

//kgt - discount coupons

define('TABLE_HEADING_COUPON', 'Do you have a promotional code or discount coupon?' );

//end kgt - discount coupons

 

Regards

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

catalog/includes/languages/english/checkout_payment.php

 

//kgt - discount coupons

define('TABLE_HEADING_COUPON', 'Do you have a promotional code or discount coupon?' );

//end kgt - discount coupons

 

Regards

Joli

 

PERFECT! Thank you Joli

Share this post


Link to post
Share on other sites

@@greasemonkey

Thanks for the great contribution! Came across one discrepancy in the instructions while installing on a clean 2.3.3.4

catalog/includes/classes/order.php

Instructions have FIND on line 327:

 $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
 $this->info['subtotal'] += $shown_price;

 

My file has

 

$shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
$this->info['subtotal'] += $shown_price;

 

Would the above difference require any changing to the subsequnt REPLACE with?

 

Thanks

Edited by Roaddoctor

-Dave

Share this post


Link to post
Share on other sites

Either will work but calculate_price includes code to round the result so it's the better one to use. There is one instance of that function in the original code but two instances in the code to be added in. So just replace the two lines with the first function with the original line and it will work fine.

Share this post


Link to post
Share on other sites

Just a small talk I had as regards the paypal express

 

Was just looking at that express this morning again to better clarify he will not carry the discount from shopping cart page

 

(Big orange express Button) obviously because the discount code and the input box comes first on checkout_payment.php,

 

but he will carry from from checkout_payment.php (where the discount box appears) the discount to paypal using express but no -discount TEXT appears on the paypal page although the sum is correct with the discount calculated

 

 

OK so far so good ideal would be if the input box was put on the shopping cart page now if I have understood correctly that is what this guy has done

 

http://addons.oscommerce.com/info/8848

 

But customer must be logged in to see the input box that is ok

 

So not sure if my logic is right but the guy explains it can be used for other discount modules it may be possible to enter the discount code and to hit the express checkout on the shopping cart page and the discount would carry over directly to paypal which would be perfect. and save the shipping and payment pages

 

well by going x 1 page further to checkout_payment.php paypal express does work

 

I can give you the x 2 working express files but I would strongly suggest you use the paypal standard as the express bypasses a lot of the checkout process

 

Paypal express will not work from the shopping cart page as regards discount coupons only from the checkout_payment.php so there is no advantage over the paypal standard.

 

Regards

joli

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

I'm getting the following error message after installation.

 

When I log in to the administrative end and select 'Catalog' then 'Discount Coupons' I receive this error:

 

Not Found

The requested URL /buzz/FILENAME_DISCOUNT_COUPONS was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

Could you help me??

Share this post


Link to post
Share on other sites

Hi Jenna

Looks like you forgot to add in admin/includes/filenames.php

 

//kgt - discount coupons

define('FILENAME_DISCOUNT_COUPONS','coupons.php');

define('FILENAME_DISCOUNT_COUPONS_MANUAL', 'coupons_manual.html');

define('FILENAME_DISCOUNT_COUPONS_EXCLUSIONS', 'coupons_exclusions.php');

//end kgt - discount coupons

 

//kgt - discount coupons report

define('FILENAME_STATS_DISCOUNT_COUPONS', 'stats_discount_coupons.php');

//end kgt - discount coupons report

 

Regards

Joli

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Thank you SO much for the quick response! I was able to make the change.

 

However, now when I go to that page I get this error...

Discount Coupons NOTICE: Click here to read the Discount Coupon Codes manual for help editing coupons. 1146 - Table 'pestybee_pesty1.TABLE_DISCOUNT_COUPONS' doesn't exist

 

select count(*) as total from TABLE_DISCOUNT_COUPONS cd

 

[TEP STOP]

 

Coupon Code: Discount: Start: End: Max Use:

Share this post


Link to post
Share on other sites

Did you do the file edits to admin/includes/database_tables.php ??

and/or did you run the sql file in your database??

 

 

//kgt - discount coupons

define('TABLE_DISCOUNT_COUPONS', 'discount_coupons');

define('TABLE_DISCOUNT_COUPONS_TO_ORDERS', 'discount_coupons_to_orders');

define('TABLE_DISCOUNT_COUPONS_TO_CATEGORIES', 'discount_coupons_to_categories');

define('TABLE_DISCOUNT_COUPONS_TO_PRODUCTS', 'discount_coupons_to_products');

define('TABLE_DISCOUNT_COUPONS_TO_MANUFACTURERS', 'discount_coupons_to_manufacturers');

define('TABLE_DISCOUNT_COUPONS_TO_CUSTOMERS', 'discount_coupons_to_customers');

define('TABLE_DISCOUNT_COUPONS_TO_ZONES', 'discount_coupons_to_zones');

//end kgt - discount coupons


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

That did the trick!

 

I've tested it with Authorize.net and everything seems to work smoothly. Two additional questions I have:

  1. Shouldn't the tax be discounted as well? It's still showing the original tax amount.
  2. I did the PayPal updates but it still isn't applying the coupon code to PayPal. Are there common mistakes I can check for?

Again, thank you for all of your help!

Share this post


Link to post
Share on other sites

That did the trick!

 

I've tested it with Authorize.net and everything seems to work smoothly. Two additional questions I have:

  1. Shouldn't the tax be discounted as well? It's still showing the original tax amount.
     
  2. I did the PayPal updates but it still isn't applying the coupon code to PayPal. Are there common mistakes I can check for?

Again, thank you for all of your help!

 

 

Hi

please replace your include/classes/discount_coupon.php with the one I have attached and see if that corrects the tax issue.

 

Regards

Joli

discount_coupon.php


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Nope. Still displaying tax based on the original amount. Is there something within the Order Total admin that I should be editing?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×