Support

Home Forums Event Espresso Premium Multi-Registration Discount Code Issue

Multi-Registration Discount Code Issue

Posted: June 6, 2014 at 9:14 am

Viewing 8 reply threads


RT Dev

June 6, 2014 at 9:14 am

When we use a discount code the correct amount is showing on the email, however it’s applying the discount code twice (on USAePay side). So the net result is a double discount even though the front end is showing correctly.

ie. $250 camp, $50 discount, showing $200 on the email, charging $150 on the card.

Here is the code of the custom template shopping_cart.php in case there is something in there?


<script>jQuery(document).ready(function(){
jQuery(".price_id").val(1);
jQuery('#event_espresso_refresh_total').trigger('click');
});
</script>

<?php

if ( !function_exists( 'event_espresso_shopping_cart' ) ){

function event_espresso_shopping_cart() {
global $wpdb, $org_options;
//session_destroy();
//echo "", print_r( $_SESSION ), "";
$events_in_session = isset( $_SESSION['espresso_session']['events_in_session'] ) ? $_SESSION['espresso_session']['events_in_session'] : event_espresso_clear_session( TRUE );

if ( event_espresso_invoke_cart_error( $events_in_session )) {
return false;
}

$events_IN = array();

if ( count( $events_in_session ) > 0 ){
foreach ( $events_in_session as $event ) {
//echo '<h4>$event[id] : ' . $event['id'] . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
if ( is_numeric( $event['id'] ) )
$events_IN[] = $event['id'];
}

$events_IN = implode( ',', $events_IN );

if ( empty( $events_IN )) {
return FALSE;
}

$sql = "SELECT e.* FROM " . EVENTS_DETAIL_TABLE . " e ";
$sql = apply_filters( 'filter_hook_espresso_shopping_cart_SQL_select', $sql );
$sql .= " WHERE e.id in ($events_IN) ";
$sql .= " AND e.event_status != 'D' ";
$sql .= " ORDER BY e.start_date ";

$result = $wpdb->get_results( $sql );

$reg_page_url = add_query_arg('regevent_action', 'load_checkout_page', get_permalink($org_options['event_page_id']));

?>

<form action="<?php echo $reg_page_url ?>" method='post' id="event_espresso_shopping_cart">

<?php
$counter = 1; //Counter that will keep track of the first events
foreach ( $result as $r ){

$r = apply_filters( 'filter_hook_espresso_shopping_cart_event', $r );

//Check to see if the Members plugin is installed.
if ( function_exists('espresso_members_installed') && espresso_members_installed() == true && !is_user_logged_in() ) {
$member_options = get_option('events_member_settings');
if ($r->member_only == 'Y' || $member_options['member_only_all'] == 'Y'){
event_espresso_user_login();
return;
}
}
//If the event is still active, then show it.
if (event_espresso_get_status($r->id) == 'ACTIVE') {
$num_attendees = get_number_of_attendees_reg_limit( $r->id, 'num_attendees' ); //Get the number of attendees
$available_spaces = get_number_of_attendees_reg_limit( $r->id, 'available_spaces' ); //Gets a count of the available spaces
$number_available_spaces = get_number_of_attendees_reg_limit( $r->id, 'number_available_spaces' ); //Gets the number of available spaces
//echo "$r->id, $num_attendees,$available_spaces,$number_available_spaces";
?>
<div class="multi_reg_cart_block event-display-boxes ui-widget" id ="multi_reg_cart_block-<?php echo $r->id ?>">

<h3 class="event_title ui-widget-header ui-corner-top"><?php echo stripslashes_deep( $r->event_name ) ?> <span class="remove-cart-item"> id ?>" alt="Remove this item from your cart" src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL ?>images/icons/remove.gif" /> </span> </h3>
<div class="event-data-display ui-widget-content ui-corner-bottom">
<table id="cart-reg-details" class="event-display-tables">
<thead>
<tr>
<th><?php _e( 'Date', 'event_espresso' ); ?></th>
<th><?php _e( 'Time', 'event_espresso' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php echo event_date_display( $r->start_date, get_option( 'date_format' ) ) ?>
<?php /*_e( ' to ', 'event_espresso' ); ?> <?php echo event_date_display( $r->end_date, get_option( 'date_format' ) )*/ ?>
</td>
<td>
<?php echo event_espresso_time_dropdown( $r->id, 0, 1, $_SESSION['espresso_session']['events_in_session'][$r->id]['start_time_id'] ); ?>
</td>
</tr>
<tr>
<td colspan="2">
<?php echo event_espresso_group_price_dropdown( $r->id, 0, 1, $_SESSION['espresso_session']['events_in_session'][$r->id]['price_id']); ?>
</td>
</tr>
</tbody>
</table>

<input type="hidden" name="event_name[<?php echo $r->id; ?>]" value="<?php echo $r->event_name; ?>" />
<input type="hidden" name="use_coupon[<?php echo $r->id; ?>]" value="<?php echo $r->use_coupon_code; ?>" />
<input type="hidden" name="use_groupon[<?php echo $r->id; ?>]" value="<?php echo $r->use_groupon_code; ?>" />
<?php do_action_ref_array( 'action_hook_espresso_add_to_multi_reg_cart_block', array( $r ) ); ?>

</div><!-- / .event-data-display -->
</div><!-- / .event-display-boxes -->

<?php
$counter++;
}
}
//echo $_SESSION['espresso_session']['groupon_used'];
// printr( $_SESSION, '$_SESSION <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
?>
<div class="event-display-boxes ui-widget">
<div class="mer-event-submit ui-widget-content ui-corner-all">
<input type="hidden" name="event_name[<?php echo $r->id; ?>]" value="<?php echo stripslashes_deep( $r->event_name ); ?>" />
<input type="hidden" name="regevent_action" value="load_checkout_page" />

<?php if ( function_exists( 'event_espresso_coupon_payment_page' ) && isset($org_options['allow_mer_discounts']) && $org_options['allow_mer_discounts'] == 'Y' ) : //Discount code display ?>
<div id="event_espresso_coupon_wrapper" class="clearfix event-data-display">
<label class="coupon-code" for="event_espresso_coupon_code"><?php _e( 'Enter Coupon Code ', 'event_espresso' ); ?></label>
<input type="text"
name="event_espresso_coupon_code"
id ="event_espresso_coupon_code"
value="<?php echo isset( $_SESSION['espresso_session']['event_espresso_coupon_code'] ) ? $_SESSION['espresso_session']['event_espresso_coupon_code'] : ''; ?>"
onkeydown="if(event.keyCode==13) {document.getElementById('event_espresso_refresh_total').focus(); return false;}"
/>
</div>
<?php endif; ?>

<?php if ( function_exists( 'event_espresso_groupon_payment_page' ) && isset($org_options['allow_mer_vouchers']) && $org_options['allow_mer_vouchers'] == 'Y' ) : //Voucher code display ?>
<div id="event_espresso_coupon_wrapper" class="clearfix event-data-display" >
<label class="coupon-code" for="event_espresso_groupon_code"><?php _e( 'Enter Voucher Code ', 'event_espresso' ); ?></label>
<input type="text"
name="event_espresso_groupon_code"
id ="event_espresso_groupon_code"
value="<?php echo isset( $_SESSION['espresso_session']['groupon_code'] ) ? $_SESSION['espresso_session']['groupon_code'] : ''; ?>"
onkeydown="if(event.keyCode==13) {document.getElementById('event_espresso_refresh_total').focus(); return false;}"
/>
</div>
<?php endif; ?>

<div id="event_espresso_notifications" class="clearfix event-data-display" style=""></div>

<div id="event_espresso_total_wrapper" class="clearfix event-data-display">
<?php do_action( 'action_hook_espresso_shopping_cart_before_total' ); ?>
<span class="event_total_price">
<?php echo __( 'Total ', 'event_espresso' ) . $org_options['currency_symbol'];?> <span id="event_total_price"><?php echo $_SESSION['espresso_session']['grand_total'];?></span>
</span>
<?php do_action( 'action_hook_espresso_shopping_cart_after_total' ); ?>
<p id="event_espresso_refresh_total">
<?php _e( 'Refresh Total', 'event_espresso' ); ?>
</p>
</div>

<p id="event_espresso_submit_cart">
<input type="submit" class="submit btn_event_form_submit ui-priority-primary ui-state-default ui-state-hover ui-state-focus ui-corner-all" name="Continue" id="event_espresso_continue_registration" value="<?php _e( 'Enter Attendee Information', 'event_espresso' ); ?> »" />
</p>

</div><!-- / .mer-event-submit -->
</div><!-- / .event-display-boxes -->
</form>
<?php

}
}
}


Josh

  • Support Staff

June 9, 2014 at 1:41 pm

Hi RTDev,

I don’t see anything in your code that changes the discoount/amount sent to USAEpay, do you have anything else customized? Perhaps a function that is used later in the process? Also, which of the two USAEpay options is this happening on? Is it off-site or on-site?


RT Dev

June 9, 2014 at 3:03 pm

We aren’t using any other functions beyond that…and we’re using the off-site version. Is there something else I can check in terms of a function/file to see if it’s been modified? What’s odd to me is that it’s showing everything correct on the front end and emails and all that, but not passing through to USAePay correctly. And it’s just on the amount discount codes. The 100% codes we are using are working fine.


Josh

  • Support Staff

June 9, 2014 at 4:19 pm

Yes, if any of Event Espresso’s functions that get called during the registration have been modified this might cause some issues. You might also check the USAEpay gateway files.

Another thing to check is the input values that get sent to USAEpay from the payment page. You can check this by testing a registration with the promo code, and right click/inspect element on the USAepay button from the Chrome browser.


RT Dev

June 11, 2014 at 1:21 pm

There really is nothing else that has been modified. I’m not sure what else to do here to figure out what’s wrong. It seems that the USAePay gateway may be the culprit but those files haven’t been modified. Please advise.


Josh

  • Support Staff

June 11, 2014 at 2:00 pm

Can you check the input values that get sent to USAepay? If not, can you set up a test event with a test promo code and let us know where we can test it in order to investigate?


RT Dev

June 19, 2014 at 11:27 am

So if you go to http://www.sahs.org/summer-classes-camps-2014/ and add the Baseball Camp to cart, then use promo code SS14ZA you can see the discount being applied. I tried looking into the button but didn’t see anything that would be heading over to USAePay?


Seth Shoultes

  • Support Staff

June 19, 2014 at 2:12 pm

From what I can see in the source code of the credit card form, it looks like EE is sending the correct amount. Here is a screenshot: http://www.screencast.com/t/LTtTt7ykHu0I

This is the amount I owe:
http://www.screencast.com/t/j5GihwsG

  • This reply was modified 10 years, 5 months ago by Seth Shoultes. Reason: Added another screenshot


RT Dev

June 19, 2014 at 2:14 pm

So strange. I have no idea how they are then getting a lower amount once it gets to the USAePay side?? I wouldn’t think there is any other call that would pass through the discount amount?


Seth Shoultes

  • Support Staff

June 19, 2014 at 2:27 pm

You can try temporarily turning on debugging in the Event Espresso > General Settings. After testing a few registrations and payments, you can look at the logs to see if you notice anything strange.

Viewing 8 reply threads

The support post ‘Multi-Registration Discount Code Issue’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso