Example #1
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_MessageStack = Registry::get('MessageStack');
     if (AddressBook::deleteEntry($_GET['Delete'])) {
         $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('success_address_book_entry_deleted'), 'success');
     }
     OSCOM::redirect(OSCOM::getLink(null, null, 'AddressBook', 'SSL'));
 }
Example #2
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_Template = Registry::get('Template');
     if (AddressBook::checkEntry($_GET['Edit']) === false) {
         $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('error_address_book_entry_non_existing'), 'error');
         osc_redirect(OSCOM::getLink(null, null, 'AddressBook', 'SSL'));
     }
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_address_book_edit_entry'), OSCOM::getLink(null, null, 'AddressBook&Edit=' . $_GET['Edit'], 'SSL'));
     }
     $application->setPageTitle(OSCOM::getDef('address_book_edit_entry_heading'));
     $application->setPageContent('address_book_process.php');
     $OSCOM_Template->addJavascriptPhpFilename('includes/form_check.js.php');
 }
Example #3
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     $OSCOM_Template = Registry::get('Template');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_address_book_add_entry'), OSCOM::getLink(null, null, 'AddressBook&Create', 'SSL'));
     }
     $application->setPageTitle(OSCOM::getDef('address_book_add_entry_heading'));
     $application->setPageContent('address_book_process.php');
     $OSCOM_Template->addJavascriptPhpFilename(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/assets/form_check.js.php');
     if (AddressBook::numberOfEntries() >= MAX_ADDRESS_BOOK_ENTRIES) {
         $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('error_address_book_full'));
         $application->setPageTitle(OSCOM::getDef('address_book_heading'));
         $application->setPageContent('address_book.php');
         return true;
     }
 }
Example #4
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $OSCOM_Service = Registry::get('Service');
     $OSCOM_Breadcrumb = Registry::get('Breadcrumb');
     if ($_GET['Delete'] == $OSCOM_Customer->getDefaultAddressID()) {
         $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('warning_primary_address_deletion'), 'warning');
     } else {
         if (AddressBook::checkEntry($_GET['Delete']) === false) {
             $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('error_address_book_entry_non_existing'), 'error');
         }
     }
     if ($OSCOM_MessageStack->size('AddressBook') > 0) {
         OSCOM::redirect(OSCOM::getLink(null, null, 'AddressBook', 'SSL'));
     }
     if ($OSCOM_Service->isStarted('Breadcrumb')) {
         $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_address_book_delete_entry'), OSCOM::getLink(null, null, 'AddressBook&Delete=' . $_GET['Delete'], 'SSL'));
     }
     $application->setPageTitle(OSCOM::getDef('address_book_delete_entry_heading'));
     $application->setPageContent('address_book_delete.php');
 }
        <td width="10">&nbsp;</td>
      </tr>

<?php 
            $radio_buttons++;
        }
        ?>

    </table>
  </div>
</div>

