Fixed problem determining if cart had already been checked out.
Billing contact form is now hidden if "Same as account info" is checked.
Cart and checkout summaries are now checking to see if the rate data line should be displayed in cart.
Avoiding certain work in the checkout process if checkout is not successful
public function checkRegistrationRequest($requestId = false, $json = false, $noReturn = false)
{
- $this->cart['blockCheckout'] = false;
-
// Try to get the cart data
$this->getRegistrationCart($requestId, false, true);
+ $this->cart['blockCheckout'] = false;
+
// If cart status is false, then we don't have a cart so return now
if (!$this->cart['status']) {
$this->cart['blockCheckout'] = true;
public function modelAction($actionData = false)
{
- $cartId = false;
- $haveCart = false;
- $option = false;
+ $cartId = false;
+ $haveCart = false;
+ $option = false;
+ $blockCheckout = false;
// Get misc texts
require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataMisc.php';
$regPayment = false;
$cardData = false;
$cardTypeMatch = false;
+ $billingSame = false;
$billing = false;
$payment = false;
$ccConfirmation = '';
}
+ // Check if cart has been successfully checked out or has been marked canceled.
+ if ($this->cart['request']['status']['value'] > 0) {
+
+ $messages[] = "This request has already been submitted!<br>The information below is a summary of your submitted request.";
+
+ // Build check code for display of summary in iframe
+ $summaryCheck = md5($this->cart['request']['id'].GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET.$this->cart['request']['account']);
+
+ $view = 'summary';
+
+ // Compile template data
+ $templateData = array(
+ 'haveMessages' => count($messages),
+ 'messages' => $messages,
+ 'requestId' => $this->cart['request']['id'],
+ 'summaryCheck' => $summaryCheck,
+ 'misc' => $misc
+ );
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'front/registrations/' . $view . '.html',
+ 'data' => $templateData
+ );
+
+ }
+
/*
* Submission account?
*/
+ // Check if we need to collect billing account information or if it's the same as the main contact
+ if (isset($_REQUEST['billing_same']) && $_REQUEST['billing_same']) {
+ $billingSame = true;
+ }
+
if (count($messages) == 0) {
// If there's a logged in registrations user - Cart should already be with this account
$request = $Request->getEntry($this->cart['request']['id']);
$account = $Account->getEntry($request['account']);
- // Produce HTML for storage and checkout page and add to request
- $summaryData = array(
- 'cart' => $this->cart,
- 'request' => $request,
- 'account' => $account,
- 'payMethodsNumb' => $this->config['payment_method_numb'],
- 'status' => $this->config['submission_status'],
- 'misc' => $misc
- );
- $summary = $this->generateCheckoutConfHTML($summaryData, 'front/registrations/summaryStore.html');
- $updated = $this->wpdb->update(
- GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
- array(
- 'summary' => $summary
- ),
- array( 'id' => $requestId ),
- array('%s')
+ if (count($messages) == 0) {
+
+ // Produce HTML for storage and checkout page and add to request
+ $summaryData = array(
+ 'cart' => $this->cart,
+ 'request' => $request,
+ 'account' => $account,
+ 'payMethodsNumb' => $this->config['payment_method_numb'],
+ 'status' => $this->config['submission_status'],
+ 'misc' => $misc
);
+ $summary = $this->generateCheckoutConfHTML($summaryData, 'front/registrations/summaryStore.html');
+ $updated = $this->wpdb->update(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
+ array(
+ 'summary' => $summary
+ ),
+ array( 'id' => $requestId ),
+ array('%s')
+ );
+
+ }
if (count($messages) == 0) {
}
-
/*
* If all is done correctly, use model redirect to go to Step 4 - Dispaly summary
*/
if (count($messages) != 0) {
+
+ // Include the billing info same flag
+ $regAccount['billingSame'] = $billingSame;
+
$view = 'checkout';
+
$templateData = array(
'request' => array('page' => 'checkout'),
'haveMessages' => count($messages),
'regAccount' => $regAccount,
'regPayment' => $regPayment,
'payMethod' => $payMethod,
- 'cardData' => $cardData
+ 'cardData' => $cardData,
);
return array(
'status' => true,
<td>{$registrant.fname} {$registrant.lname}</td>
<td>{$registrant.event_time}</td>
<td style="text-align: right;">
- {if $registrant.registrantDiscount > 0}
- {$registrant.registrantDiscount|number_format:2}
+ {if $registrant.registrantDiscounts > 0}
+ {$registrant.registrantDiscounts|number_format:2}
{else}
{/if}
</div>
<div class="glm-large-6 glm-columns" style="">
<div class="glm-reg-row"><div class="glm-large-12 glm-columns"><h4>Billing Information</h4></div></div>
- <div class="glm-reg-row"><div class="glm-large-12 glm-columns"><input type="checkbox" name="billing_same" value="1"> Same as Account Information</div></div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row"><div class="glm-large-12 glm-columns"><input id="glm-reg-bill-same" type="checkbox" name="billing_same" value="1"{if $regAccount.billingSame} checked{/if}> Same as Account Information</div></div>
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_fname} glm-reg-required{/if}">First Name:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_fname} glm-reg-fail{/if}"><input type="text" name="bill_fname" value="{$regAccount.fieldData.bill_fname}"{if $regAccount.fieldRequired.bill_fname} required{/if}></div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_lname} glm-reg-required{/if}">Last Name:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_lname} glm-reg-fail{/if}"><input type="text" name="bill_lname" value="{$regAccount.fieldData.bill_lname}"{if $regAccount.fieldRequired.bill_lname} required{/if}></div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_addr1} glm-reg-required{/if}">Address:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_addr1} glm-reg-fail{/if}"><input type="text" name="bill_addr1" value="{$regAccount.fieldData.bill_addr1}"{if $regAccount.fieldRequired.bill_addr1} required{/if}></div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_addr2} glm-reg-required{/if}"> </div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_addr1} glm-reg-fail{/if}"><input type="text" name="bill_addr2" value="{$regAccount.fieldData.bill_addr2}"{if $regAccount.fieldRequired.bill_addr2} required{/if}></div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_city} glm-reg-required{/if}">City:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_city} glm-reg-fail{/if}"><input type="text" name="bill_city" value="{$regAccount.fieldData.bill_city}"{if $regAccount.fieldRequired.bill_city} required{/if}></div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_state} glm-reg-required{/if}">State:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_state} glm-reg-fail{/if}">
<select name="bill_state">
</select>
</div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_zip} glm-reg-required{/if}">Zip/Postal Code:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_zip} glm-reg-fail{/if}"><input type="text" name="bill_zip" value="{$regAccount.fieldData.bill_zip}"{if $regAccount.fieldRequired.bill_zip} required{/if}></div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_country} glm-reg-required{/if}">Country:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_country} glm-reg-fail{/if}">
<select name="bill_country">
</select>
</div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_phone} glm-reg-required{/if}">Phone:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_phone} glm-reg-fail{/if}"><input type="text" name="bill_phone" value="{$regAccount.fieldData.bill_phone}"{if $regAccount.fieldRequired.bill_phone} required{/if}></div>
</div>
- <div class="glm-reg-row">
+ <div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_fax} glm-reg-required{/if}">FAX:</div>
<div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_fax} glm-reg-fail{/if}"><input type="text" name="bill_fax" value="{$regAccount.fieldData.bill_fax}"{if $regAccount.fieldRequired.fax} required{/if}></div>
</div>
<div class="glm-large-1"> </div>
<div class="glm-large-11 glm-columns glm-reg-nowrap">
<h5>General Registrations Terms and Conditions:</h5>
- <input id="terms" type="checkbox" name="terms" value="accept" required><label for="terms_{$event.id}"> {$globalTerms}</label><br>
+ <input id="terms" type="checkbox" name="terms" value="accept" required><label for="terms"> {$globalTerms}</label><br>
</div>
</div>
{foreach $cart.events as $event}
<td colspan="5"> {$class.class_name}</td>
</tr>
{foreach $class.rates as $rate}
+ {if $rate.rateBaseCharge || $rate.registrant_credits}
<tr>
<td colspan="4">
{$rate.rate_name}
- Base Rate ({$rate.registrant_credits} registrants included)
</td>
- <td style="text-align: right;">{$rate.rateBaseCharge|number_format:2}</td>
+ <td style="text-align: right;">
+ {if $rate.rateBaseCharge}{$rate.rateBaseCharge|number_format:2}{/if}
+ </td>
</tr>
+ {/if}
{foreach $rate.registrants as $registrant}
<tr>
<td> </td>
$('.payMethodSelector').on('change', function() {
// Get the value from the selected Payment Method
- var payMethod = $(this).val()
+ var payMethod = $(this).val();
// Hide all pay method inputs and dissable them all
$('.payMethodSelection').addClass('glm-hidden');
});
+ $('#glm-reg-bill-same').on('change', function() {
+ isBillSameChecked();
+ });
+ function isBillSameChecked() {
+ if ($("#glm-reg-bill-same").is(':checked')) {
+ $('.glm-reg-bill-field').addClass('glm-hidden');
+ } else {
+ $('.glm-reg-bill-field').removeClass('glm-hidden');
+ }
+ };
+ isBillSameChecked();
+
// Various input masks for credit card input
$(".cc-input").mask("9999999999999?999");
$(".expire-input").mask("99/99");
<div>
{$misc.summary_page_text}
</div>
+
+{if $haveMessages}
+ <p> </p>
+ <div class="glm-registrations-messages glm-reg-warning" style="clear: all;">
+ <i>Please Note:</i>
+ <ul>
+{foreach $messages as $m}
+ <li>{$m}</li>
+{/foreach}
+ </ul>
+ </div>
+{/if}
+
<div>
<iframe src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=summaryContent&request={$requestId}&check={$summaryCheck}"
style="border:none; width: 100%"
{if $account.org}{$account.org}<br>{/if}
{$account.addr1}<br>
{if $account.addr2}{$account.addr2}<br>{/if}
- {$account.city}, {$account.state} {$account.zip} {$account.country.value}<br>
+ {$account.city}, {$account.state.name} {$account.zip} {$account.country.value}<br>
</td>
</tr>
{if $account.phone}
{if $request.bill_org}{$request.bill_org}<br>{/if}
{$request.bill_addr1}<br>
{if $request.bill_addr2}{$request.bill_addr2}<br>{/if}
- {$request.bill_city}, {$request.bill_state} {$request.bill_zip} {$request.country.bill_value}<br>
+ {$request.bill_city}, {$request.bill_state} {$request.bill_zip} {$request.bill_country}<br>
</td>
</tr>
{if $request.bill_phone}