function event_espresso_add_attendees_to_db_multi()
    {
        global $wpdb, $org_options;
        //Added by Imon
        $primary_registration_id = NULL;
        $events_in_session = $_SESSION['espresso_session']['events_in_session'];
        if (event_espresso_invoke_cart_error($events_in_session)) {
            return false;
        }
        $count_of_events = count($events_in_session);
        $current_session_id = $_SESSION['espresso_session']['id'];
        //Debug
        //echo "<pre>", print_r($_SESSION), "</pre>";
        //echo '<pre>'.print_r($_POST, true).'</pre>';
        //echo "<pre>", print_r($events_in_session), "</pre>";
        //echo "<pre>", print_r($org_options), "</pre>";
        $event_name = $count_of_events . ' ' . $org_options['organization'] . __(' events', 'event_espresso');
        $event_cost = $_SESSION['espresso_session']['grand_total'];
        $multi_reg = true;
        // If there are events in the session, add them one by one to the attendee table
        if ($count_of_events > 0) {
            //first event key will be used to find the first attendee
            $first_event_id = key($events_in_session);
            //Debug
            //echo '<pre>$events_in_session - '.print_r($events_in_session, true).'</pre>';
            reset($events_in_session);
            foreach ($events_in_session as $key => $_event_id) {
                //Debug
                //echo '<p>$_event_id - '. $_event_id.'</p>';
                //echo '<pre>'.print_r($_event_id, true).'</pre>';
                $event_meta = event_espresso_get_event_meta($key);
                $event_attendees = $_event_id['event_attendees'];
                $session_vars['data'] = $_event_id;
                //Debug
                //echo '<p>$_event_id - '. $_event_id.'</p>';
                //echo '<pre>'.print_r($session_vars['data'], true).'</pre>';
                if (is_array($event_attendees)) {
                    $counter = 1;
                    foreach ($event_attendees as $k_price_id => $v_attendees) {
                        //foreach price type in event attendees
                        $session_vars['data'] = $_event_id;
                        //Debug
                        //echo '<pre>$session_vars[\'data\' - ]'.print_r($session_vars['data'], true).'</pre>';
                        foreach ($v_attendees as $vkey => $vval) {
                            //Added by Imon
                            $vval['price_id'] = $k_price_id;
                            $session_vars['event_attendees'] = $vval;
                            //this has all the attendee information, name, questions....
                            $session_vars['data']['price_type'] = $_event_id['price_id'][$k_price_id]['price_type'];
                            if (isset($event_meta['additional_attendee_reg_info']) && $event_meta['additional_attendee_reg_info'] == 1) {
                                //Getting he wrong number of attendees at this point
                                //Debug
                                //echo '<p>$_REQUEST[\'num_people\'] - '.$_REQUEST['num_people'].'</p>';
                                //echo '<p>$_event_id[\'price_id\'][$k_price_id] - '.$_event_id['price_id'][$k_price_id].'</p>';
                                //echo '<pre>$_event_id[\'price_id\'][$k_price_id] - '.print_r($_event_id['price_id'][$k_price_id]['attendee_quantity'], true).'</pre>';
                                //echo '<pre>'.print_r($_POST, true).'</pre>';
                                $num_people = $_event_id['price_id'][$k_price_id]['attendee_quantity'];
                                $session_vars['data']['num_people'] = empty($num_people) || $num_people == 0 ? 1 : $num_people;
                                //Debug
                                //echo '<p>$session_vars[\'data\'][\'num_people\'] - '.$session_vars['data']['num_people'].'</p>';
                            }
                            //Debug
                            /* echo $key.'<br />';
                            	  echo '<pre>$session_vars - '.print_r($session_vars, true).'</pre>';
                            	  echo '<br />'; */
                            $tmp_registration_id = event_espresso_add_attendees_to_db($key, $session_vars);
                            //Debug
                            //echo 'tmp_registration_id =' . $tmp_registration_id.'<br />';
                            if ($primary_registration_id === NULL) {
                                $primary_registration_id = $tmp_registration_id;
                            }
                            $c2_sql = "select * from " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . " where primary_registration_id = '{$primary_registration_id}' and registration_id = '{$tmp_registration_id}'";
                            //Debug
                            //echo $c2_sql.'<br />';
                            $check = $wpdb->get_row($c2_sql);
                            if ($check === NULL) {
                                $tmp_data = array("primary_registration_id" => $primary_registration_id, "registration_id" => $tmp_registration_id);
                                $wpdb->insert(EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE, $tmp_data);
                            }
                        }
                        $counter++;
                    }
                }
            }
            //Post the gateway page with the payment options
            if ($event_cost != '0.00') {
                //find first registrant's name, email, count of registrants
                $sql = "SELECT id, fname, lname, email, address, city, state, zip, event_id, registration_id,\n\t\t\t\t\t\t(SELECT count( id )\n\t\t\t\t\t\t\tFROM " . EVENTS_ATTENDEE_TABLE . " WHERE attendee_session = '" . $wpdb->escape($current_session_id) . "'\n\t\t\t\t\t\t\t) AS quantity\n\t\t\t\t\t\t\tFROM " . EVENTS_ATTENDEE_TABLE . " WHERE event_id = " . $wpdb->escape($first_event_id) . " AND attendee_session = '" . $wpdb->escape($current_session_id) . "' LIMIT 1";
                //echo $sql;
                $r = $wpdb->get_row($sql);
                $event_id = $r->event_id;
                $attendee_id = $r->id;
                $fname = $r->fname;
                $lname = $r->lname;
                $address = $r->address;
                $city = $r->city;
                $state = $r->state;
                $zip = $r->zip;
                $attendee_email = $r->email;
                $registration_id = $r->registration_id;
                $quantity = espresso_count_attendees_for_registration($r->registration_id);
                ?>
				<?php 
                /* //removing edit links for now...will fix edit attendee page in 3.2 cb #830
                			<a href="?page_id=<?php echo $org_options['event_page_id']; ?>&regevent_action=show_shopping_cart">  <?php _e('Edit Cart', 'event_espresso'); ?> </a>
                			<?php _e(' or ', 'event_espresso'); ?>
                			<a href="?page_id=<?php echo $org_options['event_page_id']; ?>&regevent_action=load_checkout_page"> <?php _e('Edit Registrant Information', 'event_espresso'); ?></a>
                			*/
                ?>

				<h3><?php 
                _e('Your registration is not complete until payment is received.', 'event_espresso');
                ?>
</h3>

				<p><strong class="event_espresso_name">
						<?php 
                _e('Amount due: ', 'event_espresso');
                ?>
					</strong> <span class="event_espresso_value"><?php 
                echo $org_options['currency_symbol'];
                echo $event_cost;
                ?>
</span></p>

				<p><?php 
                echo $org_options['email_before_payment'] == 'Y' ? __('A confirmation email has been sent with additional details of your registration.', 'event_espresso') : '';
                ?>
</p>

				<?php 
                //Show payment options
                if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php")) {
                    require_once EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php";
                } else {
                    require_once EVENT_ESPRESSO_PLUGINFULLPATH . "gateways/gateway_display.php";
                }
                //Check to see if the site owner wants to send an confirmation eamil before payment is recieved.
                if ($org_options['email_before_payment'] == 'Y') {
                    event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true));
                }
            } else {
                ?>

				<p><?php 
                _e('Thank you! Your registration is confirmed for', 'event_espresso');
                ?>
 <strong><?php 
                echo stripslashes_deep($event_name);
                ?>
</strong></p>

				<p><?php 
                _e('A confirmation email has been sent with additional details of your registration.', 'event_espresso');
                ?>
</p>

				<?php 
                event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true));
                event_espresso_clear_session();
            }
        }
    }