<?php 
    }
}
if (!$OSCOM_Customer->isLoggedOn() || AddressBook::numberOfEntries() < MAX_ADDRESS_BOOK_ENTRIES) {
    ?>

<div class="moduleBox">
  <em style="float: right; margin-top: 10px;"><?php 
    echo OSCOM::getDef('form_required_information');
    ?>
</em>

  <h6><?php 
    echo OSCOM::getDef('new_billing_address_title');
    ?>
</h6>

  <div class="content">
    <?php 
<?php

/*
  osCommerce Online Merchant $osCommerce-SIG$
  Copyright (c) 2010 osCommerce (http://www.oscommerce.com)

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/
use osCommerce\OM\Core\Site\Shop\AddressBook;
use osCommerce\OM\Core\OSCOM;
use osCommerce\OM\Core\Site\Shop\Address;
$Qentry = AddressBook::getEntry($_GET['Delete']);
?>

<?php 
echo osc_image(DIR_WS_IMAGES . $OSCOM_Template->getPageImage(), $OSCOM_Template->getPageTitle(), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'id="pageIcon"');
?>

<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<?php 
if ($OSCOM_MessageStack->exists('AddressBook')) {
    echo $OSCOM_MessageStack->get('AddressBook');
}
?>
Example #7
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Customer = Registry::get('Customer');
     global $entry_state_has_zones;
     // HPDL (used in template)
     $data = array();
     if (ACCOUNT_GENDER >= 0) {
         if (isset($_POST['gender']) && ($_POST['gender'] == 'm' || $_POST['gender'] == 'f')) {
             $data['gender'] = $_POST['gender'];
         } else {
             $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('field_customer_gender_error'));
         }
     }
     if (isset($_POST['firstname']) && strlen(trim($_POST['firstname'])) >= ACCOUNT_FIRST_NAME) {
         $data['firstname'] = $_POST['firstname'];
     } else {
         $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_first_name_error'), ACCOUNT_FIRST_NAME));
     }
     if (isset($_POST['lastname']) && strlen(trim($_POST['lastname'])) >= ACCOUNT_LAST_NAME) {
         $data['lastname'] = $_POST['lastname'];
     } else {
         $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_last_name_error'), ACCOUNT_LAST_NAME));
     }
     if (ACCOUNT_COMPANY > -1) {
         if (isset($_POST['company']) && strlen(trim($_POST['company'])) >= ACCOUNT_COMPANY) {
             $data['company'] = $_POST['company'];
         } else {
             $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_company_error'), ACCOUNT_COMPANY));
         }
     }
     if (isset($_POST['street_address']) && strlen(trim($_POST['street_address'])) >= ACCOUNT_STREET_ADDRESS) {
         $data['street_address'] = $_POST['street_address'];
     } else {
         $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_street_address_error'), ACCOUNT_STREET_ADDRESS));
     }
     if (ACCOUNT_SUBURB >= 0) {
         if (isset($_POST['suburb']) && strlen(trim($_POST['suburb'])) >= ACCOUNT_SUBURB) {
             $data['suburb'] = $_POST['suburb'];
         } else {
             $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_suburb_error'), ACCOUNT_SUBURB));
         }
     }
     if (ACCOUNT_POST_CODE > -1) {
         if (isset($_POST['postcode']) && strlen(trim($_POST['postcode'])) >= ACCOUNT_POST_CODE) {
             $data['postcode'] = $_POST['postcode'];
         } else {
             $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_post_code_error'), ACCOUNT_POST_CODE));
         }
     }
     if (isset($_POST['city']) && strlen(trim($_POST['city'])) >= ACCOUNT_CITY) {
         $data['city'] = $_POST['city'];
     } else {
         $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_city_error'), ACCOUNT_CITY));
     }
     if (ACCOUNT_STATE >= 0) {
         $Qcheck = $OSCOM_PDO->prepare('select zone_id from :table_zones where zone_country_id = :zone_country_id limit 1');
         $Qcheck->bindInt(':zone_country_id', $_POST['country']);
         $Qcheck->execute();
         $entry_state_has_zones = $Qcheck->fetch() !== false;
         if ($entry_state_has_zones === true) {
             $Qzone = $OSCOM_PDO->prepare('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_code like :zone_code');
             $Qzone->bindInt(':zone_country_id', $_POST['country']);
             $Qzone->bindValue(':zone_code', $_POST['state']);
             $Qzone->execute();
             if ($Qzone->fetch() !== false) {
                 $data['zone_id'] = $Qzone->valueInt('zone_id');
             } else {
                 $Qzone = $OSCOM_PDO->prepare('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_name like :zone_name');
                 $Qzone->bindInt(':zone_country_id', $_POST['country']);
                 $Qzone->bindValue(':zone_name', $_POST['state'] . '%');
                 $Qzone->execute();
                 if ($Qzone->fetch() !== false) {
                     $data['zone_id'] = $Qzone->valueInt('zone_id');
                 } else {
                     $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('field_customer_state_select_pull_down_error'));
                 }
             }
         } else {
             if (strlen(trim($_POST['state'])) >= ACCOUNT_STATE) {
                 $data['state'] = $_POST['state'];
             } else {
                 $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_state_error'), ACCOUNT_STATE));
             }
         }
     } else {
         if (strlen(trim($_POST['state'])) >= ACCOUNT_STATE) {
             $data['state'] = $_POST['state'];
         } else {
             $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_state_error'), ACCOUNT_STATE));
         }
     }
     if (isset($_POST['country']) && is_numeric($_POST['country']) && $_POST['country'] >= 1) {
         $data['country'] = $_POST['country'];
     } else {
         $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('field_customer_country_error'));
     }
     if (ACCOUNT_TELEPHONE >= 0) {
         if (isset($_POST['telephone']) && strlen(trim($_POST['telephone'])) >= ACCOUNT_TELEPHONE) {
             $data['telephone'] = $_POST['telephone'];
         } else {
             $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_telephone_number_error'), ACCOUNT_TELEPHONE));
         }
     }
     if (ACCOUNT_FAX >= 0) {
         if (isset($_POST['fax']) && strlen(trim($_POST['fax'])) >= ACCOUNT_FAX) {
             $data['fax'] = $_POST['fax'];
         } else {
             $OSCOM_MessageStack->add('AddressBook', sprintf(OSCOM::getDef('field_customer_fax_number_error'), ACCOUNT_FAX));
         }
     }
     if ($OSCOM_Customer->hasDefaultAddress() === false || isset($_POST['primary']) && $_POST['primary'] == 'on') {
         $data['primary'] = true;
     }
     if ($OSCOM_MessageStack->size('AddressBook') === 0) {
         if (AddressBook::saveEntry($data)) {
             $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('success_address_book_entry_updated'), 'success');
         }
         OSCOM::redirect(OSCOM::getLink(null, null, 'AddressBook', 'SSL'));
     }
 }
Example #8
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     global $entry_state_has_zones;
     // HPDL
     // process a new shipping address
     if (!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['street_address'])) {
         $address_array = array('id' => 0, 'zone_id' => 0);
         $error = false;
         if (ACCOUNT_GENDER > -1) {
             if (isset($_POST['gender']) && (ACCOUNT_GENDER == 0 || in_array($_POST['gender'], array('m', 'f')))) {
                 if (in_array($_POST['gender'], array('m', 'f'))) {
                     $address_array['gender'] = $_POST['gender'];
                 }
             } else {
                 $OSCOM_MessageStack->add('CheckoutAddress', OSCOM::getDef('field_customer_gender_error'));
                 $error = true;
             }
         }
         if (isset($_POST['firstname']) && strlen(trim($_POST['firstname'])) >= ACCOUNT_FIRST_NAME) {
             $address_array['firstname'] = trim($_POST['firstname']);
         } else {
             $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_first_name_error'), ACCOUNT_FIRST_NAME));
             $error = true;
         }
         if (isset($_POST['lastname']) && strlen(trim($_POST['lastname'])) >= ACCOUNT_LAST_NAME) {
             $address_array['lastname'] = trim($_POST['lastname']);
         } else {
             $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_last_name_error'), ACCOUNT_LAST_NAME));
             $error = true;
         }
         if (ACCOUNT_COMPANY > -1) {
             if (isset($_POST['company']) && (ACCOUNT_COMPANY == 0 || strlen(trim($_POST['company'])) >= ACCOUNT_COMPANY)) {
                 $address_array['company'] = trim($_POST['company']);
             } else {
                 $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_company_error'), ACCOUNT_COMPANY));
                 $error = true;
             }
         }
         if (isset($_POST['street_address']) && strlen(trim($_POST['street_address'])) >= ACCOUNT_STREET_ADDRESS) {
             $address_array['street_address'] = trim($_POST['street_address']);
         } else {
             $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_street_address_error'), ACCOUNT_STREET_ADDRESS));
             $error = true;
         }
         if (ACCOUNT_SUBURB > -1) {
             if (isset($_POST['suburb']) && (ACCOUNT_SUBURB == 0 || strlen(trim($_POST['suburb'])) >= ACCOUNT_SUBURB)) {
                 $address_array['suburb'] = trim($_POST['suburb']);
             } else {
                 $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_suburb_error'), ACCOUNT_SUBURB));
                 $error = true;
             }
         }
         if (ACCOUNT_POST_CODE > -1) {
             if (isset($_POST['postcode']) && (ACCOUNT_POST_CODE == 0 || strlen(trim($_POST['postcode'])) >= ACCOUNT_POST_CODE)) {
                 $address_array['postcode'] = trim($_POST['postcode']);
             } else {
                 $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_post_code_error'), ACCOUNT_POST_CODE));
                 $error = true;
             }
         }
         if (isset($_POST['city']) && strlen(trim($_POST['city'])) >= ACCOUNT_CITY) {
             $address_array['city'] = trim($_POST['city']);
         } else {
             $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_city_error'), ACCOUNT_CITY));
             $error = true;
         }
         if (ACCOUNT_STATE > -1) {
             $Qcheck = $OSCOM_PDO->prepare('select zone_id from :table_zones where zone_country_id = :zone_country_id limit 1');
             $Qcheck->bindInt(':zone_country_id', $_POST['country']);
             $Qcheck->execute();
             $entry_state_has_zones = $Qcheck->fetch() !== false;
             if ($entry_state_has_zones === true) {
                 $Qzone = $OSCOM_PDO->prepare('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_code like :zone_code');
                 $Qzone->bindInt(':zone_country_id', $_POST['country']);
                 $Qzone->bindValue(':zone_code', $_POST['state']);
                 $Qzone->execute();
                 if ($Qzone->fetch() !== false) {
                     $address_array['zone_id'] = $Qzone->valueInt('zone_id');
                 } else {
                     $Qzone = $OSCOM_PDO->prepare('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_name like :zone_name');
                     $Qzone->bindInt(':zone_country_id', $_POST['country']);
                     $Qzone->bindValue(':zone_name', $_POST['state'] . '%');
                     $Qzone->execute();
                     if ($Qzone->fetch() !== false) {
                         $address_array['zone_id'] = $Qzone->valueInt('zone_id');
                     } else {
                         $OSCOM_MessageStack->add('CheckoutAddress', OSCOM::getDef('field_customer_state_select_pull_down_error'));
                         $error = true;
                     }
                 }
             } else {
                 if (isset($_POST['state']) && (ACCOUNT_STATE == 0 || strlen(trim($_POST['state'])) >= ACCOUNT_STATE)) {
                     $address_array['state'] = trim($_POST['state']);
                 } else {
                     $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_state_error'), ACCOUNT_STATE));
                     $error = true;
                 }
             }
         }
         if (isset($_POST['country']) && is_numeric($_POST['country']) && $_POST['country'] > 0) {
             $address_array['country_id'] = (int) $_POST['country'];
         } else {
             $OSCOM_MessageStack->add('CheckoutAddress', OSCOM::getDef('field_customer_country_error'));
             $error = true;
         }
         if (ACCOUNT_TELEPHONE > -1) {
             if (isset($_POST['telephone']) && (ACCOUNT_TELEPHONE == 0 || strlen(trim($_POST['telephone'])) >= ACCOUNT_TELEPHONE)) {
                 $address_array['telephone'] = trim($_POST['telephone']);
             } else {
                 $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_telephone_number_error'), ACCOUNT_TELEPHONE));
                 $error = true;
             }
         }
         if (ACCOUNT_FAX > -1) {
             if (isset($_POST['fax']) && (ACCOUNT_FAX == 0 || strlen(trim($_POST['fax'])) >= ACCOUNT_FAX)) {
                 $address_array['fax'] = trim($_POST['fax']);
             } else {
                 $OSCOM_MessageStack->add('CheckoutAddress', sprintf(OSCOM::getDef('field_customer_fax_number_error'), ACCOUNT_FAX));
                 $error = true;
             }
         }
         if ($error === false) {
             if ($OSCOM_Customer->isLoggedOn()) {
                 $Qab = $OSCOM_PDO->prepare('insert into :table_address_book (customers_id, entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id, entry_telephone, entry_fax) values (:customers_id, :entry_gender, :entry_company, :entry_firstname, :entry_lastname, :entry_street_address, :entry_suburb, :entry_postcode, :entry_city, :entry_state, :entry_country_id, :entry_zone_id, :entry_telephone, :entry_fax)');
                 $Qab->bindInt(':customers_id', $OSCOM_Customer->getID());
                 $Qab->bindValue(':entry_gender', isset($address_array['gender']) ? $address_array['gender'] : '');
                 $Qab->bindValue(':entry_company', isset($address_array['company']) ? $address_array['company'] : '');
                 $Qab->bindValue(':entry_firstname', $address_array['firstname']);
                 $Qab->bindValue(':entry_lastname', $address_array['lastname']);
                 $Qab->bindValue(':entry_street_address', $address_array['street_address']);
                 $Qab->bindValue(':entry_suburb', isset($address_array['suburb']) ? $address_array['suburb'] : '');
                 $Qab->bindValue(':entry_postcode', isset($address_array['postcode']) ? $address_array['postcode'] : '');
                 $Qab->bindValue(':entry_city', $address_array['city']);
                 $Qab->bindValue(':entry_state', $address_array['zone_id'] > 0 ? '' : $address_array['state']);
                 $Qab->bindInt(':entry_country_id', $address_array['country_id']);
                 $Qab->bindInt(':entry_zone_id', $address_array['zone_id']);
                 $Qab->bindValue(':entry_telephone', isset($address_array['telephone']) ? $address_array['telephone'] : '');
                 $Qab->bindValue(':entry_fax', isset($address_array['fax']) ? $address_array['fax'] : '');
                 $Qab->execute();
                 if ($Qab->rowCount() === 1) {
                     $address_book_id = $OSCOM_PDO->lastInsertId();
                     if (!$OSCOM_Customer->hasDefaultAddress()) {
                         $Qcustomer = $OSCOM_PDO->prepare('update :table_customers set customers_default_address_id = :customers_default_address_id where customers_id = :customers_id');
                         $Qcustomer->bindInt(':customers_default_address_id', $address_book_id);
                         $Qcustomer->bindInt(':customers_id', $OSCOM_Customer->getID());
                         $Qcustomer->execute();
                         $OSCOM_Customer->setCountryID($address_array['country_id']);
                         $OSCOM_Customer->setZoneID($address_array['zone_id']);
                         $OSCOM_Customer->setDefaultAddressID($address_book_id);
                     }
                     $OSCOM_ShoppingCart->setBillingAddress($address_book_id);
                     $OSCOM_ShoppingCart->resetBillingMethod();
                     OSCOM::redirect(OSCOM::getLink(null, null, 'Confirm', 'SSL'));
                 } else {
                     $OSCOM_MessageStack->add('CheckoutAddress', 'Error inserting into address book table.');
                 }
             } else {
                 $OSCOM_Customer->setGender(isset($address_array['gender']) ? $address_array['gender'] : null);
                 $OSCOM_Customer->setFirstName($address_array['firstname']);
                 $OSCOM_Customer->setLastName($address_array['lastname']);
                 $OSCOM_Customer->setCountryID($address_array['country_id']);
                 $OSCOM_Customer->setZoneID($address_array['zone_id']);
                 $OSCOM_ShoppingCart->setBillingAddress($address_array);
                 $OSCOM_ShoppingCart->resetBillingMethod();
                 OSCOM::redirect(OSCOM::getLink(null, null, null, 'SSL'));
             }
         }
         // process the selected shipping destination
     } elseif (isset($_POST['ab']) && is_numeric($_POST['ab'])) {
         if (AddressBook::checkEntry($_POST['ab'])) {
             $OSCOM_ShoppingCart->setBillingAddress($_POST['ab']);
             $OSCOM_ShoppingCart->resetBillingMethod();
             OSCOM::redirect(OSCOM::getLink(null, null, 'Billing', 'SSL'));
         } else {
             OSCOM::redirect(OSCOM::getLink(null, null, 'Billing&Address', 'SSL'));
         }
     } else {
         OSCOM::redirect(OSCOM::getLink(null, null, 'Confirm', 'SSL'));
     }
 }
Example #9
0
    <div style="clear: both;"></div>
  </div>
</div>

<div class="moduleBox">
  <h6><?php 
echo OSCOM::getDef('address_book_title');
?>
</h6>

  <div class="content">
    <table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php 
$Qaddresses = AddressBook::getListing();
while ($Qaddresses->next()) {
    ?>

      <tr class="moduleRow" onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">
        <td>
          <b><?php 
    echo $Qaddresses->valueProtected('firstname') . ' ' . $Qaddresses->valueProtected('lastname');
    ?>
</b>

<?php 
    if ($Qaddresses->valueInt('address_book_id') == $OSCOM_Customer->getDefaultAddressID()) {
        echo '&nbsp;<small><i>' . OSCOM::getDef('primary_address_marker') . '</i></small>';
    }
    ?>
    if (AddressBook::numberOfEntries() >= MAX_ADDRESS_BOOK_ENTRIES) {
        $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('error_address_book_full'));
    }
}
?>

<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<?php 
if ($OSCOM_MessageStack->exists('AddressBook')) {
    echo $OSCOM_MessageStack->get('AddressBook');
}
if ($OSCOM_Customer->hasDefaultAddress() === false || isset($_GET['Create']) && AddressBook::numberOfEntries() < MAX_ADDRESS_BOOK_ENTRIES || isset($osC_oiAddress) && !empty($osC_oiAddress)) {
    ?>

<form name="address_book" action="<?php 
    echo OSCOM::getLink(null, null, 'AddressBook&' . (isset($_GET['Edit']) ? 'Edit=' . $_GET['Edit'] : 'Create') . '&Process', 'SSL');
    ?>
" method="post" onsubmit="return check_form(address_book);">

<div class="moduleBox">
  <em style="float: right; margin-top: 10px;"><?php 
    echo OSCOM::getDef('form_required_information');
    ?>
</em>

  <h6><?php 
    echo OSCOM::getDef('address_book_new_address_title');
Example #11
0
 public static function insert()
 {
     $OSCOM_ShoppingCart = Registry::get('ShoppingCart');
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_Currencies = Registry::get('Currencies');
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Tax = Registry::get('Tax');
     if (isset($_SESSION['prepOrderID'])) {
         $_prep = explode('-', $_SESSION['prepOrderID']);
         if ($_prep[0] == $OSCOM_ShoppingCart->getCartID()) {
             return $_prep[1];
             // order_id
         } else {
             if (self::getStatusID($_prep[1]) === 4) {
                 self::remove($_prep[1]);
             }
         }
     }
     if ($OSCOM_Customer->isLoggedOn()) {
         $customer_address = AddressBook::getEntry($OSCOM_Customer->getDefaultAddressID());
     } else {
         $customer_address = array('company' => $OSCOM_ShoppingCart->getShippingAddress('company'), 'street_address' => $OSCOM_ShoppingCart->getShippingAddress('street_address'), 'suburb' => $OSCOM_ShoppingCart->getShippingAddress('suburb'), 'city' => $OSCOM_ShoppingCart->getShippingAddress('city'), 'postcode' => $OSCOM_ShoppingCart->getShippingAddress('postcode'), 'state' => $OSCOM_ShoppingCart->getShippingAddress('state'), 'zone_id' => $OSCOM_ShoppingCart->getShippingAddress('zone_id'), 'country_id' => $OSCOM_ShoppingCart->getShippingAddress('country_id'), 'telephone' => $OSCOM_ShoppingCart->getShippingAddress('telephone'));
     }
     $Qorder = $OSCOM_PDO->prepare('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_state_code, customers_country, customers_country_iso2, customers_country_iso3, customers_telephone, customers_email_address, customers_address_format, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_state_code, delivery_country, delivery_country_iso2, delivery_country_iso3, delivery_address_format, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_state_code, billing_country, billing_country_iso2, billing_country_iso3, billing_address_format, payment_method, payment_module, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city, :customers_postcode, :customers_state, :customers_state_code, :customers_country, :customers_country_iso2, :customers_country_iso3, :customers_telephone, :customers_email_address, :customers_address_format, :customers_ip_address, :delivery_name, :delivery_company, :delivery_street_address, :delivery_suburb, :delivery_city, :delivery_postcode, :delivery_state, :delivery_state_code, :delivery_country, :delivery_country_iso2, :delivery_country_iso3, :delivery_address_format, :billing_name, :billing_company, :billing_street_address, :billing_suburb, :billing_city, :billing_postcode, :billing_state, :billing_state_code, :billing_country, :billing_country_iso2, :billing_country_iso3, :billing_address_format, :payment_method, :payment_module, now(), :orders_status, :currency, :currency_value)');
     $Qorder->bindInt(':customers_id', $OSCOM_Customer->getID());
     $Qorder->bindValue(':customers_name', $OSCOM_Customer->getName());
     $Qorder->bindValue(':customers_company', $customer_address['company']);
     $Qorder->bindValue(':customers_street_address', $customer_address['street_address']);
     $Qorder->bindValue(':customers_suburb', $customer_address['suburb']);
     $Qorder->bindValue(':customers_city', $customer_address['city']);
     $Qorder->bindValue(':customers_postcode', $customer_address['postcode']);
     $Qorder->bindValue(':customers_state', $customer_address['state']);
     $Qorder->bindValue(':customers_state_code', Address::getZoneCode($customer_address['zone_id']));
     $Qorder->bindValue(':customers_country', Address::getCountryName($customer_address['country_id']));
     $Qorder->bindValue(':customers_country_iso2', Address::getCountryIsoCode2($customer_address['country_id']));
     $Qorder->bindValue(':customers_country_iso3', Address::getCountryIsoCode3($customer_address['country_id']));
     $Qorder->bindValue(':customers_telephone', $customer_address['telephone']);
     $Qorder->bindValue(':customers_email_address', $OSCOM_Customer->getEmailAddress());
     $Qorder->bindValue(':customers_address_format', Address::getFormat($customer_address['country_id']));
     $Qorder->bindValue(':customers_ip_address', OSCOM::getIPAddress());
     $Qorder->bindValue(':delivery_name', $OSCOM_ShoppingCart->getShippingAddress('firstname') . ' ' . $OSCOM_ShoppingCart->getShippingAddress('lastname'));
     $Qorder->bindValue(':delivery_company', $OSCOM_ShoppingCart->getShippingAddress('company'));
     $Qorder->bindValue(':delivery_street_address', $OSCOM_ShoppingCart->getShippingAddress('street_address'));
     $Qorder->bindValue(':delivery_suburb', $OSCOM_ShoppingCart->getShippingAddress('suburb'));
     $Qorder->bindValue(':delivery_city', $OSCOM_ShoppingCart->getShippingAddress('city'));
     $Qorder->bindValue(':delivery_postcode', $OSCOM_ShoppingCart->getShippingAddress('postcode'));
     $Qorder->bindValue(':delivery_state', $OSCOM_ShoppingCart->getShippingAddress('state'));
     $Qorder->bindValue(':delivery_state_code', $OSCOM_ShoppingCart->getShippingAddress('zone_code'));
     $Qorder->bindValue(':delivery_country', $OSCOM_ShoppingCart->getShippingAddress('country_title'));
     $Qorder->bindValue(':delivery_country_iso2', $OSCOM_ShoppingCart->getShippingAddress('country_iso_code_2'));
     $Qorder->bindValue(':delivery_country_iso3', $OSCOM_ShoppingCart->getShippingAddress('country_iso_code_3'));
     $Qorder->bindValue(':delivery_address_format', $OSCOM_ShoppingCart->getShippingAddress('format'));
     $Qorder->bindValue(':billing_name', $OSCOM_ShoppingCart->getBillingAddress('firstname') . ' ' . $OSCOM_ShoppingCart->getBillingAddress('lastname'));
     $Qorder->bindValue(':billing_company', $OSCOM_ShoppingCart->getBillingAddress('company'));
     $Qorder->bindValue(':billing_street_address', $OSCOM_ShoppingCart->getBillingAddress('street_address'));
     $Qorder->bindValue(':billing_suburb', $OSCOM_ShoppingCart->getBillingAddress('suburb'));
     $Qorder->bindValue(':billing_city', $OSCOM_ShoppingCart->getBillingAddress('city'));
     $Qorder->bindValue(':billing_postcode', $OSCOM_ShoppingCart->getBillingAddress('postcode'));
     $Qorder->bindValue(':billing_state', $OSCOM_ShoppingCart->getBillingAddress('state'));
     $Qorder->bindValue(':billing_state_code', $OSCOM_ShoppingCart->getBillingAddress('zone_code'));
     $Qorder->bindValue(':billing_country', $OSCOM_ShoppingCart->getBillingAddress('country_title'));
     $Qorder->bindValue(':billing_country_iso2', $OSCOM_ShoppingCart->getBillingAddress('country_iso_code_2'));
     $Qorder->bindValue(':billing_country_iso3', $OSCOM_ShoppingCart->getBillingAddress('country_iso_code_3'));
     $Qorder->bindValue(':billing_address_format', $OSCOM_ShoppingCart->getBillingAddress('format'));
     $Qorder->bindValue(':payment_method', $OSCOM_ShoppingCart->getBillingMethod('title'));
     // HPDL verify payment module class
     $Qorder->bindValue(':payment_module', $OSCOM_ShoppingCart->getBillingMethod('id'));
     $Qorder->bindInt(':orders_status', 4);
     // HPDL move currencies to the products level
     $Qorder->bindValue(':currency', $OSCOM_Currencies->getCode());
     $Qorder->bindValue(':currency_value', $OSCOM_Currencies->value($OSCOM_Currencies->getCode()));
     $Qorder->execute();
     $insert_id = $OSCOM_PDO->lastInsertId();
     foreach ($OSCOM_ShoppingCart->getOrderTotals() as $module) {
         $Qtotals = $OSCOM_PDO->prepare('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)');
         $Qtotals->bindInt(':orders_id', $insert_id);
         $Qtotals->bindValue(':title', $module['title']);
         $Qtotals->bindValue(':text', $module['text']);
         $Qtotals->bindValue(':value', $module['value']);
         $Qtotals->bindValue(':class', $module['code']);
         $Qtotals->bindInt(':sort_order', $module['sort_order']);
         $Qtotals->execute();
     }
     $Qstatus = $OSCOM_PDO->prepare('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, now(), :customer_notified, :comments)');
     $Qstatus->bindInt(':orders_id', $insert_id);
     $Qstatus->bindInt(':orders_status_id', 4);
     $Qstatus->bindInt(':customer_notified', '0');
     $Qstatus->bindValue(':comments', isset($_SESSION['comments']) ? $_SESSION['comments'] : '');
     $Qstatus->execute();
     foreach ($OSCOM_ShoppingCart->getProducts() as $products) {
         $Qproducts = $OSCOM_PDO->prepare('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :products_tax, :products_quantity)');
         $Qproducts->bindInt(':orders_id', $insert_id);
         $Qproducts->bindInt(':products_id', Products::getProductID($products['id']));
         $Qproducts->bindValue(':products_model', $products['model']);
         $Qproducts->bindValue(':products_name', $products['name']);
         $Qproducts->bindValue(':products_price', $products['price']);
         $Qproducts->bindValue(':products_tax', $OSCOM_Tax->getTaxRate($products['tax_class_id']));
         $Qproducts->bindInt(':products_quantity', $products['quantity']);
         $Qproducts->execute();
         $order_products_id = $OSCOM_PDO->lastInsertId();
         if ($OSCOM_ShoppingCart->isVariant($products['item_id'])) {
             foreach ($OSCOM_ShoppingCart->getVariant($products['item_id']) as $variant) {
                 /* HPDL
                             if (DOWNLOAD_ENABLED == '1') {
                               $Qattributes = $OSCOM_PDO->prepare('select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
                               $Qattributes->bindInt(':products_id', $products['id']);
                               $Qattributes->bindInt(':options_id', $attributes['options_id']);
                               $Qattributes->bindInt(':options_values_id', $attributes['options_values_id']);
                               $Qattributes->bindInt(':popt_language_id', $OSCOM_Language->getID());
                               $Qattributes->bindInt(':poval_language_id', $OSCOM_Language->getID());
                               $Qattributes->execute();
                             }
                 */
                 $Qvariant = $OSCOM_PDO->prepare('insert into :table_orders_products_variants (orders_id, orders_products_id, group_title, value_title) values (:orders_id, :orders_products_id, :group_title, :value_title)');
                 $Qvariant->bindInt(':orders_id', $insert_id);
                 $Qvariant->bindInt(':orders_products_id', $order_products_id);
                 $Qvariant->bindValue(':group_title', $variant['group_title']);
                 $Qvariant->bindValue(':value_title', $variant['value_title']);
                 $Qvariant->execute();
                 /*HPDL
                             if ((DOWNLOAD_ENABLED == '1') && (strlen($Qattributes->value('products_attributes_filename')) > 0)) {
                               $Qopd = $OSCOM_PDO->prepare('insert into :table_orders_products_download (orders_id, orders_products_id, orders_products_filename, download_maxdays, download_count) values (:orders_id, :orders_products_id, :orders_products_filename, :download_maxdays, :download_count)');
                               $Qopd->bindInt(':orders_id', $insert_id);
                               $Qopd->bindInt(':orders_products_id', $order_products_id);
                               $Qopd->bindValue(':orders_products_filename', $Qattributes->value('products_attributes_filename'));
                               $Qopd->bindValue(':download_maxdays', $Qattributes->value('products_attributes_maxdays'));
                               $Qopd->bindValue(':download_count', $Qattributes->value('products_attributes_maxcount'));
                               $Qopd->execute();
                             }
                 */
             }
         }
     }
     $_SESSION['prepOrderID'] = $OSCOM_ShoppingCart->getCartID() . '-' . $insert_id;
     return $insert_id;
 }
?>

<?php 
echo osc_image(DIR_WS_IMAGES . $OSCOM_Template->getPageImage(), $OSCOM_Template->getPageTitle(), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT, 'id="pageIcon"');
?>

<h1><?php 
echo $OSCOM_Template->getPageTitle();
?>
</h1>

<?php 
if ($OSCOM_MessageStack->exists('AddressBook')) {
    echo $OSCOM_MessageStack->get('AddressBook');
}
if ($OSCOM_Customer->hasDefaultAddress() === false || isset($_GET['Create']) && AddressBook::numberOfEntries() < MAX_ADDRESS_BOOK_ENTRIES || isset($Qentry) && $Qentry->numberOfRows() === 1) {
    ?>

<form name="address_book" action="<?php 
    echo OSCOM::getLink(null, null, 'AddressBook&' . (isset($_GET['Edit']) ? 'Edit=' . $_GET['Edit'] : 'Create') . '&Process', 'SSL');
    ?>
" method="post" onsubmit="return check_form(address_book);">

<div class="moduleBox">
  <em style="float: right; margin-top: 10px;"><?php 
    echo OSCOM::getDef('form_required_information');
    ?>
</em>

  <h6><?php 
    echo OSCOM::getDef('address_book_new_address_title');