?> </label> <?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array); } else { echo tep_draw_input_field('state'); } } else { echo tep_draw_input_field('state', isset($entry['entry_country_id']) ? tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : ''); } ?> </div> <?php } ?> <div class="form-group"> <label><?php echo (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<sup class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</sup>' : '') . ENTRY_COUNTRY; ?> </label> <?php echo tep_get_country_list('country', isset($entry['entry_country_id']) ? $entry['entry_country_id'] : STORE_COUNTRY); ?> </div>
if (tep_not_null(ENTRY_CITY_TEXT)) { $xoopsTpl->assign("city_entry", '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>'); } if (ACCOUNT_STATE == 'true') { $xoopsTpl->assign("state", 1); if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } $xoopsTpl->assign("cstate", tep_draw_pull_down_menu('state', $zones_array)); } else { $xoopsTpl->assign("cstate", tep_draw_input_field('state')); } } else { $xoopsTpl->assign("cstate", tep_draw_input_field('state', tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']))); } if (tep_not_null(ENTRY_STATE_TEXT)) { $xoopsTpl->assign("state_entry", ' <span class="inputRequirement">' . ENTRY_STATE_TEXT); } } $xoopsTpl->assign("country", tep_get_country_list('country', $entry['entry_country_id'])); if (tep_not_null(ENTRY_COUNTRY_TEXT)) { $xoopsTpl->assign("country_entry", '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>'); } if (isset($HTTP_GET_VARS['edit']) && $customer_default_address_id != $HTTP_GET_VARS['edit'] || isset($HTTP_GET_VARS['edit']) == false) { $xoopsTpl->assign("primary", 1); $xoopsTpl->assign("primary_field", tep_draw_checkbox_field('primary', 'on', false, 'id="primary"')); }
?> </td> <td class="main" width="70%"> <?php if ($action == 'save' && isset($entry_state_has_zones) && $entry_state_has_zones === true) { $Qzones = $osC_Database->query('select zone_name from :table_zones where zone_country_id = :zone_country_id order by zone_name'); $Qzones->bindTable(':table_zones', TABLE_ZONES); $Qzones->bindInt(':zone_country_id', $_POST['ab_country']); $Qzones->execute(); $zones_array = array(); while ($Qzones->next()) { $zones_array[] = array('id' => $Qzones->value('zone_name'), 'text' => $Qzones->value('zone_name')); } echo osc_draw_pull_down_menu('ab_state', $zones_array, '', '', ACCOUNT_STATE > 0); } else { echo osc_draw_input_field('ab_state', isset($Qab) ? tep_get_zone_name($Qab->value('entry_country_id'), $Qab->value('entry_zone_id'), $Qab->value('entry_state')) : '', '', ACCOUNT_STATE > 0); } ?> </td> </tr> <?php } ?> <tr> <td class="main" width="30%"><?php echo ENTRY_COUNTRY; ?> </td> <td class="main" width="70%"><?php echo osc_draw_pull_down_menu('ab_country', tep_get_countries(), isset($Qab) ? $Qab->value('entry_country_id') : STORE_COUNTRY, '', true); ?>
</label> <div class="col-sm-9"> <?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array, 0, 'id="inputState"'); } else { echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE . '"'); } } else { echo tep_draw_input_field('state', isset($entry['entry_country_id']) ? tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : '', 'required aria-required="true" id="inputState" placeholder="' . ENTRY_STATE . '"'); } if (tep_not_null(ENTRY_STATE_TEXT)) { echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; } ?> </div> </div> <?php } ?> <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY;
if ($entry_state_error == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($cInfo->entry_country_id) . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR; } else { echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . ENTRY_STATE_ERROR; } } else { echo $entry_state . tep_draw_hidden_field('entry_zone_id') . tep_draw_hidden_field('entry_state'); } } else { echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)); } ?> </td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_COUNTRY; ?> </td> <td class="main"> <?php if ($error == true) {
<?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $Qzones = $OSCOM_Db->prepare('select zone_name from :table_zones where zone_country_id = :zone_country_id order by zone_name'); $Qzones->bindInt(':zone_country_id', $country); $Qzones->execute(); while ($Qzones->fetch()) { $zones_array[] = array('id' => $Qzones->value('zone_name'), 'text' => $Qzones->value('zone_name')); } echo HTML::selectField('state', $zones_array, 0, 'id="inputState" aria-describedby="atState"'); } else { echo HTML::inputField('state', NULL, 'id="inputState" placeholder="' . OSCOM::getDef('entry_state_text') . '"'); } } else { echo HTML::inputField('state', isset($entry['entry_country_id']) ? tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : '', 'id="inputState" placeholder="' . OSCOM::getDef('entry_state_text') . '"'); } if (tep_not_null(OSCOM::getDef('entry_state_text'))) { echo '<span id="atState" class="help-block">' . OSCOM::getDef('entry_state_text') . '</span>'; } ?> </div> </div> <?php } ?> <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo OSCOM::getDef('entry_country');
if ($entry_state_error) { if ($entry_state_has_zones) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($country) . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array) . ' ' . ENTRY_STATE_ERROR; } else { echo tep_draw_input_field('state') . ' ' . ENTRY_STATE_ERROR; } } else { echo $state . tep_draw_hidden_field('zone_id') . tep_draw_hidden_field('state'); } } else { echo '<label class="sr-only"></label>' . tep_draw_input_field('state', '', 'class="form-control" placeholder="' . ENTRY_STATE . '"', tep_get_zone_name($account['entry_country_id'], isset($account['entry_zone_id']) ? $account['entry_zone_id'] : 0, isset($account['entry_state']) ? $account['entry_state'] : 0)); } ?> </div> <?php } ?> <div class="form-group"> <?php if ($is_read_only) { echo $account['entry_postcode']; } elseif ($error) { if ($entry_post_code_error) { echo tep_draw_input_field('postcode', '', 'maxlength="10"') . ' ' . ENTRY_POST_CODE_ERROR; } else { echo $postcode . tep_draw_hidden_field('postcode');
function confirmation() { global $customer_id, $order, $currencies; $months_array = array(); for ($i = 1; $i < 13; $i++) { $months_array[] = array('id' => tep_output_string(sprintf('%02d', $i)), 'text' => tep_output_string_protected(sprintf('%02d', $i))); } $today = getdate(); $years_array = array(); for ($i = $today['year']; $i < $today['year'] + 10; $i++) { $years_array[] = array('id' => tep_output_string(strftime('%Y', mktime(0, 0, 0, 1, 1, $i))), 'text' => tep_output_string_protected(strftime('%Y', mktime(0, 0, 0, 1, 1, $i)))); } $months_string = '<select data-stripe="exp_month">'; foreach ($months_array as $m) { $months_string .= '<option value="' . tep_output_string($m['id']) . '">' . tep_output_string($m['text']) . '</option>'; } $months_string .= '</select>'; $years_string = '<select data-stripe="exp_year">'; foreach ($years_array as $y) { $years_string .= '<option value="' . tep_output_string($y['id']) . '">' . tep_output_string($y['text']) . '</option>'; } $years_string .= '</select>'; $content = ''; if (MODULE_PAYMENT_STRIPE_TOKENS == 'True') { $tokens_query = tep_db_query("select id, card_type, number_filtered, expiry_date from customers_stripe_tokens where customers_id = '" . (int) $customer_id . "' order by date_added"); if (tep_db_num_rows($tokens_query) > 0) { $content .= '<table id="stripe_table" border="0" width="100%" cellspacing="0" cellpadding="2">'; while ($tokens = tep_db_fetch_array($tokens_query)) { $content .= '<tr class="moduleRow" id="stripe_card_' . (int) $tokens['id'] . '">' . ' <td width="40" valign="top"><input type="radio" name="stripe_card" value="' . (int) $tokens['id'] . '" /></td>' . ' <td valign="top"><strong>' . tep_output_string_protected($tokens['card_type']) . '</strong> ****' . tep_output_string_protected($tokens['number_filtered']) . ' ' . tep_output_string_protected(substr($tokens['expiry_date'], 0, 2) . '/' . substr($tokens['expiry_date'], 2)) . '</td>' . '</tr>'; } $content .= '<tr class="moduleRow" id="stripe_card_0">' . ' <td width="40" valign="top"><input type="radio" name="stripe_card" value="0" /></td>' . ' <td valign="top">' . MODULE_PAYMENT_STRIPE_CREDITCARD_NEW . '</td>' . '</tr>' . '</table>'; } } $content .= '<div class="messageStackError payment-errors"></div>' . '<table id="stripe_table_new_card" border="0" width="100%" cellspacing="0" cellpadding="2">' . '<tr>' . ' <td width="30%">' . MODULE_PAYMENT_STRIPE_CREDITCARD_OWNER . '</td>' . ' <td><input type="text" data-stripe="name" value="' . tep_output_string($order->billing['firstname'] . ' ' . $order->billing['lastname']) . '" /></td>' . '</tr>' . '<tr>' . ' <td width="30%">' . MODULE_PAYMENT_STRIPE_CREDITCARD_NUMBER . '</td>' . ' <td><input type="text" maxlength="20" autocomplete="off" data-stripe="number" /></td>' . '</tr>' . '<tr>' . ' <td width="30%">' . MODULE_PAYMENT_STRIPE_CREDITCARD_EXPIRY . '</td>' . ' <td>' . $months_string . ' / ' . $years_string . '</td>' . '</tr>'; if (MODULE_PAYMENT_STRIPE_VERIFY_WITH_CVC == 'True') { $content .= '<tr>' . ' <td width="30%">' . MODULE_PAYMENT_STRIPE_CREDITCARD_CVC . '</td>' . ' <td><input type="text" size="5" maxlength="4" autocomplete="off" data-stripe="cvc" /></td>' . '</tr>'; } if (MODULE_PAYMENT_STRIPE_TOKENS == 'True') { $content .= '<tr>' . ' <td width="30%"> </td>' . ' <td>' . tep_draw_checkbox_field('cc_save', 'true') . ' ' . MODULE_PAYMENT_STRIPE_CREDITCARD_SAVE . '</td>' . '</tr>'; } $content .= '</table>'; $address = array('address_line1' => $order->billing['street_address'], 'address_city' => $order->billing['city'], 'address_zip' => $order->billing['postcode'], 'address_state' => tep_get_zone_name($order->billing['country_id'], $order->billing['zone_id'], $order->billing['state']), 'address_country' => $order->billing['country']['iso_code_2']); foreach ($address as $k => $v) { $content .= '<input type="hidden" data-stripe="' . tep_output_string($k) . '" value="' . tep_output_string($v) . '" />'; } if (!$this->templateClassExists()) { $content .= $this->getSubmitCardDetailsJavascript(); } $confirmation = array('title' => $content); return $confirmation; }
} ?> </td> </tr> <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main" width="150"><?php echo ENTRY_STATE; ?> </td> <td class="main"> <?php // +Country-State Selector $entry_state = tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state); $zones_array = array(); $zones_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int) $cInfo->entry_country_id . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_id'], 'text' => $zones_values['zone_name']); } if (count($zones_array) > 0) { echo tep_draw_pull_down_menu('entry_zone_id', $zones_array, $cInfo->entry_zone_id); echo tep_draw_hidden_field('entry_state', ''); } else { echo tep_draw_input_field('entry_state', $entry_state); } // -Country-State Selector ?> </td> </tr>
if ($entry_state_has_zones == true) { $zones_array = array(); $zones_array[] = array('id' => '', 'text' => ''); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($a_country) . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_hidden_field('a_zone_id') . tep_draw_pull_down_menu('a_state', $zones_array) . ' ' . '<span class=\'errorText\'>' . ENTRY_STATE_ERROR . '</span>'; } else { echo tep_draw_hidden_field('a_zone_id') . tep_draw_input_field('a_state') . ' ' . '<span class=\'errorText\'>' . ENTRY_STATE_ERROR . '</span>'; } } else { echo $state . tep_draw_hidden_field('a_zone_id') . tep_draw_hidden_field('a_state'); } } else { echo tep_draw_hidden_field('a_zone_id') . tep_draw_input_field('a_state', tep_get_zone_name(isset($affiliate['affiliate_country_id']) ? $affiliate['affiliate_country_id'] : 0, isset($affiliate['affiliate_zone_id']) ? $affiliate['affiliate_zone_id'] : 0, isset($affiliate['affiliate_state']) ? $affiliate['affiliate_state'] : '')) . ' ' . ENTRY_STATE_TEXT; } ?> </td> </tr> <?php } ?> <tr> <td class="main"> <?php echo ENTRY_POST_CODE; ?> </td> <td class="main"> <?php if ($is_read_only == true) {
if ($entry_state_error == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $Qzones = $OSCOM_Db->get('zones', 'zone_name', ['zone_country_id' => $cInfo->entry_country_id], 'zone_name'); while ($Qzones->fetch()) { $zones_array[] = ['id' => $Qzones->value('zone_name'), 'text' => $Qzones->value('zone_name')]; } echo HTML::selectField('entry_state', $zones_array) . ' ' . OSCOM::getDef('entry_state_error', ['min_length' => ENTRY_STATE_MIN_LENGTH]); } else { echo HTML::inputField('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . OSCOM::getDef('entry_state_error', ['min_length' => ENTRY_STATE_MIN_LENGTH]); } } else { echo tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state) . HTML::hiddenField('entry_zone_id') . HTML::hiddenField('entry_state'); } } else { echo HTML::inputField('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)); } ?> </td> </tr> <?php } ?> <tr> <td class="main"><?php echo OSCOM::getDef('entry_country'); ?> </td> <td class="main"> <?php if ($error == true) {
$ship_country = tep_db_prepare_input($_POST['ship_country']); // $ship_zone_id = get_zone($ship_country, $ship_state); $ship_zone_id = tep_db_prepare_input($_POST['ship_state']); //$ship_zone_id = tep_db_prepare_input($_POST['ship_state']); $ship_state = tep_get_zone_name($ship_country, $ship_zone_id, ''); if (!isset($cc_expires) && isset($cc_expires_month) && isset($cc_expires_year)) { $cc_expires = "{$cc_expires_month}{$cc_expires_year}"; } if ($_POST['bill_same'] != '1') { $bill_street_address = tep_db_prepare_input($_POST['bill_street_address']); $bill_suburb = tep_db_prepare_input($_POST['bill_suburb']); $bill_postcode = tep_db_prepare_input($_POST['bill_postcode']); $bill_city = tep_db_prepare_input($_POST['bill_city']); $bill_country = tep_db_prepare_input($_POST['bill_country']); $bill_zone_id = tep_db_prepare_input($_POST['bill_state']); $bill_state = tep_get_zone_name($bill_country, $bill_zone_id, ''); } else { $bill_street_address = $ship_street_address; $bill_suburb = $ship_suburb; $bill_postcode = $ship_postcode; $bill_city = $ship_city; $bill_state = $ship_state; $bill_country = $ship_country; $bill_zone_id = $ship_zone_id; } $telephone = tep_db_prepare_input($_POST['telephone']); $company = tep_db_prepare_input($_POST['company']); if (isset($_POST['newsletter'])) { $newsletter = tep_db_prepare_input($_POST['newsletter']); } else { $newsletter = false;
<tr> <td class="main" width="200"><?php echo ENTRY_STATE; ?> </td> <td class="main"> <?php $entry_state = tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state); if ($error == true) { if ($entry_state_error == true) { echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . ENTRY_STATE_ERROR; } else { echo $entry_state . tep_draw_hidden_field('entry_zone_id') . tep_draw_hidden_field('entry_state'); } } else { echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state), '', ENTRY_STATE_MIN_LENGTH == 'true' ? true : false); } ?> </td> </tr> <?php } if (ACCOUNT_POSTCODE == 'true') { ?> <tr> <td class="main" width="200"><?php echo ENTRY_POST_CODE; ?> </td> <td class="main"> <?php
<?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $Qzones = $OSCOM_Db->prepare('select zone_name from :table_zones where zone_country_id = :zone_country_id order by zone_name'); $Qzones->bindInt(':zone_country_id', $country); $Qzones->execute(); while ($Qzones->fetch()) { $zones_array[] = array('id' => $Qzones->value('zone_name'), 'text' => $Qzones->value('zone_name')); } echo HTML::selectField('state', $zones_array); } else { echo HTML::inputField('state'); } } else { echo HTML::inputField('state', isset($entry['entry_country_id']) ? tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : ''); } if (tep_not_null(ENTRY_STATE_TEXT)) { echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; } ?> </div> </div> <?php } ?> <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY;
if (isset($_POST['billing_same_as_customer'])) { $_SESSION['billing_same_as_customer'] = $_POST['billing_same_as_customer']; } if (isset($_POST['shipping_same_as_billing'])) { $_SESSION['shipping_same_as_billing'] = $_POST['shipping_same_as_billing']; } // Update Order Info //figure out the new currency value $currency_value_query = tep_db_query("SELECT value \n FROM " . TABLE_CURRENCIES . " \n WHERE code = '" . $_POST['update_info_payment_currency'] . "'"); $currency_value = tep_db_fetch_array($currency_value_query); //figure out the country, state $update_customer_state = tep_get_zone_name($_POST['update_customer_country_id'], $_POST['update_customer_zone_id'], $_POST['update_customer_state']); $update_customer_country = tep_get_country_name($_POST['update_customer_country_id']); $update_billing_state = tep_get_zone_name($_POST['update_billing_country_id'], $_POST['update_billing_zone_id'], $_POST['update_billing_state']); $update_billing_country = tep_get_country_name($_POST['update_billing_country_id']); $update_delivery_state = tep_get_zone_name($_POST['update_delivery_country_id'], $_POST['update_delivery_zone_id'], $_POST['update_delivery_state']); $update_delivery_country = tep_get_country_name($_POST['update_delivery_country_id']); $sql_data_array = array('customers_name' => tep_db_input(tep_db_prepare_input($_POST['update_customer_name'])), 'customers_company' => tep_db_input(tep_db_prepare_input($_POST['update_customer_company'])), 'customers_street_address' => tep_db_input(tep_db_prepare_input($_POST['update_customer_street_address'])), 'customers_suburb' => tep_db_input(tep_db_prepare_input($_POST['update_customer_suburb'])), 'customers_city' => tep_db_input(tep_db_prepare_input($_POST['update_customer_city'])), 'customers_state' => tep_db_input(tep_db_prepare_input($update_customer_state)), 'customers_postcode' => tep_db_input(tep_db_prepare_input($_POST['update_customer_postcode'])), 'customers_country' => tep_db_input(tep_db_prepare_input($update_customer_country)), 'customers_telephone' => tep_db_input(tep_db_prepare_input($_POST['update_customer_telephone'])), 'customers_email_address' => tep_db_input(tep_db_prepare_input($_POST['update_customer_email_address'])), 'billing_name' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_name'] : $_POST['update_billing_name'])), 'billing_company' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_company'] : $_POST['update_billing_company'])), 'billing_street_address' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_street_address'] : $_POST['update_billing_street_address'])), 'billing_suburb' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_suburb'] : $_POST['update_billing_suburb'])), 'billing_city' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_city'] : $_POST['update_billing_city'])), 'billing_state' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $update_customer_state : $update_billing_state)), 'billing_postcode' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_postcode'] : $_POST['update_billing_postcode'])), 'billing_country' => tep_db_input(tep_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $update_customer_country : $update_billing_country)), 'delivery_name' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_name'] : $_POST['update_billing_name'] : $_POST['update_delivery_name'])), 'delivery_company' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_company'] : $_POST['update_billing_company'] : $_POST['update_delivery_company'])), 'delivery_street_address' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_street_address'] : $_POST['update_billing_street_address'] : $_POST['update_delivery_street_address'])), 'delivery_suburb' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_suburb'] : $_POST['update_billing_suburb'] : $_POST['update_delivery_suburb'])), 'delivery_city' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_city'] : $_POST['update_billing_city'] : $_POST['update_delivery_city'])), 'delivery_state' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $update_customer_state : $update_billing_state : $update_delivery_state)), 'delivery_postcode' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_postcode'] : $_POST['update_billing_postcode'] : $_POST['update_delivery_postcode'])), 'delivery_country' => tep_db_input(tep_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $update_customer_country : $update_billing_country : $update_delivery_country)), 'payment_method' => tep_db_input(tep_db_prepare_input($_POST['update_info_payment_method'])), 'currency' => tep_db_input(tep_db_prepare_input($_POST['update_info_payment_currency'])), 'currency_value' => tep_db_input(tep_db_prepare_input($currency_value['value'])), 'cc_type' => tep_db_prepare_input($_POST['update_info_cc_type']), 'cc_owner' => tep_db_prepare_input($_POST['update_info_cc_owner']), 'cc_number' => tep_db_input(tep_db_prepare_input($_POST['update_info_cc_number'])), 'cc_expires' => tep_db_prepare_input($_POST['update_info_cc_expires']), 'last_modified' => 'now()'); tep_db_perform(TABLE_ORDERS, $sql_data_array, 'update', 'orders_id = \'' . tep_db_input($oID) . '\''); $order_updated = true; // UPDATE STATUS HISTORY & SEND EMAIL TO CUSTOMER IF NECESSARY ##### $check_status_query = tep_db_query(" SELECT customers_name, customers_email_address, orders_status, date_purchased FROM " . TABLE_ORDERS . " WHERE orders_id = '" . (int) $oID . "'"); $check_status = tep_db_fetch_array($check_status_query); if ($check_status['orders_status'] != $_POST['status'] || tep_not_null($_POST['comments'])) { tep_db_query("UPDATE " . TABLE_ORDERS . " SET \n orders_status = '" . tep_db_input($_POST['status']) . "', \n last_modified = now() \n WHERE orders_id = '" . (int) $oID . "'"); // Notify Customer ? $customer_notified = '0'; if (isset($_POST['notify']) && $_POST['notify'] == 'on') { $notify_comments = ''; if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') { $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $_POST['comments']) . "\n\n";
</td> <td class="main"> <?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array); } else { echo tep_draw_input_field('state'); } } else { echo tep_draw_input_field('state', tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state'])); } if (tep_not_null(ENTRY_STATE_TEXT)) { echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT; } ?> </td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_COUNTRY; ?> </td>
// initialize variables if the customer is not logged in if (!tep_session_is_registered('customer_id')) { $customer_id = 0; $customer_default_address_id = 0; } require 'includes/modules/payment/paypal_express.php'; $paypal_express = new paypal_express(); if (!$paypal_express->check() || !$paypal_express->enabled) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL')); } if (!tep_session_is_registered('sendto')) { if (tep_session_is_registered('customer_id')) { $sendto = $customer_default_address_id; } else { $country = tep_get_countries(STORE_COUNTRY, true); $sendto = array('firstname' => '', 'lastname' => '', 'company' => '', 'street_address' => '', 'suburb' => '', 'postcode' => '', 'city' => '', 'zone_id' => STORE_ZONE, 'zone_name' => tep_get_zone_name(STORE_COUNTRY, STORE_ZONE, ''), 'country_id' => STORE_COUNTRY, 'country_name' => $country['countries_name'], 'country_iso_code_2' => $country['countries_iso_code_2'], 'country_iso_code_3' => $country['countries_iso_code_3'], 'address_format_id' => tep_get_address_format_id(STORE_COUNTRY)); } } if (!tep_session_is_registered('billto')) { $billto = $sendto; } // register a random ID in the session to check throughout the checkout procedure // against alterations in the shopping cart contents if (!tep_session_is_registered('cartID')) { tep_session_register('cartID'); } $cartID = $cart->cartID; switch ($HTTP_GET_VARS['osC_Action']) { case 'cancel': tep_session_unregister('ppe_token'); tep_session_unregister('ppe_secret');
if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array, 0, 'id="inputState" aria-describedby="atState"'); if (tep_not_null(ENTRY_STATE_TEXT)) { echo '<span id="atState" class="help-block">' . ENTRY_STATE_TEXT . '</span>'; } } else { echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"'); } } else { echo tep_draw_input_field('state', isset($entry['entry_country_id']) ? tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : '', 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"'); } ?> </div> </div> <?php } ?> <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?> </label> <div class="col-sm-9">
function before_process() { global $customer_id, $order, $HTTP_POST_VARS, $braintree_result, $braintree_token, $braintree_error; $braintree_token = null; $braintree_token_cvv = null; $braintree_error = null; if (MODULE_PAYMENT_BRAINTREE_CC_TOKENS == 'True') { if (isset($HTTP_POST_VARS['braintree_card']) && is_numeric($HTTP_POST_VARS['braintree_card']) && $HTTP_POST_VARS['braintree_card'] > 0) { $token_query = tep_db_query("select braintree_token from customers_braintree_tokens where id = '" . (int) $HTTP_POST_VARS['braintree_card'] . "' and customers_id = '" . (int) $customer_id . "'"); if (tep_db_num_rows($token_query) == 1) { $token = tep_db_fetch_array($token_query); $braintree_token = $token['braintree_token']; if (MODULE_PAYMENT_BRAINTREE_CC_VERIFY_WITH_CVV == 'True') { if (isset($HTTP_POST_VARS['token_cvv']) && is_array($HTTP_POST_VARS['token_cvv']) && isset($HTTP_POST_VARS['token_cvv'][$HTTP_POST_VARS['braintree_card']])) { $braintree_token_cvv = $HTTP_POST_VARS['token_cvv'][$HTTP_POST_VARS['braintree_card']]; } if (!isset($braintree_token_cvv) || empty($braintree_token_cvv)) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=cardcvv', 'SSL')); } } } } } if (!isset($braintree_token)) { $cc_owner = isset($HTTP_POST_VARS['name']) ? $HTTP_POST_VARS['name'] : null; $cc_number = isset($HTTP_POST_VARS['number']) ? $HTTP_POST_VARS['number'] : null; $cc_expires_month = isset($HTTP_POST_VARS['month']) ? $HTTP_POST_VARS['month'] : null; $cc_expires_year = isset($HTTP_POST_VARS['year']) ? $HTTP_POST_VARS['year'] : null; if (MODULE_PAYMENT_BRAINTREE_CC_VERIFY_WITH_CVV == 'True') { $cc_cvv = isset($HTTP_POST_VARS['cvv']) ? $HTTP_POST_VARS['cvv'] : null; } $months_array = array(); for ($i = 1; $i < 13; $i++) { $months_array[] = sprintf('%02d', $i); } $today = getdate(); $years_array = array(); for ($i = $today['year']; $i < $today['year'] + 10; $i++) { $years_array[] = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); } if (!isset($cc_owner) || empty($cc_owner)) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=cardowner', 'SSL')); } if (!isset($cc_number) || empty($cc_number)) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=cardnumber', 'SSL')); } if (!isset($cc_expires_month) || !in_array($cc_expires_month, $months_array)) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=cardexpires', 'SSL')); } if (!isset($cc_expires_year) || !in_array($cc_expires_year, $years_array)) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=cardexpires', 'SSL')); } if ($cc_expires_year == date('Y') && $cc_expires_month < date('m')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=cardexpires', 'SSL')); } if (MODULE_PAYMENT_BRAINTREE_CC_VERIFY_WITH_CVV == 'True') { if (!isset($cc_cvv) || empty($cc_cvv)) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=cardcvv', 'SSL')); } } } $braintree_result = null; Braintree_Configuration::environment(MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_SERVER == 'Live' ? 'production' : 'sandbox'); Braintree_Configuration::merchantId(MODULE_PAYMENT_BRAINTREE_CC_MERCHANT_ID); Braintree_Configuration::publicKey(MODULE_PAYMENT_BRAINTREE_CC_PUBLIC_KEY); Braintree_Configuration::privateKey(MODULE_PAYMENT_BRAINTREE_CC_PRIVATE_KEY); $currency = $this->getTransactionCurrency(); $data = array('amount' => $this->format_raw($order->info['total'], $currency), 'merchantAccountId' => $this->getMerchantAccountId($currency), 'creditCard' => array('cardholderName' => $cc_owner), 'customer' => array('firstName' => $order->customer['firstname'], 'lastName' => $order->customer['lastname'], 'company' => $order->customer['company'], 'phone' => $order->customer['telephone'], 'email' => $order->customer['email_address']), 'billing' => array('firstName' => $order->billing['firstname'], 'lastName' => $order->billing['lastname'], 'company' => $order->billing['company'], 'streetAddress' => $order->billing['street_address'], 'extendedAddress' => $order->billing['suburb'], 'locality' => $order->billing['city'], 'region' => tep_get_zone_name($order->billing['country_id'], $order->billing['zone_id'], $order->billing['state']), 'postalCode' => $order->billing['postcode'], 'countryCodeAlpha2' => $order->billing['country']['iso_code_2']), 'options' => array()); if (MODULE_PAYMENT_BRAINTREE_CC_TRANSACTION_METHOD == 'Payment') { $data['options']['submitForSettlement'] = true; } if ($order->content_type != 'virtual') { $data['shipping'] = array('firstName' => $order->delivery['firstname'], 'lastName' => $order->delivery['lastname'], 'company' => $order->delivery['company'], 'streetAddress' => $order->delivery['street_address'], 'extendedAddress' => $order->delivery['suburb'], 'locality' => $order->delivery['city'], 'region' => tep_get_zone_name($order->delivery['country_id'], $order->delivery['zone_id'], $order->delivery['state']), 'postalCode' => $order->delivery['postcode'], 'countryCodeAlpha2' => $order->delivery['country']['iso_code_2']); } if (!isset($braintree_token)) { $data['creditCard']['number'] = $cc_number; $data['creditCard']['expirationMonth'] = $cc_expires_month; $data['creditCard']['expirationYear'] = $cc_expires_year; if (MODULE_PAYMENT_BRAINTREE_CC_VERIFY_WITH_CVV == 'True') { $data['creditCard']['cvv'] = $cc_cvv; } if (MODULE_PAYMENT_BRAINTREE_CC_TOKENS == 'True' && isset($HTTP_POST_VARS['cc_save']) && $HTTP_POST_VARS['cc_save'] == 'true') { $data['options']['storeInVaultOnSuccess'] = true; } } else { $data['paymentMethodToken'] = $braintree_token; if (MODULE_PAYMENT_BRAINTREE_CC_VERIFY_WITH_CVV == 'True') { $data['creditCard']['cvv'] = $braintree_token_cvv; } } $error = false; try { $braintree_result = Braintree_Transaction::sale($data); } catch (Exception $e) { $error = true; } if ($error === false && $braintree_result->success) { return true; } if ($braintree_result->transaction) { $braintree_error = $braintree_result->message; if (!empty($braintree_error)) { tep_session_register('braintree_error'); } } else { $braintree_error = ''; if (isset($braintree_result->errors)) { foreach ($braintree_result->errors->deepAll() as $error) { $braintree_error .= $error->message . ' '; } if (!empty($braintree_error)) { $braintree_error = substr($braintree_error, 0, -1); } } if (!empty($braintree_error)) { tep_session_register('braintree_error'); } } tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); }
function tep_address_format($address_format_id, $address, $html, $boln, $eoln) { $address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int) $address_format_id . "'"); $address_format = tep_db_fetch_array($address_format_query); $company = tep_output_string_protected($address['company']); if (isset($address['firstname']) && tep_not_null($address['firstname'])) { // $firstname = tep_output_string_protected($address['firstname']); // $lastname = tep_output_string_protected($address['lastname']); } elseif (isset($address['name']) && tep_not_null($address['name'])) { // $firstname = tep_output_string_protected($address['name']); // $lastname = ''; } else { // $firstname = ''; // $lastname = ''; } $street = $address['street_address']; $suburb = $address['suburb']; $city = $address['city']; $state = $address['state']; $telephone = $address['telephone']; if (isset($address['country_id']) && tep_not_null($address['country_id'])) { $country = tep_get_country_name($address['country_id']); if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) { // $state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state); $state = tep_get_zone_name($address['country_id'], $address['zone_id'], $state); } } elseif (isset($address['country']) && tep_not_null($address['country'])) { $country = $address['country']; } else { $country = ''; } if ($state == $city) { $city = ''; } if (tep_not_null($address['postcode'])) { $postcode = $address['postcode'] . ', '; $zip = $postcode; } if ($html) { // HTML Mode $HR = '<hr>'; $hr = '<hr>'; if ($boln == '' && $eoln == "\n") { // Values not specified, use rational defaults $CR = '<br />'; $cr = '<br />'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else { // Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; // if ($suburb != '') $streets = $street . $cr . $suburb; if ($country == '') { $country = $address['country']; } if ($state != '' && $state != $city) { $statecomma = $state . ', '; } $fmt = $address_format['format']; eval("\$address = \"{$fmt}\";"); if (ACCOUNT_COMPANY == 'true' && tep_not_null($company)) { $address = $company . $cr . $address; } while (substr(trim($address), 0, 1) == ',') { $address = substr(trim($address), 1); } while (preg_match('/,\\s?,/', $address)) { $address = preg_replace('/,\\s?,/', ',', $address); } while (strpos($address, ' ,') !== false) { $address = str_replace(' ,', ',', $address); } if (substr(trim($address), -1) == ',') { $address = substr(trim($address), 0, -1); } return trim($address); }
<?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_array[] = array('id' => '', 'text' => ''); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array, 'class="form-control"'); } else { echo tep_draw_input_field('state', 'class="form-control"'); } } else { echo tep_draw_input_field('state', tep_get_zone_name(isset($entry['entry_country_id']) ? $entry['entry_country_id'] : 0, isset($entry['entry_zone_id']) ? $entry['entry_zone_id'] : 0, isset($entry['entry_state']) ? $entry['entry_state'] : 0), 'class="form-control"'); } if (tep_not_null(ENTRY_STATE_TEXT)) { } ?> </div> <?php } ?> <div class="form-group full-width margin-bottom"><label class="sr-only"></label> <?php echo ENTRY_COUNTRY; ?> <?php echo tep_get_country_list('country', isset($entry['entry_country_id']) ? $entry['entry_country_id'] : '', 'class="form-control"') . '' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '' : '');