Exemplo n.º 2
0
    function event_espresso_add_attendees_to_db_multi()
    {
        //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
        do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
        global $wpdb, $org_options;
        if (espresso_verify_recaptcha()) {
            $primary_registration_id = NULL;
            $multi_reg = true;
            $events_in_session = $_SESSION['espresso_session']['events_in_session'];
            if (event_espresso_invoke_cart_error($events_in_session)) {
                return false;
            }
            $count_of_events = count($events_in_session);
            $current_session_id = $_SESSION['espresso_session']['id'];
            $biz_name = $count_of_events . ' ' . $org_options['organization'] . __(' events', 'event_espresso');
            $event_cost = $_SESSION['espresso_session']['grand_total'];
            $event_cost = apply_filters('filter_hook_espresso_cart_grand_total', $event_cost);
            // If there are events in the session, add them one by one to the attendee table
            if ($count_of_events > 0) {
                //first event key will be used to find the first attendee
                $first_event_id = key($events_in_session);
                reset($events_in_session);
                foreach ($events_in_session as $event_id => $event) {
                    $event_meta = event_espresso_get_event_meta($event_id);
                    $session_vars['data'] = $event;
                    if (is_array($event['event_attendees'])) {
                        $counter = 1;
                        //foreach price type in event attendees
                        foreach ($event['event_attendees'] as $price_id => $event_attendees) {
                            $session_vars['data'] = $event;
                            foreach ($event_attendees as $attendee) {
                                $attendee['price_id'] = $price_id;
                                //this has all the attendee information, name, questions....
                                $session_vars['event_attendees'] = $attendee;
                                $session_vars['data']['price_type'] = $event['price_id'][$price_id]['price_type'];
                                if (isset($event_meta['additional_attendee_reg_info']) && $event_meta['additional_attendee_reg_info'] == 1) {
                                    $num_people = (int) $event['price_id'][$price_id]['attendee_quantity'];
                                    $session_vars['data']['num_people'] = empty($num_people) || $num_people == 0 ? 1 : $num_people;
                                }
                                // ADD ATTENDEE TO DB
                                $return_data = event_espresso_add_attendees_to_db($event_id, $session_vars, TRUE);
                                $tmp_registration_id = $return_data['registration_id'];
                                $notifications = $return_data['notifications'];
                                if ($primary_registration_id === NULL) {
                                    $primary_registration_id = $tmp_registration_id;
                                }
                                $SQL = "SELECT * FROM " . EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE . "  ";
                                $SQL .= "WHERE primary_registration_id = %s AND registration_id = %s";
                                $check = $wpdb->get_row($wpdb->prepare($SQL, $primary_registration_id, $tmp_registration_id));
                                if ($check === NULL) {
                                    $tmp_data = array('primary_registration_id' => $primary_registration_id, 'registration_id' => $tmp_registration_id);
                                    $wpdb->insert(EVENTS_MULTI_EVENT_REGISTRATION_ID_GROUP_TABLE, $tmp_data, array('%s', '%s'));
                                }
                                $counter++;
                            }
                        }
                    }
                }
                $SQL = "SELECT a.*, ed.id AS event_id, ed.event_name, dc.coupon_code_price, dc.use_percentage ";
                $SQL .= "FROM " . EVENTS_ATTENDEE_TABLE . " a JOIN " . EVENTS_DETAIL_TABLE . " ed ON a.event_id=ed.id ";
                $SQL .= "LEFT JOIN " . EVENTS_DISCOUNT_CODES_TABLE . " dc ON a.coupon_code=dc.coupon_code ";
                $SQL .= "WHERE attendee_session=%s ORDER BY a.id ASC";
                $attendees = $wpdb->get_results($wpdb->prepare($SQL, $current_session_id));
                //printr( $attendees, '$attendees  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
                $quantity = 0;
                $final_total = 0;
                $sub_total = 0;
                $discounted_total = 0;
                $discount_amount = 0;
                //$coupon_amount = ! empty($attendees[0]->coupon_code_price) ? $attendees[0]->coupon_code_price : 0;
                $is_coupon_pct = !empty($attendees[0]->use_percentage) && $attendees[0]->use_percentage == 'Y' ? TRUE : FALSE;
                //printr( $attendees, '$attendees  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
                foreach ($attendees as $attendee) {
                    if ($attendee->is_primary) {
                        $primary_attendee_id = $attendee_id = $attendee->id;
                        $coupon_code = $attendee->coupon_code;
                        $event_id = $attendee->event_id;
                        $fname = $attendee->fname;
                        $lname = $attendee->lname;
                        $address = $attendee->address;
                        $city = $attendee->city;
                        $state = $attendee->state;
                        $zip = $attendee->zip;
                        $attendee_email = $attendee->email;
                        $registration_id = $attendee->registration_id;
                    }
                    $final_total += $attendee->final_price;
                    $sub_total += (int) $attendee->quantity * $attendee->orig_price;
                    $discounted_total += (int) $attendee->quantity * $attendee->final_price;
                    $quantity += (int) $attendee->quantity;
                    //echo '<h2>$attendee->id : ' . $attendee->id . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h2>';
                    //echo '<h4>$attendee->orig_price : ' . $attendee->orig_price . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                    //echo '<h4>$attendee->final_price : ' . $attendee->final_price . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                    //echo '<h4>$attendee->quantity : ' . (int)$attendee->quantity . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                    //echo '<h4>$sub_total : ' . $sub_total . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                    //echo '<h4>$discounted_total : ' . $discounted_total . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                }
                $discount_amount = $sub_total - $discounted_total;
                $total_cost = $discounted_total;
                //echo '<h4>$discount_amount : ' . $discount_amount . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                //echo '<h4>$total_cost : ' . $total_cost . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                //echo '<h4>$final_total : ' . $final_total . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4><br/>';
                $total_cost = $total_cost < 0 ? 0.0 : (double) $total_cost;
                if (function_exists('espresso_update_attendee_coupon_info') && $primary_attendee_id && !empty($attendee->coupon_code)) {
                    espresso_update_attendee_coupon_info($primary_attendee_id, $attendee->coupon_code);
                }
                if (function_exists('espresso_update_groupon') && $primary_attendee_id && !empty($coupon_code)) {
                    espresso_update_groupon($primary_attendee_id, $coupon_code);
                }
                espresso_update_primary_attendee_total_cost($primary_attendee_id, $total_cost, __FILE__);
                //echo '<h4>$total_cost : ' . $total_cost . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                if (!empty($notifications['coupons']) || !empty($notifications['groupons'])) {
                    echo '<div id="event_espresso_notifications" class="clearfix event-data-display no-hide">';
                    echo $notifications['coupons'];
                    // add space between $coupon_notifications and  $groupon_notifications ( if any $groupon_notifications exist )
                    echo !empty($notifications['coupons']) && !empty($notifications['groupons']) ? '<br/>' : '';
                    echo $notifications['groupons'];
                    echo '</div>';
                }
                //Post the gateway page with the payment options
                if ($total_cost > 0) {
                    ?>

<div class="espresso_payment_overview event-display-boxes ui-widget" >
  <h3 class="section-heading ui-widget-header ui-corner-top">
		<?php 
                    _e('Payment Overview', 'event_espresso');
                    ?>
  </h3>
	<div class="event-data-display ui-widget-content ui-corner-bottom" >

		<div class="event-messages ui-state-highlight"> <span class="ui-icon ui-icon-alert"></span>
			<p class="instruct">
				<?php 
                    _e('Your registration is not complete until payment is received.', 'event_espresso');
                    ?>
			</p>
		</div>
		<p><?php 
                    echo $org_options['email_before_payment'] == 'Y' ? __('A confirmation email has been sent with additional details of your registration.', 'event_espresso') : '';
                    ?>
</p>
		<table>
			<?php 
                    foreach ($attendees as $attendee) {
                        ?>
			<tr>
				<td width="70%">
					<?php 
                        echo '<strong>' . stripslashes_deep($attendee->event_name) . '</strong>';
                        ?>
&nbsp;-&nbsp;<?php 
                        echo stripslashes_deep($attendee->price_option);
                        ?>
 <?php 
                        echo $attendee->final_price < $attendee->orig_price ? '<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size:.8em;">' . $org_options['currency_symbol'] . number_format($attendee->orig_price - $attendee->final_price, 2) . __(' discount per registration', 'event_espresso') . '</span>' : '';
                        ?>
<br/>
					&nbsp;&nbsp;&nbsp;&nbsp;<?php 
                        echo __('Attendee:', 'event_espresso') . ' ' . stripslashes_deep($attendee->fname . ' ' . $attendee->lname);
                        ?>
				</td>
				<td width="10%"><?php 
                        echo $org_options['currency_symbol'] . number_format($attendee->final_price, 2);
                        ?>
</td>
				<td width="10%"><?php 
                        echo 'x ' . (int) $attendee->quantity;
                        ?>
</td>
				<td width="10%" style="text-align:right;"><?php 
                        echo $org_options['currency_symbol'] . number_format($attendee->final_price * (int) $attendee->quantity, 2);
                        ?>
</td>
			</tr>
			<?php 
                    }
                    ?>
			
			<tr>
				<td colspan="3"><?php 
                    _e('Sub-Total:', 'event_espresso');
                    ?>
</td>
				<td colspan="" style="text-align:right"><?php 
                    echo $org_options['currency_symbol'] . number_format($sub_total, 2);
                    ?>
</td>
			</tr>
			<?php 
                    if (!empty($discount_amount)) {
                        ?>
			<tr>
				<td colspan="3"><?php 
                        _e('Total Discounts:', 'event_espresso');
                        ?>
</td>
				<td colspan="" style="text-align:right"><?php 
                        echo '-' . $org_options['currency_symbol'] . number_format($discount_amount, 2);
                        ?>
</td>
			</tr>
			<?php 
                    }
                    ?>
			<tr>
				<td colspan="3"><strong class="event_espresso_name">
					<?php 
                    _e('Total Amount due: ', 'event_espresso');
                    ?>
					</strong></td>
				<td colspan="" style="text-align:right"><?php 
                    echo $org_options['currency_symbol'];
                    echo number_format($total_cost, 2);
                    ?>
</td>
			</tr>
		</table>
		<p class="event_espresso_refresh_total">
			<a href="?page_id=<?php 
                    echo $org_options['event_page_id'];
                    ?>
&regevent_action=show_shopping_cart">
			<?php 
                    _e('Edit Cart', 'event_espresso');
                    ?>
			</a>
			<?php 
                    _e(' or ', 'event_espresso');
                    ?>
			<a href="?page_id=<?php 
                    echo $org_options['event_page_id'];
                    ?>
&registration_id=<?php 
                    echo $registration_id;
                    ?>
&id=<?php 
                    echo $attendee_id;
                    ?>
&regevent_action=edit_attendee&primary=<?php 
                    echo $primary_attendee_id;
                    ?>
&event_id=<?php 
                    echo $event_id;
                    ?>
&attendee_num=1">
			<?php 
                    _e('Edit Registrant Information', 'event_espresso');
                    ?>
			</a> 
		</p>
	</div>
</div>
<br/><br/>
<?php 
                    //Show payment options
                    if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php")) {
                        require_once EVENT_ESPRESSO_GATEWAY_DIR . "gateway_display.php";
                    } else {
                        require_once EVENT_ESPRESSO_PLUGINFULLPATH . "gateways/gateway_display.php";
                    }
                    //Check to see if the site owner wants to send an confirmation eamil before payment is recieved.
                    if ($org_options['email_before_payment'] == 'Y') {
                        event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true));
                    }
                } elseif ($total_cost == 0.0) {
                    ?>
<p>
	<?php 
                    _e('Thank you! Your registration is confirmed for', 'event_espresso');
                    ?>
	<strong><?php 
                    echo stripslashes_deep($biz_name);
                    ?>
</strong></p>
<p>
	<?php 
                    _e('A confirmation email has been sent with additional details of your registration.', 'event_espresso');
                    ?>
</p>
<?php 
                    event_espresso_email_confirmations(array('session_id' => $_SESSION['espresso_session']['id'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true', 'multi_reg' => true));
                    event_espresso_clear_session();
                }
            }
        }
    }
