Permalink
Browse files

Remove address fields from account creation page

  • Loading branch information...
1 parent cd03209 commit ac962db6dc7c51ab029cdeb3569cc3a0affd4350 @haraldpdl haraldpdl committed Mar 13, 2013
View
4 includes/apps/account/actions/address_book.php
@@ -18,6 +18,10 @@ public static function execute(app $app) {
$app->setContentFile('address_book.php');
+ if ( !$OSCOM_Customer->hasDefaultAddress() && !isset($_GET['new']) ) {
+ $app->setContentFile('address_book_process.php');
+ }
+
$OSCOM_Breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK, osc_href_link('account', 'address_book', 'SSL'));
}
}
View
2 includes/apps/account/actions/address_book/process.php
@@ -160,7 +160,7 @@ public static function execute(app $app) {
$new_address_book_id = $OSCOM_PDO->lastInsertId();
// reregister session variables
- if ( isset($_POST['primary']) && ($_POST['primary'] == 'on') ) {
+ if ( !$OSCOM_Customer->hasDefaultAddress() || (isset($_POST['primary']) && ($_POST['primary'] == 'on')) ) {
$OSCOM_Customer->setCountryID($country);
$OSCOM_Customer->setZoneID(($zone_id > 0) ? (int)$zone_id : '0');
$OSCOM_Customer->setDefaultAddressID($new_address_book_id);
View
112 includes/apps/account/actions/create/process.php
@@ -8,30 +8,14 @@
class app_account_action_create_process {
public static function execute(app $app) {
- global $OSCOM_Customer, $OSCOM_MessageStack, $OSCOM_PDO, $process, $entry_state_has_zones, $country;
+ global $OSCOM_Customer, $OSCOM_MessageStack, $OSCOM_PDO;
if ( isset($_POST['formid']) && ($_POST['formid'] == $_SESSION['sessiontoken']) ) {
- $process = true;
-
if (ACCOUNT_GENDER == 'true') $gender = isset($_POST['gender']) ? trim($_POST['gender']) : null;
$firstname = isset($_POST['firstname']) ? trim($_POST['firstname']) : null;
$lastname = isset($_POST['lastname']) ? trim($_POST['lastname']) : null;
if (ACCOUNT_DOB == 'true') $dob = isset($_POST['dob']) ? trim($_POST['dob']) : null;
$email_address = isset($_POST['email_address']) ? trim($_POST['email_address']) : null;
- if (ACCOUNT_COMPANY == 'true') $company = isset($_POST['company']) ? trim($_POST['company']) : null;
- $street_address = isset($_POST['street_address']) ? trim($_POST['street_address']) : null;
- if (ACCOUNT_SUBURB == 'true') $suburb = isset($_POST['suburb']) ? trim($_POST['suburb']) : null;
- $postcode = isset($_POST['postcode']) ? trim($_POST['postcode']) : null;
- $city = isset($_POST['city']) ? trim($_POST['city']) : null;
-
- if ( ACCOUNT_STATE == 'true' ) {
- $state = isset($_POST['state']) ? trim($_POST['state']) : null;
- $zone_id = isset($_POST['zone_id']) ? trim($_POST['zone_id']) : null;
- }
-
- $country = isset($_POST['country']) ? trim($_POST['country']) : null;
- $telephone = isset($_POST['telephone']) ? trim($_POST['telephone']) : null;
- $fax = isset($_POST['fax']) ? trim($_POST['fax']) : null;
$newsletter = isset($_POST['newsletter']) ? trim($_POST['newsletter']) : null;
$password = isset($_POST['password']) ? trim($_POST['password']) : null;
$confirmation = isset($_POST['confirmation']) ? trim($_POST['confirmation']) : null;
@@ -86,70 +70,6 @@ public static function execute(app $app) {
}
}
- if ( strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH ) {
- $error = true;
-
- $OSCOM_MessageStack->addError('create_account', ENTRY_STREET_ADDRESS_ERROR);
- }
-
- if ( strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH ) {
- $error = true;
-
- $OSCOM_MessageStack->addError('create_account', ENTRY_POST_CODE_ERROR);
- }
-
- if ( strlen($city) < ENTRY_CITY_MIN_LENGTH ) {
- $error = true;
-
- $OSCOM_MessageStack->addError('create_account', ENTRY_CITY_ERROR);
- }
-
- if ( !is_numeric($country) ) {
- $error = true;
-
- $OSCOM_MessageStack->addError('create_account', ENTRY_COUNTRY_ERROR);
- }
-
- if ( ACCOUNT_STATE == 'true' ) {
- $zone_id = 0;
-
- $Qcheck = $OSCOM_PDO->prepare('select zone_country_id from :table_zones where zone_country_id = :zone_country_id limit 1');
- $Qcheck->bindInt(':zone_country_id', $country);
- $Qcheck->execute();
-
- $entry_state_has_zones = ($Qcheck->fetch() !== false);
-
- if ( $entry_state_has_zones === true ) {
- $Qzone = $OSCOM_PDO->prepare('select distinct zone_id from :table_zones where zone_country_id = :zone_country_id and (zone_name = :zone_name or zone_code = :zone_code)');
- $Qzone->bindInt(':zone_country_id', $country);
- $Qzone->bindValue(':zone_name', $state);
- $Qzone->bindValue(':zone_code', $state);
- $Qzone->execute();
-
- $result = $Qzone->fetchAll();
-
- if ( count($result) === 1 ) {
- $zone_id = (int)$result[0]['zone_id'];
- } else {
- $error = true;
-
- $OSCOM_MessageStack->addError('create_account', ENTRY_STATE_ERROR_SELECT);
- }
- } else {
- if ( strlen($state) < ENTRY_STATE_MIN_LENGTH ) {
- $error = true;
-
- $OSCOM_MessageStack->addError('create_account', ENTRY_STATE_ERROR);
- }
- }
- }
-
- if ( strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH ) {
- $error = true;
-
- $OSCOM_MessageStack->addError('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
- }
-
if ( strlen($password) < ENTRY_PASSWORD_MIN_LENGTH ) {
$error = true;
@@ -164,8 +84,6 @@ public static function execute(app $app) {
$sql_data_array = array('customers_firstname' => $firstname,
'customers_lastname' => $lastname,
'customers_email_address' => $email_address,
- 'customers_telephone' => $telephone,
- 'customers_fax' => $fax,
'customers_newsletter' => $newsletter,
'customers_password' => osc_encrypt_password($password));
@@ -176,34 +94,6 @@ public static function execute(app $app) {
$customer_id = $OSCOM_PDO->lastInsertId();
- $sql_data_array = array('customers_id' => $customer_id,
- 'entry_firstname' => $firstname,
- 'entry_lastname' => $lastname,
- 'entry_street_address' => $street_address,
- 'entry_postcode' => $postcode,
- 'entry_city' => $city,
- 'entry_country_id' => $country);
-
- if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
- if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
- if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
-
- if ( ACCOUNT_STATE == 'true' ) {
- if ( $zone_id > 0 ) {
- $sql_data_array['entry_zone_id'] = $zone_id;
- $sql_data_array['entry_state'] = '';
- } else {
- $sql_data_array['entry_zone_id'] = '0';
- $sql_data_array['entry_state'] = $state;
- }
- }
-
- $OSCOM_PDO->perform('address_book', $sql_data_array);
-
- $address_id = $OSCOM_PDO->lastInsertId();
-
- $OSCOM_PDO->perform('customers', array('customers_default_address_id' => (int)$address_id), array('customers_id' => (int)$customer_id));
-
$OSCOM_PDO->perform('customers_info', array('customers_info_id' => (int)$customer_id,
'customers_info_number_of_logons' => '0',
'customers_info_date_account_created' => 'now()'));
View
17 includes/apps/account/actions/edit/process.php
@@ -72,18 +72,23 @@ public static function execute(app $app) {
$OSCOM_MessageStack->addError('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
}
- if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
- $error = true;
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
+ if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
+ $error = true;
- $OSCOM_MessageStack->addError('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR);
+ $OSCOM_MessageStack->addError('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR);
+ }
}
if ($error == false) {
$sql_data_array = array('customers_firstname' => $firstname,
'customers_lastname' => $lastname,
- 'customers_email_address' => $email_address,
- 'customers_telephone' => $telephone,
- 'customers_fax' => $fax);
+ 'customers_email_address' => $email_address);
+
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
+ $sql_data_array['customers_telephone'] = $telephone;
+ $sql_data_array['customers_fax'] = $fax;
+ }
if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = osc_date_raw($dob);
View
35 includes/apps/account/content/address_book_process.php
@@ -17,43 +17,16 @@
}
?>
-<?php echo osc_draw_form('addressbook', osc_href_link('account', 'address_book&process' . (isset($_GET['id']) ? '&id=' . $_GET['id'] : ''), 'SSL'), 'post', 'onsubmit="return check_form(addressbook);"', true); ?>
-
-<div class="contentContainer">
+<?php echo osc_draw_form('addressbook', osc_href_link('account', 'address_book&process' . (isset($_GET['id']) ? '&id=' . $_GET['id'] : ''), 'SSL'), 'post', 'onsubmit="return check_form(addressbook);" class="form-horizontal"', true); ?>
<?php
require(DIR_FS_CATALOG . DIR_WS_MODULES . 'address_book_details.php');
?>
-<?php
- if ( isset($_GET['id']) ) {
-?>
-
- <div>
- <span style="float: right;"><?php echo osc_draw_button(IMAGE_BUTTON_UPDATE, 'refresh', null, 'success'); ?></span>
-
- <?php echo osc_draw_button(IMAGE_BUTTON_BACK, 'arrow-left', osc_href_link('account', 'address_book', 'SSL')); ?>
- </div>
-
-<?php
- } else {
- if ( $OSCOM_NavigationHistory->hasSnapshot() ) {
- $back_link = $OSCOM_NavigationHistory->getSnapshotURL();
- } else {
- $back_link = osc_href_link('account', 'address_book', 'SSL');
- }
-?>
-
- <div class="buttonSet">
- <span class="buttonAction"><?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok', null, 'success'); ?></span>
-
- <?php echo osc_draw_button(IMAGE_BUTTON_BACK, 'arrow-left', $back_link); ?>
+<div class="control-group">
+ <div class="controls">
+ <?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok-sign', null, 'success'); ?>
</div>
-
-<?php
- }
-?>
-
</div>
</form>
View
214 includes/apps/account/content/create.php
@@ -19,189 +19,105 @@
<p><?php echo sprintf(TEXT_ORIGIN_LOGIN, osc_href_link('account', 'login', 'SSL')); ?></p>
-<?php echo osc_draw_form('create_account', osc_href_link('account', 'create&process', 'SSL'), 'post', 'onsubmit="return check_form(create_account);"', true); ?>
+<?php echo osc_draw_form('create_account', osc_href_link('account', 'create&process', 'SSL'), 'post', 'onsubmit="return check_form(create_account);" class="form-horizontal"', true); ?>
-<div class="contentContainer">
- <div>
- <span class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
- <h2><?php echo CATEGORY_PERSONAL; ?></h2>
- </div>
-
- <div class="contentText">
- <table border="0" cellspacing="2" cellpadding="2" width="100%">
+<fieldset>
+ <legend>
+ <small class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></small>
+ <?php echo CATEGORY_PERSONAL; ?>
+ </legend>
<?php
if (ACCOUNT_GENDER == 'true') {
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_GENDER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_radio_field('gender', 'm') . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . osc_draw_radio_field('gender', 'f') . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . (osc_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
- </tr>
-
-<?php
- }
-?>
+ <div class="control-group">
+ <span class="control-label"><?php echo ENTRY_GENDER; ?></span>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_FIRST_NAME; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('firstname') . '&nbsp;' . (osc_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_LAST_NAME; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('lastname') . '&nbsp;' . (osc_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="controls">
+ <label class="radio inline">
+ <?php echo osc_draw_radio_field('gender', 'm'); ?>
+ <?php echo MALE; ?>
+ </label>
-<?php
- if (ACCOUNT_DOB == 'true') {
-?>
+ <label class="radio inline">
+ <?php echo osc_draw_radio_field('gender', 'f'); ?>
+ <?php echo FEMALE; ?>
+ </label>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('dob', '', 'id="dob"') . '&nbsp;' . (osc_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?><script type="text/javascript">$('#dob').datepicker({dateFormat: '<?php echo JQUERY_DATEPICKER_FORMAT; ?>', changeMonth: true, changeYear: true, yearRange: '-100:+0'});</script></td>
- </tr>
+ <?php echo (osc_not_null(ENTRY_GENDER_TEXT) ? '<small class="inline inputRequirement">' . ENTRY_GENDER_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('email_address') . '&nbsp;' . (osc_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
- </tr>
- </table>
+ <div class="control-group">
+ <label class="control-label" for="firstname"><?php echo ENTRY_FIRST_NAME; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('firstname') . (osc_not_null(ENTRY_FIRST_NAME_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</small>': ''); ?>
+ </div>
</div>
-<?php
- if (ACCOUNT_COMPANY == 'true') {
-?>
-
- <h2><?php echo CATEGORY_COMPANY; ?></h2>
-
- <div class="contentText">
- <table border="0" cellspacing="2" cellpadding="2" width="100%">
- <tr>
- <td class="fieldKey"><?php echo ENTRY_COMPANY; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('company') . '&nbsp;' . (osc_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
- </tr>
- </table>
+ <div class="control-group">
+ <label class="control-label" for="lastname"><?php echo ENTRY_LAST_NAME; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('lastname') . (osc_not_null(ENTRY_LAST_NAME_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</small>': ''); ?>
+ </div>
</div>
<?php
- }
-?>
-
- <h2><?php echo CATEGORY_ADDRESS; ?></h2>
-
- <div class="contentText">
- <table border="0" cellspacing="2" cellpadding="2" width="100%">
- <tr>
- <td class="fieldKey"><?php echo ENTRY_STREET_ADDRESS; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('street_address') . '&nbsp;' . (osc_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
- </tr>
-
-<?php
- if (ACCOUNT_SUBURB == 'true') {
+ if (ACCOUNT_DOB == 'true') {
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_SUBURB; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('suburb') . '&nbsp;' . (osc_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="dob"><?php echo ENTRY_DATE_OF_BIRTH; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('dob', '', 'id="dob"') . (osc_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_POST_CODE; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('postcode') . '&nbsp;' . (osc_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_CITY; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('city') . '&nbsp;' . (osc_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
- </tr>
-
-<?php
- if (ACCOUNT_STATE == 'true') {
-?>
-
- <tr>
- <td class="fieldKey"><?php echo ENTRY_STATE; ?></td>
- <td class="fieldValue">
-<?php
- if ($process == true) {
- if ($entry_state_has_zones == true) {
- $zones_array = array();
-
- $Qzones = $OSCOM_PDO->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 osc_draw_pull_down_menu('state', $zones_array);
- } else {
- echo osc_draw_input_field('state');
- }
- } else {
- echo osc_draw_input_field('state');
- }
-
- if (osc_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>';
-?>
- </td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="email_address"><?php echo ENTRY_EMAIL_ADDRESS; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('email_address') . (osc_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
-<?php
- }
-?>
+ <div class="control-group">
+ <div class="controls">
+ <label class="checkbox inline">
+ <?php echo osc_draw_checkbox_field('newsletter', '1'); ?>
+ <?php echo ENTRY_NEWSLETTER; ?>
+ </label>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_COUNTRY; ?></td>
- <td class="fieldValue"><?php echo osc_get_country_list('country') . '&nbsp;' . (osc_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
- </tr>
- </table>
+ <?php echo (osc_not_null(ENTRY_NEWSLETTER_TEXT) ? '<small class="inline inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</small>': ''); ?>
+ </div>
</div>
- <h2><?php echo CATEGORY_CONTACT; ?></h2>
-
- <div class="contentText">
- <table border="0" cellspacing="2" cellpadding="2" width="100%">
- <tr>
- <td class="fieldKey"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('telephone') . '&nbsp;' . (osc_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_FAX_NUMBER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('fax') . '&nbsp;' . (osc_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_NEWSLETTER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_checkbox_field('newsletter', '1') . '&nbsp;' . (osc_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
- </tr>
- </table>
+ <div class="control-group">
+ <label class="control-label" for="password"><?php echo ENTRY_PASSWORD; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_password_field('password') . (osc_not_null(ENTRY_PASSWORD_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</small>': ''); ?>
+ </div>
</div>
- <h2><?php echo CATEGORY_PASSWORD; ?></h2>
-
- <div class="contentText">
- <table border="0" cellspacing="2" cellpadding="2" width="100%">
- <tr>
- <td class="fieldKey"><?php echo ENTRY_PASSWORD; ?></td>
- <td class="fieldValue"><?php echo osc_draw_password_field('password') . '&nbsp;' . (osc_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>
- <td class="fieldValue"><?php echo osc_draw_password_field('confirmation') . '&nbsp;' . (osc_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': ''); ?></td>
- </tr>
- </table>
+ <div class="control-group">
+ <label class="control-label" for="confirmation"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_password_field('confirmation') . (osc_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</small>': ''); ?>
+ </div>
</div>
+</fieldset>
- <div class="buttonSet">
- <span class="buttonAction"><?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok-sign', null, 'success'); ?></span>
+<div class="control-group">
+ <div class="controls">
+ <?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok-sign', null, 'success'); ?>
</div>
</div>
View
121 includes/apps/account/content/edit.php
@@ -17,17 +17,13 @@
}
?>
-<?php echo osc_draw_form('account_edit', osc_href_link('account', 'edit&process', 'SSL'), 'post', 'onsubmit="return check_form(account_edit);"', true); ?>
+<?php echo osc_draw_form('account_edit', osc_href_link('account', 'edit&process', 'SSL'), 'post', 'onsubmit="return check_form(account_edit);" class="form-horizontal"', true); ?>
-<div class="contentContainer">
- <div>
- <div class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></div>
-
- <h2><?php echo MY_ACCOUNT_TITLE; ?></h2>
- </div>
-
- <div class="contentText">
- <table border="0" cellspacing="2" cellpadding="2" width="100%">
+<fieldset>
+ <legend>
+ <small class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></small>
+ <?php echo MY_ACCOUNT_TITLE; ?>
+ </legend>
<?php
if (ACCOUNT_GENDER == 'true') {
@@ -39,59 +35,92 @@
$female = !$male;
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_GENDER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . osc_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . (osc_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <span class="control-label"><?php echo ENTRY_GENDER; ?></span>
+
+ <div class="controls">
+ <label class="radio inline">
+ <?php echo osc_draw_radio_field('gender', 'm', $male); ?>
+ <?php echo MALE; ?>
+ </label>
+
+ <label class="radio inline">
+ <?php echo osc_draw_radio_field('gender', 'f', $female); ?>
+ <?php echo FEMALE; ?>
+ </label>
+
+ <?php echo (osc_not_null(ENTRY_GENDER_TEXT) ? '<small class="inline inputRequirement">' . ENTRY_GENDER_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_FIRST_NAME; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('firstname', $account['customers_firstname']) . '&nbsp;' . (osc_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_LAST_NAME; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('lastname', $account['customers_lastname']) . '&nbsp;' . (osc_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="firstname"><?php echo ENTRY_FIRST_NAME; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('firstname', $account['customers_firstname']) . (osc_not_null(ENTRY_FIRST_NAME_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="lastname"><?php echo ENTRY_LAST_NAME; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('lastname', $account['customers_lastname']) . (osc_not_null(ENTRY_LAST_NAME_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
if (ACCOUNT_DOB == 'true') {
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('dob', osc_date_short($account['customers_dob']), 'id="dob"') . '&nbsp;' . (osc_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?><script type="text/javascript">$('#dob').datepicker({dateFormat: '<?php echo JQUERY_DATEPICKER_FORMAT; ?>', changeMonth: true, changeYear: true, yearRange: '-100:+0'});</script></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="dob"><?php echo ENTRY_DATE_OF_BIRTH; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('dob', osc_date_short($account['customers_dob']), 'id="dob"') . (osc_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('email_address', $account['customers_email_address']) . '&nbsp;' . (osc_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('telephone', $account['customers_telephone']) . '&nbsp;' . (osc_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_FAX_NUMBER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('fax', $account['customers_fax']) . '&nbsp;' . (osc_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td>
- </tr>
- </table>
-
- <br />
-
- <div class="buttonSet">
- <span class="buttonAction"><?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok', null, 'success'); ?></span>
-
- <?php echo osc_draw_button(IMAGE_BUTTON_BACK, 'arrow-left', osc_href_link('account', '', 'SSL')); ?>
+ <div class="control-group">
+ <label class="control-label" for="email_address"><?php echo ENTRY_EMAIL_ADDRESS; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('email_address', $account['customers_email_address']) . (osc_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</small>': ''); ?>
</div>
</div>
+
+<?php
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
+?>
+
+ <div class="control-group">
+ <label class="control-label" for="telephone"><?php echo ENTRY_TELEPHONE_NUMBER; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('telephone', $account['customers_telephone']) . (osc_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="fax"><?php echo ENTRY_FAX_NUMBER; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('fax', $account['customers_fax']) . (osc_not_null(ENTRY_FAX_NUMBER_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
+
+<?php
+ }
+?>
+
+</fieldset>
+
+<div class="control-group">
+ <div class="controls">
+ <?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok-sign', null, 'success'); ?>
+ </div>
</div>
</form>
View
18 includes/apps/checkout/actions/payment.php
@@ -8,18 +8,24 @@
class app_checkout_action_payment {
public static function execute(app $app) {
- global $OSCOM_Breadcrumb, $OSCOM_MessageStack, $total_weight, $total_count, $payment_modules;
+ global $OSCOM_Breadcrumb, $OSCOM_Customer, $OSCOM_MessageStack, $total_weight, $total_count, $payment_modules;
$app->setContentFile('payment.php');
- $total_weight = $_SESSION['cart']->show_weight();
- $total_count = $_SESSION['cart']->count_contents();
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
+ $total_weight = $_SESSION['cart']->show_weight();
+ $total_count = $_SESSION['cart']->count_contents();
// load all enabled payment modules
- $payment_modules = new payment;
+ $payment_modules = new payment;
- if ( isset($_GET['payment_error']) && is_object($GLOBALS[$_GET['payment_error']]) && ($error = $GLOBALS[$_GET['payment_error']]->get_error()) ) {
- $OSCOM_MessageStack->addError('payment_error', '<strong>' . osc_output_string_protected($error['title']) . '</strong><br />' . osc_output_string_protected($error['error']));
+ if ( !isset($_GET['address']) && isset($_SESSION['payment']) && (osc_count_payment_modules() == 1) ) {
+ osc_redirect(osc_href_link('checkout', null, 'SSL'));
+ }
+
+ if ( isset($_GET['payment_error']) && is_object($GLOBALS[$_GET['payment_error']]) && ($error = $GLOBALS[$_GET['payment_error']]->get_error()) ) {
+ $OSCOM_MessageStack->addError('payment_error', '<strong>' . osc_output_string_protected($error['title']) . '</strong><br />' . osc_output_string_protected($error['error']));
+ }
}
$OSCOM_Breadcrumb->add(NAVBAR_TITLE_PAYMENT, osc_href_link('checkout', 'payment', 'SSL'));
View
10 includes/apps/checkout/actions/payment/address/process.php
@@ -8,14 +8,14 @@
class app_checkout_action_payment_address_process {
public static function execute(app $app) {
- global $OSCOM_Customer, $OSCOM_MessageStack, $OSCOM_PDO, $process, $entry_state_has_zones, $country;
+ global $OSCOM_Customer, $OSCOM_MessageStack, $OSCOM_PDO, $process, $gender, $entry_state_has_zones, $country;
$error = false;
$process = false;
if ( isset($_POST['formid']) && ($_POST['formid'] == $_SESSION['sessiontoken']) ) {
// process a new billing address
- if ( isset($_POST['firstname']) && !empty($_POST['firstname']) && isset($_POST['lastname']) && !empty($_POST['lastname']) && isset($_POST['street_address']) && !empty($_POST['street_address']) ) {
+ if ( !$OSCOM_Customer->hasDefaultAddress() || (isset($_POST['firstname']) && !empty($_POST['firstname']) && isset($_POST['lastname']) && !empty($_POST['lastname']) && isset($_POST['street_address']) && !empty($_POST['street_address'])) ) {
$process = true;
if (ACCOUNT_GENDER == 'true') $gender = isset($_POST['gender']) ? trim($_POST['gender']) : null;
@@ -138,6 +138,12 @@ public static function execute(app $app) {
$_SESSION['billto'] = $OSCOM_PDO->lastInsertId();
+ if ( !$OSCOM_Customer->hasDefaultAddress() ) {
+ $OSCOM_Customer->setCountryID($country);
+ $OSCOM_Customer->setZoneID(($zone_id > 0) ? (int)$zone_id : '0');
+ $OSCOM_Customer->setDefaultAddressID($_SESSION['billto']);
+ }
+
if ( isset($_SESSION['payment']) ) {
unset($_SESSION['payment']);
}
View
92 includes/apps/checkout/actions/shipping.php
@@ -8,69 +8,73 @@
class app_checkout_action_shipping {
public static function execute(app $app) {
- global $OSCOM_PDO, $order, $total_weight, $total_count, $shipping_modules, $free_shipping, $quotes, $OSCOM_Breadcrumb;
+ global $OSCOM_Breadcrumb, $OSCOM_Customer, $OSCOM_PDO, $order, $total_weight, $total_count, $shipping_modules, $free_shipping, $quotes;
+
+// if the order contains only virtual products, forward the customer to the checkout page as
+// a shipping address is not needed
+ if ( $_SESSION['cart']->get_content_type() == 'virtual' ) {
+ osc_redirect(osc_href_link('checkout', null, 'SSL'));
+ }
$app->setContentFile('shipping.php');
+ $OSCOM_Breadcrumb->add(NAVBAR_TITLE_SHIPPING, osc_href_link('checkout', 'shipping', 'SSL'));
+
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
// register a random ID in the session to check throughout the checkout procedure
// against alterations in the shopping cart contents
- if ( isset($_SESSION['cartID']) && ($_SESSION['cartID'] != $_SESSION['cart']->cartID) && isset($_SESSION['shipping']) ) {
- unset($_SESSION['shipping']);
- }
-
- $_SESSION['cartID'] = $_SESSION['cart']->cartID = $_SESSION['cart']->generate_cart_id();
-
-// if the order contains only virtual products, forward the customer to the billing page as
-// a shipping address is not needed
- if ( $order->content_type == 'virtual' ) {
- $_SESSION['shipping'] = false;
- $_SESSION['sendto'] = false;
+ if ( isset($_SESSION['cartID']) && ($_SESSION['cartID'] != $_SESSION['cart']->cartID) && isset($_SESSION['shipping']) ) {
+ unset($_SESSION['shipping']);
+ }
- osc_redirect(osc_href_link('checkout', 'payment', 'SSL'));
- }
+ $_SESSION['cartID'] = $_SESSION['cart']->cartID = $_SESSION['cart']->generate_cart_id();
- $total_weight = $_SESSION['cart']->show_weight();
- $total_count = $_SESSION['cart']->count_contents();
+ $total_weight = $_SESSION['cart']->show_weight();
+ $total_count = $_SESSION['cart']->count_contents();
// load all enabled shipping modules
- $shipping_modules = new shipping;
+ $shipping_modules = new shipping;
- if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
- $pass = false;
+ if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
+ $pass = false;
- switch ( MODULE_ORDER_TOTAL_SHIPPING_DESTINATION ) {
- case 'national':
- if ( $order->delivery['country_id'] == STORE_COUNTRY ) {
- $pass = true;
- }
- break;
+ switch ( MODULE_ORDER_TOTAL_SHIPPING_DESTINATION ) {
+ case 'national':
+ if ( $order->delivery['country_id'] == STORE_COUNTRY ) {
+ $pass = true;
+ }
+ break;
- case 'international':
- if ( $order->delivery['country_id'] != STORE_COUNTRY ) {
- $pass = true;
- }
- break;
+ case 'international':
+ if ( $order->delivery['country_id'] != STORE_COUNTRY ) {
+ $pass = true;
+ }
+ break;
- case 'both':
- $pass = true;
- break;
- }
+ case 'both':
+ $pass = true;
+ break;
+ }
- $free_shipping = false;
+ $free_shipping = false;
- if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
- $free_shipping = true;
+ if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
+ $free_shipping = true;
- include(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/ot_shipping.php');
+ include(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/ot_shipping.php');
+ }
+ } else {
+ $free_shipping = false;
}
- } else {
- $free_shipping = false;
- }
// get all available shipping quotes
- $quotes = $shipping_modules->quote();
-
- $OSCOM_Breadcrumb->add(NAVBAR_TITLE_SHIPPING, osc_href_link('checkout', 'shipping', 'SSL'));
+ $quotes = $shipping_modules->quote();
+ } else {
+// No customer default address
+ if ( !isset($_GET['address']) ) {
+ osc_redirect(osc_href_link('checkout', 'shipping&address', 'SSL'));
+ }
+ }
}
}
?>
View
10 includes/apps/checkout/actions/shipping/address/process.php
@@ -8,14 +8,14 @@
class app_checkout_action_shipping_address_process {
public static function execute(app $app) {
- global $OSCOM_Customer, $OSCOM_MessageStack, $OSCOM_PDO, $process, $entry_state_has_zones, $country;
+ global $OSCOM_Customer, $OSCOM_MessageStack, $OSCOM_PDO, $process, $gender, $entry_state_has_zones, $country;
$error = false;
$process = false;
if ( isset($_POST['formid']) && ($_POST['formid'] == $_SESSION['sessiontoken']) ) {
// process a new shipping address
- if ( isset($_POST['firstname']) && !empty($_POST['firstname']) && isset($_POST['lastname']) && !empty($_POST['lastname']) && isset($_POST['street_address']) && !empty($_POST['street_address']) ) {
+ if ( !$OSCOM_Customer->hasDefaultAddress() || (isset($_POST['firstname']) && !empty($_POST['firstname']) && isset($_POST['lastname']) && !empty($_POST['lastname']) && isset($_POST['street_address']) && !empty($_POST['street_address'])) ) {
$process = true;
if (ACCOUNT_GENDER == 'true') $gender = isset($_POST['gender']) ? trim($_POST['gender']) : null;
@@ -138,6 +138,12 @@ public static function execute(app $app) {
$_SESSION['sendto'] = $OSCOM_PDO->lastInsertId();
+ if ( !$OSCOM_Customer->hasDefaultAddress() ) {
+ $OSCOM_Customer->setCountryID($country);
+ $OSCOM_Customer->setZoneID(($zone_id > 0) ? (int)$zone_id : '0');
+ $OSCOM_Customer->setDefaultAddressID($_SESSION['sendto']);
+ }
+
if ( isset($_SESSION['shipping']) ) {
unset($_SESSION['shipping']);
}
View
10 includes/apps/checkout/content/main.php
@@ -192,7 +192,9 @@
<div class="contentText">
<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
- <div id="coProgressBar" style="height: 5px;"></div>
+ <div class="progress">
+ <div class="bar" style="width: 100%;"></div>
+ </div>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
@@ -218,10 +220,4 @@
</div>
-<script type="text/javascript">
-$('#coProgressBar').progressbar({
- value: 100
-});
-</script>
-
</form>
View
10 includes/apps/checkout/content/payment.php
@@ -179,7 +179,9 @@ function rowOutEffect(object) {
<div class="contentText">
<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
- <div id="coProgressBar" style="height: 5px;"></div>
+ <div class="progress">
+ <div class="bar" style="width: 66%;"></div>
+ </div>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
@@ -194,10 +196,4 @@ function rowOutEffect(object) {
</div>
</div>
-<script type="text/javascript">
-$('#coProgressBar').progressbar({
- value: 66
-});
-</script>
-
</form>
View
40 includes/apps/checkout/content/payment_address.php
@@ -64,12 +64,13 @@ function check_form_optional(form_name) {
}
?>
-<?php echo osc_draw_form('checkout_address', osc_href_link('checkout', 'payment&address&process', 'SSL'), 'post', 'onsubmit="return check_form_optional(checkout_address);"', true); ?>
+<?php echo osc_draw_form('checkout_address', osc_href_link('checkout', 'payment&address&process', 'SSL'), 'post', 'onsubmit="return check_form_optional(checkout_address);" class="form-horizontal"', true); ?>
<div class="contentContainer">
<?php
- if ($process == false) {
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
+ if ($process == false) {
?>
<h2><?php echo TABLE_HEADING_PAYMENT_ADDRESS; ?></h2>
@@ -89,7 +90,7 @@ function check_form_optional(form_name) {
<div style="clear: both;"></div>
<?php
- if ($addresses_count > 1) {
+ if ($addresses_count > 1) {
?>
<h2><?php echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES; ?></h2>
@@ -106,17 +107,17 @@ function check_form_optional(form_name) {
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
- $radio_buttons = 0;
+ $radio_buttons = 0;
- $addresses_query = osc_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$OSCOM_Customer->getID() . "'");
- while ($addresses = osc_db_fetch_array($addresses_query)) {
- $format_id = osc_get_address_format_id($addresses['country_id']);
+ $addresses_query = osc_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$OSCOM_Customer->getID() . "'");
+ while ($addresses = osc_db_fetch_array($addresses_query)) {
+ $format_id = osc_get_address_format_id($addresses['country_id']);
- if ($addresses['address_book_id'] == $_SESSION['billto']) {
- echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
- } else {
- echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
- }
+ if ($addresses['address_book_id'] == $_SESSION['billto']) {
+ echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
+ } else {
+ echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
+ }
?>
<td><strong><?php echo $addresses['firstname'] . ' ' . $addresses['lastname']; ?></strong></td>
@@ -127,14 +128,15 @@ function check_form_optional(form_name) {
</tr>
<?php
- $radio_buttons++;
- }
+ $radio_buttons++;
+ }
?>
</table>
</div>
<?php
+ }
}
}
@@ -155,7 +157,9 @@ function check_form_optional(form_name) {
<div class="contentText">
<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
- <div id="coProgressBar" style="height: 5px;"></div>
+ <div class="progress">
+ <div class="bar" style="width: 66%;"></div>
+ </div>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
@@ -169,12 +173,6 @@ function check_form_optional(form_name) {
<div style="float: right;"><?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok-sign', null, 'success'); ?></div>
</div>
-<script type="text/javascript">
-$('#coProgressBar').progressbar({
- value: 66
-});
-</script>
-
<?php
if ($process == true) {
?>
View
10 includes/apps/checkout/content/shipping.php
@@ -180,7 +180,9 @@ function rowOutEffect(object) {
<div class="contentText">
<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
- <div id="coProgressBar" style="height: 5px;"></div>
+ <div class="progress">
+ <div class="bar" style="width: 33%;"></div>
+ </div>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
@@ -195,10 +197,4 @@ function rowOutEffect(object) {
</div>
</div>
-<script type="text/javascript">
-$('#coProgressBar').progressbar({
- value: 33
-});
-</script>
-
</form>
View
40 includes/apps/checkout/content/shipping_address.php
@@ -64,12 +64,13 @@ function check_form_optional(form_name) {
}
?>
-<?php echo osc_draw_form('checkout_address', osc_href_link('checkout', 'shipping&address&process', 'SSL'), 'post', 'onsubmit="return check_form_optional(checkout_address);"', true); ?>
+<?php echo osc_draw_form('checkout_address', osc_href_link('checkout', 'shipping&address&process', 'SSL'), 'post', 'onsubmit="return check_form_optional(checkout_address);" class="form-horizontal"', true); ?>
<div class="contentContainer">
<?php
- if ($process === false) {
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
+ if ($process === false) {
?>
<h2><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></h2>
@@ -89,7 +90,7 @@ function check_form_optional(form_name) {
<div style="clear: both;"></div>
<?php
- if ($addresses_count > 1) {
+ if ($addresses_count > 1) {
?>
<h2><?php echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES; ?></h2>
@@ -106,17 +107,17 @@ function check_form_optional(form_name) {
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
- $radio_buttons = 0;
+ $radio_buttons = 0;
- $addresses_query = osc_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$OSCOM_Customer->getID() . "'");
- while ($addresses = osc_db_fetch_array($addresses_query)) {
- $format_id = osc_get_address_format_id($addresses['country_id']);
+ $addresses_query = osc_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$OSCOM_Customer->getID() . "'");
+ while ($addresses = osc_db_fetch_array($addresses_query)) {
+ $format_id = osc_get_address_format_id($addresses['country_id']);
- if ($addresses['address_book_id'] == $_SESSION['sendto']) {
- echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
- } else {
- echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
- }
+ if ($addresses['address_book_id'] == $_SESSION['sendto']) {
+ echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
+ } else {
+ echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
+ }
?>
<td><strong><?php echo $addresses['firstname'] . ' ' . $addresses['lastname']; ?></strong></td>
@@ -127,14 +128,15 @@ function check_form_optional(form_name) {
</tr>
<?php
- $radio_buttons++;
- }
+ $radio_buttons++;
+ }
?>
</table>
</div>
<?php
+ }
}
}
@@ -155,7 +157,9 @@ function check_form_optional(form_name) {
<div class="contentText">
<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">
- <div id="coProgressBar" style="height: 5px;"></div>
+ <div class="progress">
+ <div class="bar" style="width: 33%;"></div>
+ </div>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
@@ -169,12 +173,6 @@ function check_form_optional(form_name) {
<div style="float: right;"><?php echo osc_draw_button(IMAGE_BUTTON_CONTINUE, 'ok-sign', null, 'success'); ?></div>
</div>
-<script type="text/javascript">
-$('#coProgressBar').progressbar({
- value: 33
-});
-</script>
-
<?php
if ($process === true) {
?>
View
133 includes/apps/checkout/controller.php
@@ -45,94 +45,111 @@ public function __construct() {
}
}
-// if no shipping destination address was selected, use the customers own address as default
- if ( !isset($_SESSION['sendto']) ) {
- $_SESSION['sendto'] = $OSCOM_Customer->getDefaultAddressID();
- } else {
-// verify the selected shipping address
- if ( (is_array($_SESSION['sendto']) && empty($_SESSION['sendto'])) || is_numeric($_SESSION['sendto']) ) {
- $Qcheck = $OSCOM_PDO->prepare('select address_book_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id');
- $Qcheck->bindInt(':address_book_id', $_SESSION['sendto']);
- $Qcheck->bindInt(':customers_id', $OSCOM_Customer->getID());
- $Qcheck->execute();
+// no shipping is needed if the order contains only virtual products
+ if ( $_SESSION['cart']->get_content_type() == 'virtual' ) {
+ $_SESSION['shipping'] = false;
+ $_SESSION['sendto'] = false;
+ }
- if ( $Qcheck->fetch() === false ) {
- $_SESSION['sendto'] = $OSCOM_Customer->getDefaultAddressID();
+ $OSCOM_Breadcrumb->add(NAVBAR_TITLE, osc_href_link('checkout', '', 'SSL'));
- if ( isset($_SESSION['shipping']) ) {
- unset($_SESSION['shipping']);
+ if ( $OSCOM_Customer->hasDefaultAddress() ) {
+// if no shipping destination address was selected, use the customers own address as default
+ if ( !isset($_SESSION['sendto']) ) {
+ $_SESSION['sendto'] = $OSCOM_Customer->getDefaultAddressID();
+ } else {
+// verify the selected shipping address
+ if ( is_numeric($_SESSION['sendto']) ) {
+ $Qcheck = $OSCOM_PDO->prepare('select address_book_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id');
+ $Qcheck->bindInt(':address_book_id', $_SESSION['sendto']);
+ $Qcheck->bindInt(':customers_id', $OSCOM_Customer->getID());
+ $Qcheck->execute();
+
+ if ( $Qcheck->fetch() === false ) {
+ $_SESSION['sendto'] = $OSCOM_Customer->getDefaultAddressID();
+
+ if ( isset($_SESSION['shipping']) ) {
+ unset($_SESSION['shipping']);
+ }
}
}
}
- }
// if no billing destination address was selected, use the customers own address as default
- if ( !isset($_SESSION['billto']) ) {
- $_SESSION['billto'] = $OSCOM_Customer->getDefaultAddressID();
- } else {
+ if ( !isset($_SESSION['billto']) ) {
+ $_SESSION['billto'] = $OSCOM_Customer->getDefaultAddressID();
+ } else {
// verify the selected billing address
- if ( (is_array($_SESSION['billto']) && empty($_SESSION['billto'])) || is_numeric($_SESSION['billto']) ) {
- $Qcheck = $OSCOM_PDO->prepare('select address_book_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id');
- $Qcheck->bindInt(':address_book_id', $_SESSION['billto']);
- $Qcheck->bindInt(':customers_id', $OSCOM_Customer->getID());
- $Qcheck->execute();
-
- if ( $Qcheck->fetch() === false ) {
- $_SESSION['billto'] = $OSCOM_Customer->getDefaultAddressID();
-
- if ( isset($_SESSION['payment']) ) {
- unset($_SESSION['payment']);
+ if ( is_numeric($_SESSION['billto']) ) {
+ $Qcheck = $OSCOM_PDO->prepare('select address_book_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id');
+ $Qcheck->bindInt(':address_book_id', $_SESSION['billto']);
+ $Qcheck->bindInt(':customers_id', $OSCOM_Customer->getID());
+ $Qcheck->execute();
+
+ if ( $Qcheck->fetch() === false ) {
+ $_SESSION['billto'] = $OSCOM_Customer->getDefaultAddressID();
+
+ if ( isset($_SESSION['payment']) ) {
+ unset($_SESSION['payment']);
+ }
}
}
}
- }
// avoid hack attempts during the checkout procedure by checking the internal cartID
- if ( !isset($_GET['shipping']) && isset($_SESSION['cart']->cartID) && isset($_SESSION['cartID']) ) {
- if ( $_SESSION['cart']->cartID != $_SESSION['cartID'] ) {
+ if ( isset($_SESSION['cart']->cartID) && isset($_SESSION['cartID']) && ($_SESSION['cart']->cartID != $_SESSION['cartID']) && !isset($_GET['shipping']) ) {
osc_redirect(osc_href_link('checkout', 'shipping', 'SSL'));
}
- }
// if no shipping method has been selected, redirect the customer to the shipping method selection page
- if ( !isset($_GET['shipping']) && !isset($_SESSION['shipping']) ) {
- osc_redirect(osc_href_link('checkout', 'shipping', 'SSL'));
- }
-
-// if no shipping method has been selected, redirect the customer to the shipping method selection page
- if ( !isset($_GET['payment']) && isset($_SESSION['shipping']) && !isset($_SESSION['payment']) ) {
- osc_redirect(osc_href_link('checkout', 'payment', 'SSL'));
- }
+ if ( !isset($_GET['shipping']) ) {
+ if ( !isset($_SESSION['shipping']) ) {
+ osc_redirect(osc_href_link('checkout', 'shipping', 'SSL'));
+ }
- $order = new order();
+// if no payment method has been selected, redirect the customer to the payment method selection page
+ if ( !isset($_SESSION['payment']) && !isset($_GET['payment']) ) {
+ osc_redirect(osc_href_link('checkout', 'payment', 'SSL'));
+ }
+ }
- $OSCOM_Breadcrumb->add(NAVBAR_TITLE, osc_href_link('checkout', '', 'SSL'));
+ $order = new order();
- if ( !isset($_GET['shipping']) && !isset($_GET['payment']) && isset($_SESSION['shipping']) && isset($_SESSION['payment']) ) {
+ if ( !isset($_GET['shipping']) && !isset($_GET['payment']) && isset($_SESSION['shipping']) && isset($_SESSION['payment']) ) {
// load the selected payment module
- $payment_modules = new payment($_SESSION['payment']);
+ $payment_modules = new payment($_SESSION['payment']);
- $order->cart();
+ $order->cart();
- $payment_modules->update_status();
+ $payment_modules->update_status();
- if ( (is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($GLOBALS[$_SESSION['payment']])) || (is_object($GLOBALS[$_SESSION['payment']]) && ($GLOBALS[$_SESSION['payment']]->enabled == false)) ) {
- unset($_SESSION['payment']);
+ if ( (is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($GLOBALS[$_SESSION['payment']])) || (is_object($GLOBALS[$_SESSION['payment']]) && ($GLOBALS[$_SESSION['payment']]->enabled == false)) ) {
+ unset($_SESSION['payment']);
- osc_redirect(osc_href_link('checkout', 'payment&error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
- }
+ osc_redirect(osc_href_link('checkout', 'payment&error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
+ }
- if ( is_array($payment_modules->modules) ) {
- $payment_modules->pre_confirmation_check();
- }
+ if ( is_array($payment_modules->modules) ) {
+ $payment_modules->pre_confirmation_check();
+ }
// load the selected shipping module
- $shipping_modules = new shipping($_SESSION['shipping']);
+ $shipping_modules = new shipping($_SESSION['shipping']);
- $order_total_modules = new order_total;
- $order_totals = $order_total_modules->process();
+ $order_total_modules = new order_total;
+ $order_totals = $order_total_modules->process();
- $OSCOM_Breadcrumb->add(NAVBAR_TITLE_CONFIRMATION);
+ $OSCOM_Breadcrumb->add(NAVBAR_TITLE_CONFIRMATION);
+ }
+ } else {
+// No customer default address
+ if ( !isset($_GET['shipping']) && !isset($_GET['payment']) ) {
+ if ( !isset($_SESSION['sendto']) ) {
+ osc_redirect(osc_href_link('checkout', 'shipping&address', 'SSL'));
+ } elseif ( !isset($_SESSION['billto']) ) {
+ osc_redirect(osc_href_link('checkout', 'payment&address', 'SSL'));
+ }
+ }
}
}
}
View
21 includes/classes/customer.php
@@ -11,10 +11,12 @@ class customer {
protected $_data = array();
public function __construct() {
- if ( isset($_SESSION['customer']) ) {
- $this->_data =& $_SESSION['customer'];
+ if ( !isset($_SESSION['customer']) ) {
+ $_SESSION['customer'] = $this->_data;
}
+ $this->_data =& $_SESSION['customer'];
+
if ( isset($this->_data['id']) && is_numeric($this->_data['id']) && ($this->_data['id'] > 0) ) {
$this->setIsLoggedOn(true);
}
@@ -124,8 +126,6 @@ public function setData($id) {
$this->setDefaultAddressID($Qcustomer->valueInt('customers_default_address_id'));
}
}
-
- $_SESSION['customer'] = $this->_data;
}
}
@@ -139,7 +139,16 @@ public function setID($id) {
}
public function setDefaultAddressID($id) {
+ global $OSCOM_PDO;
+
if ( is_numeric($id) && ($id > 0) ) {
+ if ( !isset($this->_data['default_address_id']) || ($this->_data['default_address_id'] != $id) ) {
+ $Qupdate = $OSCOM_PDO->prepare('update :table_customers set customers_default_address_id = :customers_default_address_id where customers_id = :customers_id');
+ $Qupdate->bindInt(':customers_default_address_id', $id);
+ $Qupdate->bindInt(':customers_id', $this->getID());
+ $Qupdate->execute();
+ }
+
$this->_data['default_address_id'] = $id;
}
}
@@ -177,10 +186,6 @@ public function setZoneID($id) {
public function reset() {
$this->_is_logged_on = false;
$this->_data = array();
-
- if ( isset($_SESSION['customer']) ) {
- unset($_SESSION['customer']);
- }
}
}
?>
View
2 includes/functions/general.php
@@ -334,7 +334,7 @@ function osc_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
static $tax_rates = array();
if ( ($country_id == -1) && ($zone_id == -1) ) {
- if (!$OSCOM_Customer->isLoggedOn()) {
+ if ( !$OSCOM_Customer->isLoggedOn() || !$OSCOM_Customer->hasDefaultAddress() ) {
$country_id = STORE_COUNTRY;
$zone_id = STORE_ZONE;
} else {
View
153 includes/modules/address_book_details.php
@@ -9,91 +9,120 @@
if (!isset($process)) $process = false;
?>
- <div>
- <span class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
- <h2><?php echo ADDRESS_BOOK_ENTRY; ?></h2>
- </div>
-
- <div class="contentText">
- <table border="0" width="100%" cellspacing="2" cellpadding="2">
+<fieldset>
+ <legend>
+ <small class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></small>
+ <?php echo ADDRESS_BOOK_ENTRY; ?>
+ </legend>
<?php
if (ACCOUNT_GENDER == 'true') {
- $male = $female = false;
+ $male = ($OSCOM_Customer->getGender() == 'm') ? true : false;
+
if (isset($gender)) {
$male = ($gender == 'm') ? true : false;
- $female = !$male;
} elseif (isset($entry['entry_gender'])) {
$male = ($entry['entry_gender'] == 'm') ? true : false;
- $female = !$male;
}
+
+ $female = !$male;
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_GENDER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . osc_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . (osc_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <span class="control-label"><?php echo ENTRY_GENDER; ?></span>
+
+ <div class="controls">
+ <label class="radio inline">
+ <?php echo osc_draw_radio_field('gender', 'm', $male); ?>
+ <?php echo MALE; ?>
+ </label>
+
+ <label class="radio inline">
+ <?php echo osc_draw_radio_field('gender', 'f', $female); ?>
+ <?php echo FEMALE; ?>
+ </label>
+
+ <?php echo (osc_not_null(ENTRY_GENDER_TEXT) ? '<small class="inline inputRequirement">' . ENTRY_GENDER_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_FIRST_NAME; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('firstname', (isset($entry['entry_firstname']) ? $entry['entry_firstname'] : '')) . '&nbsp;' . (osc_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_LAST_NAME; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('lastname', (isset($entry['entry_lastname']) ? $entry['entry_lastname'] : '')) . '&nbsp;' . (osc_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="firstname"><?php echo ENTRY_FIRST_NAME; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('firstname', (isset($entry['entry_firstname']) ? $entry['entry_firstname'] : $OSCOM_Customer->getFirstName())) . (osc_not_null(ENTRY_FIRST_NAME_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="lastname"><?php echo ENTRY_LAST_NAME; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('lastname', (isset($entry['entry_lastname']) ? $entry['entry_lastname'] : $OSCOM_Customer->getLastName())) . (osc_not_null(ENTRY_LAST_NAME_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
if (ACCOUNT_COMPANY == 'true') {
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_COMPANY; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('company', (isset($entry['entry_company']) ? $entry['entry_company'] : '')) . '&nbsp;' . (osc_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="company"><?php echo ENTRY_COMPANY; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('company', (isset($entry['entry_company']) ? $entry['entry_company'] : '')) . (osc_not_null(ENTRY_COMPANY_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_STREET_ADDRESS; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('street_address', (isset($entry['entry_street_address']) ? $entry['entry_street_address'] : '')) . '&nbsp;' . (osc_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="street_address"><?php echo ENTRY_STREET_ADDRESS; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('street_address', (isset($entry['entry_street_address']) ? $entry['entry_street_address'] : '')) . (osc_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
if (ACCOUNT_SUBURB == 'true') {
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_SUBURB; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('suburb', (isset($entry['entry_suburb']) ? $entry['entry_suburb'] : '')) . '&nbsp;' . (osc_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="suburb"><?php echo ENTRY_SUBURB; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('suburb', (isset($entry['entry_suburb']) ? $entry['entry_suburb'] : '')) . (osc_not_null(ENTRY_SUBURB_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_POST_CODE; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('postcode', (isset($entry['entry_postcode']) ? $entry['entry_postcode'] : '')) . '&nbsp;' . (osc_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
- </tr>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_CITY; ?></td>
- <td class="fieldValue"><?php echo osc_draw_input_field('city', (isset($entry['entry_city']) ? $entry['entry_city'] : '')) . '&nbsp;' . (osc_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="postcode"><?php echo ENTRY_POST_CODE; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('postcode', (isset($entry['entry_postcode']) ? $entry['entry_postcode'] : '')) . (osc_not_null(ENTRY_POST_CODE_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label class="control-label" for="city"><?php echo ENTRY_CITY; ?></label>
+ <div class="controls">
+ <?php echo osc_draw_input_field('city', (isset($entry['entry_city']) ? $entry['entry_city'] : '')) . (osc_not_null(ENTRY_CITY_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_CITY_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
if (ACCOUNT_STATE == 'true') {
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_STATE; ?></td>
- <td class="fieldValue">
+ <div class="control-group">
+ <label class="control-label" for="state"><?php echo ENTRY_STATE; ?></label>
+ <div class="controls">
+
<?php
if ($process == true) {
if ($entry_state_has_zones == true) {
@@ -110,30 +139,38 @@
echo osc_draw_input_field('state', (isset($entry['entry_country_id']) ? osc_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : ''));
}
- if (osc_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>';
+ if (osc_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<small class="inputRequirement">' . ENTRY_STATE_TEXT . '</small>';
?>
- </td>
- </tr>
+
+ </div>
+ </div>
<?php
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_COUNTRY; ?></td>
- <td class="fieldValue"><?php echo osc_get_country_list('country', (isset($entry['entry_country_id']) ? $entry['entry_country_id'] : (!isset($_POST['country']) ? STORE_COUNTRY : null))) . '&nbsp;' . (osc_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <label class="control-label" for="country"><?php echo ENTRY_COUNTRY; ?></label>
+ <div class="controls">
+ <?php echo osc_get_country_list('country', (isset($entry['entry_country_id']) ? $entry['entry_country_id'] : (!isset($_POST['country']) ? STORE_COUNTRY : null))) . (osc_not_null(ENTRY_COUNTRY_TEXT) ? '&nbsp;<small class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</small>': ''); ?>
+ </div>
+ </div>
<?php
- if ( (isset($_GET['id']) && ($OSCOM_Customer->getDefaultAddressID() != $_GET['id'])) || !isset($_GET['id']) ) {
+ if ( (isset($_GET['id']) && ($OSCOM_Customer->getDefaultAddressID() != $_GET['id'])) || ($OSCOM_Customer->hasDefaultAddress() && !isset($_GET['id'])) ) {
?>
- <tr>
- <td class="fieldValue" colspan="2"><?php echo osc_draw_checkbox_field('primary', 'on', false, 'id="primary"') . ' ' . SET_AS_PRIMARY; ?></td>
- </tr>
+ <div class="control-group">
+ <div class="controls">
+ <label class="checkbox inline">
+ <?php echo osc_draw_checkbox_field('primary', 'on', false, 'id="primary"'); ?>
+ <?php echo SET_AS_PRIMARY; ?>
+ </label>
+ </div>
+ </div>
<?php
}
?>
- </table>
- </div>
+
+</fieldset>
View
148 includes/modules/checkout_new_address.php
@@ -1,97 +1,121 @@
<?php
-/*
- $Id$
-
- osCommerce, Open Source E-Commerce Solutions
- http://www.oscommerce.com
-
- Copyright (c) 2010 osCommerce
-
- Released under the GNU General Public License
-*/
+/**
+ * osCommerce Online Merchant
+ *
+ * @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
+ * @license GNU General Public License; http://www.oscommerce.com/gpllicense.txt
+ */
if (!isset($process)) $process = false;
?>
- <div class="contentText">
- <table border="0" width="100%" cellspacing="0" cellpadding="2">
-
<?php
if (ACCOUNT_GENDER == 'true') {
+ $male = $female = false;
+
if (isset($gender)) {
- $male = ($gender == 'm') ? true : false;
- $female = ($gender == 'f') ? true : false;
- } else {
- $male = false;
- $female = false;
+ $male = ($gender == 'm');
+ $female = !$male;
+ } elseif ( !$OSCOM_Customer->hasDefaultAddress() ) {
+ $male = ($OSCOM_Customer->getGender() == 'm');
+ $female = !$male;
}
?>
- <tr>
- <td class="fieldKey"><?php echo ENTRY_GENDER; ?></td>
- <td class="fieldValue"><?php echo osc_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . osc_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . (osc_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
- </tr>
+ <div class="control-group">
+ <span class="control-label"><?php echo ENTRY_GENDER; ?></span>
+