hello everyone, what comes to discount coupon: shopping_cart using paypal express don't have a place to input the coupon code, i am building a ajax so with paypal express from the shopping_cart will work also.
1. codes gets erased when i go thru the checkout again
2. code Discount Coupon ???? applied: doesn't show in shopping_cart.php
------------------------------------------------------------------
------------------------------------------------------------------
if (!tep_session_unregister('coupon')) tep_session_register('coupon');
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
if (is_array($payment_modules->modules)) {
$payment_modules->pre_confirmation_check();
}
if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) {
$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' ) );
} else {
if( tep_session_unregister('coupon') ) tep_session_unregister('coupon');
tep_redirect( tep_href_link( FILENAME_SHOPPING_CART1, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) );
}
}
} else {
if( tep_session_unregister('coupon') ) {
tep_session_unregister('coupon');
require_once( DIR_WS_CLASSES.'discount_coupon.php' );
if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_SHOPPING_CART1, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) );
}
}
-----------------------------------------------------------------
<?php
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'false' ) {
?>
<div class="shippingcoupon container">
<div class="text-left shipsmday"><?php echo ENTRY_SHIPSAMEDAY;?></div>
<div class="shipcouon">
<span><?php echo ENTRY_DISCOUNT_COUPON;?></span>
<?php echo tep_draw_input_fieldclear('coupon', 'if(this.value == 'Enter Promo Code Here') { this.value = ''; }','if(this.value == 'Enter Promo Code Here') { this.value = ''; }', ''.ENTRY_COUPONS.'', $coupon); ?>
<?php echo tep_draw_couponcode(IMAGE_BUTTON_APPLY, 'submit', null, 'primary', null, ''); ?>
</div>
<?php
}
?>
<br>
<div class="container">
<div class="text-rights">
<?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUTS, 'triangle-1-e', null, 'primary'); ?>
</div>
<?php
$initialize_checkout_methods = $payment_modules->checkout_initialization_method();
if (!empty($initialize_checkout_methods)) {
?>
<div class="text-rights"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></div>
<?php
reset($initialize_checkout_methods);
while (list(, $value) = each($initialize_checkout_methods)) {
?>
<p class="text-right"><?php echo $value; ?></p>
<?php
}
}
?>
----------------------------------------------------------------html------------------------------------------------------
////
// Output COUPON
function tep_draw_couponcode($title = null, $icon = null, $link = null, $priority = null, $params = null, $style = null) {
static $button_counter = 1;
$types = array('coupon', 'button', 'reset');
if ( !isset($params['type']) ) {
$params['name'] = 'coupon';
}
if ( !in_array($params['name'], $types) ) {
$params['name'] = 'coupon';
}
if ( ($params['name'] == 'coupon') && isset($link) ) {
$params['name'] = 'button';
}
if (!isset($priority)) {
$priority = 'secondary';
}
$button = NULL;
if ( ($params['name'] == 'button') && isset($link) ) {
$button .= '<a href="' . $link . '"';
if ( isset($params['newwindow']) ) {
$button .= '';
}
} else {
$button .= '<button';
$button .= ' name="' . tep_output_string($params['name']) . '"';
}
if ( isset($params['params']) ) {
$button .= ' ' . $params['params'];
}
$button .= 'type="button" onclick="ajaxFunction()" id="couponapplyajax" class="couponapply"';
$button .= 'value="apply">';
$button .= $title;
if ( ($params['name'] == 'button') && isset($link) ) {
$button .= '</a>';
} else {
$button .= '</button>';
}
$button_counter++;
return $button;
}
// Rewview Button
function tep_draw_reviews($title = null, $icon = null, $link = null, $priority = null, $params = null, $style = null) {
static $button_counter = 1;
$types = array('submit', 'button', 'reset');
if ( !isset($params['type']) ) {
$params['type'] = 'submit';
}
if ( !in_array($params['type'], $types) ) {
$params['type'] = 'submit';
}
if ( ($params['type'] == 'submit') && isset($link) ) {
$params['type'] = 'button';
}
if (!isset($priority)) {
$priority = 'secondary';
}
$button = NULL;
if ( ($params['type'] == 'button') && isset($link) ) {
$button .= '<a href="' . $link . '"';
if ( isset($params['newwindow']) ) {
$button .= ' target="_blank"';
}
} else {
$button .= '<button ';
$button .= ' type="' . tep_output_string($params['type']) . '"';
}
if ( isset($params['params']) ) {
$button .= ' ' . $params['params'];
}
$button .= ' class="btn ';
$button .= (isset($style)) ? $style : 'btn-default';
$button .= '">';
if (isset($icon) && tep_not_null($icon)) {
$button .= ' <span class="' . $icon . '"></span> ';
}
$button .= $title;
if ( ($params['type'] == 'button') && isset($link) ) {
$button .= '</a>';
} else {
$button .= '</button>';
}
$button_counter++;
return $button;
}