Exemplo n.º 3
0
    function event_espresso_shopping_cart()
    {
        global $wpdb, $org_options;
        //session_destroy();
        //echo "<pre>", print_r( $_SESSION ), "</pre>";
        $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;
        }
        if (count($events_in_session) > 0) {
            foreach ($events_in_session as $event) {
                // echo $event['id'];
                if (is_numeric($event['id'])) {
                    $events_IN[] = $event['id'];
                }
            }
            $events_IN = implode(',', $events_IN);
            $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 ";
            //echo '<h4>$sql : ' . $sql . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
            $result = $wpdb->get_results($sql);
            ?>

<form action='?page_id=<?php 
            echo $org_options['event_page_id'];
            ?>
&regevent_action=load_checkout_page' method='post' id="event_espresso_shopping_cart">

<?php 
            $counter = 1;
            //Counter that will keep track of the first events
            foreach ($result as $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 "<pre>$r->id, $num_attendees,$available_spaces,$number_available_spaces</pre>";
                    ?>
				<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"> <img class="ee_delete_item_from_cart" id="cart_link_<?php 
                    echo $r->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 
            }
            ?>
			
			<?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 
            }
            ?>
			
             <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 
            _e('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">
				<a id="event_espresso_refresh_total" style="cursor:pointer;"><?php 
            _e('Refresh Total', 'event_espresso');
            ?>
</a>
			</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');
            ?>
&nbsp;&raquo;" />
			</p>
			
		</div><!-- / .mer-event-submit -->
	</div><!-- / .event-display-boxes -->
</form>
<?php 
        }
    }
Exemplo n.º 4
0
 function event_espresso_cart_link($atts)
 {
     do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
     global $wpdb, $org_options, $this_event_id;
     $events_in_session = isset($_SESSION['espresso_session']['events_in_session']) ? $_SESSION['espresso_session']['events_in_session'] : event_espresso_clear_session(TRUE);
     extract(shortcode_atts(array('event_id' => $this_event_id, 'anchor' => __('Register', 'event_espresso'), 'event_name' => ' ', 'separator' => NULL, 'view_cart' => FALSE, 'event_page_id' => $org_options['event_page_id'], 'direct_to_cart' => 0, 'moving_to_cart' => "Please wait redirecting to cart page"), $atts));
     if (empty($event_id)) {
         $error = "<div class='event_espresso_error'><p><em>" . __('Attention', 'event_espresso') . "</em>";
         $error .= __('An error occured, a valid event id is required for this shortcode to function properly.', 'event_espresso');
         $error .= "</p></div>";
         return $error;
     }
     $registration_cart_class = '';
     // if event is already in session, return the view cart link  		array_key_exists($event_id, $events_in_session)
     if ($view_cart || is_array($events_in_session) && isset($events_in_session[$event_id])) {
         $registration_cart_url = add_query_arg('regevent_action', 'show_shopping_cart', get_permalink($org_options['event_page_id']));
         //$registration_cart_url = get_option('siteurl') . '/?page_id=' . $event_page_id . '&regevent_action=show_shopping_cart';
         $anchor = __("View Cart", 'event_espresso');
     } else {
         $event_ids = explode('-', $event_id);
         if (is_array($event_ids)) {
             $SQL = "SELECT id, is_active, event_status, registration_start, registration_startT, registration_end, registration_endT ";
             $SQL .= "FROM " . EVENTS_DETAIL_TABLE . " e ";
             $SQL .= "WHERE id IN ( " . str_replace('cart_link_', '', implode(', ', $event_ids)) . " )";
             $events = $wpdb->get_results($SQL, OBJECT_K);
             $event_ids = array_flip($event_ids);
             foreach ($events as $event) {
                 $reg_start = strtotime($event->registration_start . " " . $event->registration_startT);
                 $reg_end = strtotime($event->registration_end . " " . $event->registration_endT);
                 if ($event->is_active != "Y" || time() < $reg_start || time() > $reg_end && $event->event_status != 'O' || !in_array($event->event_status, array('A', 'O', 'S'))) {
                     unset($event_ids[$event->id]);
                     unset($event_ids['cart_link_' . $event->id]);
                     if (is_array($events_in_session) && isset($events_in_session[$event->id])) {
                         unset($events_in_session[$event->id]);
                     }
                 }
             }
             $event_ids = array_flip($event_ids);
         }
         $event_id = implode('-', $event_ids);
         if (empty($event_id)) {
             $error = "<div class='event_espresso_error'><p><em>" . __('Attention', 'event_espresso') . "</em><br />";
             $error .= __('We\'re sorry. Either an error occurred or the event(s) you were attempting to register for may no longer be open for registration.', 'event_espresso');
             $error .= "</p></div>";
             return empty($events_in_session) ? $error : '';
         }
         //show them the add to cart link
         $registration_cart_url = isset($externalURL) && $externalURL != '' ? $externalURL : add_query_arg('event_id', $event_id, get_permalink($org_options['event_page_id']));
         $registration_cart_class = 'ee_add_item_to_cart';
     }
     ob_start();
     if ($view_cart && $direct_to_cart == 1) {
         echo "<span id='moving_to_cart'>{$moving_to_cart}</span>";
         echo "<script language='javascript'>window.location='" . $registration_cart_url . "';</script>";
     } else {
         echo $separator . ' <a class="ee_view_cart ' . $registration_cart_class . '" id="cart_link_' . $event_id . '" href="' . $registration_cart_url . '" title="' . stripslashes_deep($event_name) . '" moving_to_cart="' . urlencode($moving_to_cart) . '" direct_to_cart="' . $direct_to_cart . '" >' . $anchor . '</a>';
     }
     $buffer = ob_get_contents();
     ob_end_clean();
     return $buffer;
 }
Exemplo n.º 5
0
 function event_espresso_cart_link($atts)
 {
     do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
     global $org_options, $this_event_id;
     $events_in_session = isset($_SESSION['espresso_session']['events_in_session']) ? $_SESSION['espresso_session']['events_in_session'] : event_espresso_clear_session(TRUE);
     extract(shortcode_atts(array('event_id' => $this_event_id, 'anchor' => __('Register', 'event_espresso'), 'event_name' => ' ', 'separator' => NULL, 'view_cart' => FALSE, 'event_page_id' => $org_options['event_page_id'], 'direct_to_cart' => 0, 'moving_to_cart' => "Please wait redirecting to cart page"), $atts));
     $registration_cart_class = '';
     ob_start();
     // if event is already in session, return the view cart link
     if ($view_cart || is_array($events_in_session) && array_key_exists($event_id, $events_in_session)) {
         $registration_cart_url = get_option('siteurl') . '/?page_id=' . $event_page_id . '&regevent_action=show_shopping_cart';
         $registration_cart_anchor = __("View Cart", 'event_espresso');
     } else {
         //show them the add to cart link
         $registration_cart_url = isset($externalURL) && $externalURL != '' ? $externalURL : get_option('siteurl') . '/?page_id=' . $event_page_id . '&regevent_action=add_event_to_cart&event_id=' . $event_id . '&name_of_event=' . stripslashes_deep($event_name);
         $registration_cart_anchor = $anchor;
         $registration_cart_class = 'ee_add_item_to_cart';
     }
     if ($view_cart && $direct_to_cart == 1) {
         echo "<span id='moving_to_cart'>{$moving_to_cart}</span>";
         echo "<script language='javascript'>window.location='" . $registration_cart_url . "';</script>";
     } else {
         echo $separator . ' <a class="ee_view_cart ' . $registration_cart_class . '" id="cart_link_' . $event_id . '" href="' . $registration_cart_url . '" title="' . stripslashes_deep($event_name) . '" moving_to_cart="' . urlencode($moving_to_cart) . '" direct_to_cart="' . $direct_to_cart . '" >' . $registration_cart_anchor . '</a>';
     }
     $buffer = ob_get_contents();
     ob_end_clean();
     return $buffer;
 }