function osc_cfg_set_countries_pulldown_menu($default, $key = null)
{
    $name = !empty($key) ? 'configuration[' . $key . ']' : 'configuration_value';
    $countries_array = array();
    foreach (Address::getCountries() as $country) {
        $countries_array[] = array('id' => $country['id'], 'text' => $country['name']);
    }
    return osc_draw_pull_down_menu($name, $countries_array, $default);
}
function osc_cfg_set_zones_pulldown_menu($default, $key = null)
{
    $name = !empty($key) ? 'configuration[' . $key . ']' : 'configuration_value';
    $zones_array = array();
    foreach (Address::getZones() as $zone) {
        $zones_array[] = array('id' => $zone['id'], 'text' => $zone['name'], 'group' => $zone['country_name']);
    }
    return HTML::selectMenu($name, $zones_array, $default);
}
 public static function execute()
 {
     $data = array('firstname' => $_GET['firstname'], 'lastname' => $_GET['lastname'], 'street_address' => $_GET['street_address'], 'city' => $_GET['city'], 'postcode' => $_GET['postcode'], 'zone_code' => '', 'state' => '', 'country_id' => $_GET['country_id'], 'country_title' => '');
     if (isset($_GET['company'])) {
         $data['company'] = $_GET['company'];
     }
     if (isset($_GET['suburb'])) {
         $data['suburb'] = $_GET['suburb'];
     }
     if (isset($_GET['zone_id'])) {
         $data['zone_id'] = $_GET['zone_id'];
     } elseif (isset($_GET['state'])) {
         $data['state'] = $_GET['state'];
     }
     $result = array('address' => Address::format($data, '<br />'), 'rpcStatus' => RPC::STATUS_SUCCESS);
     echo json_encode($result);
 }
            echo $Qaddresses->valueProtected('firstname') . ' ' . $Qaddresses->valueProtected('lastname');
            ?>
</b></td>
            <td align="right"><?php 
            echo HTML::radioField('ab', $Qaddresses->valueInt('address_book_id'), (string) $OSCOM_ShoppingCart->getBillingAddress('id'));
            ?>
</td>
            <td width="10">&nbsp;</td>
          </tr>
          <tr>
            <td width="10">&nbsp;</td>
            <td colspan="3"><table border="0" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10">&nbsp;</td>
                <td><?php 
            echo Address::format($Qaddresses->toArray(), ', ');
            ?>
</td>
                <td width="10">&nbsp;</td>
              </tr>
            </table></td>
            <td width="10">&nbsp;</td>
          </tr>
        </table></td>
        <td width="10">&nbsp;</td>
      </tr>

<?php 
            $radio_buttons++;
        }
        ?>
示例#5
0
<?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\OSCOM;
use osCommerce\OM\Core\Site\Shop\Address;
$countries_array = array(array('id' => '', 'text' => OSCOM::getDef('all_countries')));
foreach (Address::getCountries() as $country) {
    $countries_array[] = array('id' => $country['id'], 'text' => $country['name']);
}
$zones_array = array(array('id' => '', 'text' => OSCOM::getDef('all_zones')));
?>

<script type="text/javascript">
  function update_zone(theForm) {
    var NumState = theForm.zone_id.options.length;
    var SelectedCountry = "";

    while(NumState > 0) {
      NumState--;
      theForm.zone_id.options[NumState] = null;
    }

    SelectedCountry = theForm.zone_country_id.options[theForm.zone_country_id.selectedIndex].value;
}
?>

    <p><label for="ab_country"><?php 
echo OSCOM::getDef('field_country');
?>
</label><?php 
echo HTML::selectMenu('ab_country', $countries_array, STORE_COUNTRY);
?>
</p>

<?php 
if (ACCOUNT_STATE > -1) {
    if (Address::hasZones(STORE_COUNTRY)) {
        $zones_array = array();
        foreach (Address::getZones(STORE_COUNTRY) as $zone) {
            $zones_array[] = array('id' => $zone['id'], 'text' => $zone['name']);
        }
        ?>

    <p><label for="ab_state"><?php 
        echo OSCOM::getDef('field_state');
        ?>
</label><?php 
        echo HTML::selectMenu('ab_state', $zones_array);
        ?>
</p>

<?php 
    } else {
        ?>
<form name="address_book" action="<?php 
echo OSCOM::getLink(null, null, 'AddressBook&Delete=' . $_GET['Delete'] . '&Process', 'SSL');
?>
" method="post">

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

  <div class="content">
    <div style="float: right; padding: 0px 0px 10px 20px;">
      <?php 
echo Address::format($_GET['Delete'], '<br />');
?>
    </div>

    <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
      <?php 
echo '<b>' . OSCOM::getDef('selected_address_title') . '</b><br />' . osc_image(DIR_WS_IMAGES . 'arrow_south_east.gif');
?>
    </div>

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

    <div style="clear: both;"></div>
  </div>
示例#8
0
 public static function execute()
 {
     $result = array('zones' => Address::getZones($_GET['country_id']), 'rpcStatus' => RPC::STATUS_SUCCESS);
     echo json_encode($result);
 }
示例#9
0
<?php 
    if ($Qaddresses->valueInt('address_book_id') == $OSCOM_Customer->getDefaultAddressID()) {
        echo '&nbsp;<small><i>' . OSCOM::getDef('primary_address_marker') . '</i></small>';
    }
    ?>

        </td>
        <td align="right"><?php 
    echo osc_link_object(OSCOM::getLink(null, null, 'AddressBook&Edit=' . $Qaddresses->valueInt('address_book_id'), 'SSL'), osc_draw_image_button('small_edit.gif', OSCOM::getDef('button_edit'))) . '&nbsp;' . osc_link_object(OSCOM::getLink(null, null, 'AddressBook&Delete=' . $Qaddresses->valueInt('address_book_id'), 'SSL'), osc_draw_image_button('small_delete.gif', OSCOM::getDef('button_delete')));
    ?>
</td>
      </tr>
      <tr>
        <td colspan="2" style="padding: 0px 0px 10px 10px;"><?php 
    echo Address::format($Qaddresses->toArray(), '<br />');
    ?>
</td>
      </tr>

<?php 
}
?>

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

<div class="submitFormButtons">
  <span style="float: right;">
        echo $order->info['shipping_method'];
        ?>
</p>

<?php 
    }
}
?>

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

          <p><?php 
echo Address::format($order->billing, '<br />');
?>
</p>

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

          <p><?php 
echo $order->info['payment_method'];
?>
</p>
        </td>
        <td width="70%" valign="top">
          <div style="border: 1px; border-style: solid; border-color: #CCCCCC; background-color: #FBFBFB; padding: 5px;">
示例#11
0
          <p><?php 
        echo $OSCOM_ShoppingCart->getShippingMethod('title');
        ?>
</p>

<?php 
    }
}
?>

          <p><?php 
echo '<b>' . OSCOM::getDef('order_billing_address_title') . '</b> ' . osc_link_object(OSCOM::getLink(null, 'Checkout', 'Billing&Address', 'SSL'), '<span class="orderEdit">' . OSCOM::getDef('order_text_edit_title') . '</span>');
?>
</p>
          <p><?php 
echo Address::format($OSCOM_ShoppingCart->getBillingAddress(), '<br />');
?>
</p>

          <p><?php 
echo '<b>' . OSCOM::getDef('order_payment_method_title') . '</b> ' . osc_link_object(OSCOM::getLink(null, 'Checkout', 'Billing', 'SSL'), '<span class="orderEdit">' . OSCOM::getDef('order_text_edit_title') . '</span>');
?>
</p>
          <p><?php 
echo $OSCOM_ShoppingCart->getBillingMethod('title');
?>
</p>
        </td>
        <td width="70%" valign="top">
          <div style="border: 1px; border-style: solid; border-color: #CCCCCC; background-color: #FBFBFB; padding: 5px;">
            <table border="0" width="100%" cellspacing="0" cellpadding="2">
示例#12
0
  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\ObjectInfo;
use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups;
use osCommerce\OM\Core\OSCOM;
use osCommerce\OM\Core\Site\Shop\Address;
$OSCOM_ObjectInfo = new ObjectInfo(ZoneGroups::getEntry($_GET['zID']));
$countries_array = array(array('id' => '', 'text' => OSCOM::getDef('all_countries')));
foreach (Address::getCountries() as $country) {
    $countries_array[] = array('id' => $country['id'], 'text' => $country['name']);
}
$zones_array = array(array('id' => '', 'text' => OSCOM::getDef('all_zones')));
if ($OSCOM_ObjectInfo->get('zone_country_id') > 0) {
    foreach (Address::getZones($OSCOM_ObjectInfo->get('zone_country_id')) as $zone) {
        $zones_array[] = array('id' => $zone['id'], 'text' => $zone['name']);
    }
}
?>

<script type="text/javascript">
  function update_zone(theForm) {
    var NumState = theForm.zone_id.options.length;
    var SelectedCountry = "";

    while(NumState > 0) {
      NumState--;
      theForm.zone_id.options[NumState] = null;
    }
示例#13
0
 public static function sendEmail($id)
 {
     $OSCOM_PDO = Registry::get('PDO');
     $OSCOM_Currencies = Registry::get('Currencies');
     $OSCOM_Language = Registry::get('Language');
     $Qorder = $OSCOM_PDO->prepare('select * from :table_orders where orders_id = :orders_id limit 1');
     $Qorder->bindInt(':orders_id', $id);
     $Qorder->execute();
     if ($Qorder->fetch() !== false) {
         $email_order = STORE_NAME . "\n" . OSCOM::getDef('email_order_separator') . "\n" . sprintf(OSCOM::getDef('email_order_order_number'), $id) . "\n" . sprintf(OSCOM::getDef('email_order_invoice_url'), OSCOM::getLink('Shop', 'Account', 'Orders=' . $id, 'SSL', false, true, true)) . "\n" . sprintf(OSCOM::getDef('email_order_date_ordered'), DateTime::getLong()) . "\n\n" . OSCOM::getDef('email_order_products') . "\n" . OSCOM::getDef('email_order_separator') . "\n";
         $Qproducts = $OSCOM_PDO->prepare('select orders_products_id, products_model, products_name, products_price, products_tax, products_quantity from :table_orders_products where orders_id = :orders_id order by orders_products_id');
         $Qproducts->bindInt(':orders_id', $id);
         $Qproducts->execute();
         while ($Qproducts->fetch()) {
             $email_order .= $Qproducts->valueInt('products_quantity') . ' x ' . $Qproducts->value('products_name') . ' (' . $Qproducts->value('products_model') . ') = ' . $OSCOM_Currencies->displayPriceWithTaxRate($Qproducts->value('products_price'), $Qproducts->value('products_tax'), $Qproducts->valueInt('products_quantity'), false, $Qorder->value('currency'), $Qorder->value('currency_value')) . "\n";
             $Qvariants = $OSCOM_PDO->prepare('select group_title, value_title from :table_orders_products_variants where orders_id = :orders_id and orders_products_id = :orders_products_id order by id');
             $Qvariants->bindInt(':orders_id', $id);
             $Qvariants->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id'));
             $Qvariants->execute();
             while ($Qvariants->fetch()) {
                 $email_order .= "\t" . $Qvariants->value('group_title') . ': ' . $Qvariants->value('value_title') . "\n";
             }
         }
         $email_order .= OSCOM::getDef('email_order_separator') . "\n";
         $Qtotals = $OSCOM_PDO->prepare('select title, text from :table_orders_total where orders_id = :orders_id order by sort_order');
         $Qtotals->bindInt(':orders_id', $id);
         $Qtotals->execute();
         while ($Qtotals->fetch()) {
             $email_order .= strip_tags($Qtotals->value('title') . ' ' . $Qtotals->value('text')) . "\n";
         }
         if (strlen($Qorder->value('delivery_name')) > 0 && strlen($Qorder->value('delivery_street_address')) > 0) {
             $address = array('name' => $Qorder->value('delivery_name'), 'company' => $Qorder->value('delivery_company'), 'street_address' => $Qorder->value('delivery_street_address'), 'suburb' => $Qorder->value('delivery_suburb'), 'city' => $Qorder->value('delivery_city'), 'state' => $Qorder->value('delivery_state'), 'zone_code' => $Qorder->value('delivery_state_code'), 'country_title' => $Qorder->value('delivery_country'), 'country_iso2' => $Qorder->value('delivery_country_iso2'), 'country_iso3' => $Qorder->value('delivery_country_iso3'), 'postcode' => $Qorder->value('delivery_postcode'), 'format' => $Qorder->value('delivery_address_format'));
             $email_order .= "\n" . OSCOM::getDef('email_order_delivery_address') . "\n" . OSCOM::getDef('email_order_separator') . "\n" . Address::format($address) . "\n";
         }
         $address = array('name' => $Qorder->value('billing_name'), 'company' => $Qorder->value('billing_company'), 'street_address' => $Qorder->value('billing_street_address'), 'suburb' => $Qorder->value('billing_suburb'), 'city' => $Qorder->value('billing_city'), 'state' => $Qorder->value('billing_state'), 'zone_code' => $Qorder->value('billing_state_code'), 'country_title' => $Qorder->value('billing_country'), 'country_iso2' => $Qorder->value('billing_country_iso2'), 'country_iso3' => $Qorder->value('billing_country_iso3'), 'postcode' => $Qorder->value('billing_postcode'), 'format' => $Qorder->value('billing_address_format'));
         $email_order .= "\n" . OSCOM::getDef('email_order_billing_address') . "\n" . OSCOM::getDef('email_order_separator') . "\n" . Address::format($address) . "\n\n";
         $Qstatus = $OSCOM_PDO->prepare('select orders_status_name from :table_orders_status where orders_status_id = :orders_status_id and language_id = :language_id');
         $Qstatus->bindInt(':orders_status_id', $Qorder->valueInt('orders_status'));
         $Qstatus->bindInt(':language_id', $OSCOM_Language->getID());
         $Qstatus->execute();
         $email_order .= sprintf(OSCOM::getDef('email_order_status'), $Qstatus->value('orders_status_name')) . "\n" . OSCOM::getDef('email_order_separator') . "\n";
         $Qstatuses = $OSCOM_PDO->prepare('select date_added, comments from :table_orders_status_history where orders_id = :orders_id and comments != "" order by orders_status_history_id');
         $Qstatuses->bindInt(':orders_id', $id);
         $Qstatuses->execute();
         while ($Qstatuses->fetch()) {
             $email_order .= DateTime::getLong($Qstatuses->value('date_added')) . "\n\t" . wordwrap(str_replace("\n", "\n\t", $Qstatuses->value('comments')), 60, "\n\t", 1) . "\n\n";
         }
         // HPDL
         //        if (is_object($GLOBALS[$payment])) {
         //          $email_order .= OSCOM::getDef('email_order_payment_method') . "\n" .
         //                          OSCOM::getDef('email_order_separator') . "\n";
         //          $email_order .= $OSCOM_ShoppingCart->getBillingMethod('title') . "\n\n";
         //          if (isset($GLOBALS[$payment]->email_footer)) {
         //            $email_order .= $GLOBALS[$payment]->email_footer . "\n\n";
         //          }
         //        }
         $oEmail = new Mail($Qorder->value('customers_name'), $Qorder->value('customers_email_address'), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, OSCOM::getDef('email_order_subject'));
         $oEmail->setBodyPlain($email_order);
         $oEmail->send();
         // send emails to other people
         if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
             $oEmail = new Mail('', SEND_EXTRA_ORDER_EMAILS_TO, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, OSCOM::getDef('email_order_subject'));
             $oEmail->setBodyPlain($email_order);
             $oEmail->send();
         }
     }
 }
 public function setBillingAddress($address)
 {
     $OSCOM_Customer = Registry::get('Customer');
     $OSCOM_PDO = Registry::get('PDO');
     $previous_address = false;
     if (isset($this->_billing_address['id'])) {
         $previous_address = $this->getBillingAddress();
     }
     if ($OSCOM_Customer->isLoggedOn() && is_numeric($address)) {
         $Qaddress = $OSCOM_PDO->prepare('select ab.*, z.zone_code, z.zone_name, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id) left join :table_countries c on (ab.entry_country_id = c.countries_id) where ab.customers_id = :customers_id and ab.address_book_id = :address_book_id');
         $Qaddress->bindInt(':customers_id', $OSCOM_Customer->getID());
         $Qaddress->bindInt(':address_book_id', $address);
         $Qaddress->execute();
         if ($Qaddress->fetch() !== false) {
             $this->_billing_address = array('id' => (int) $address, 'firstname' => $Qaddress->valueProtected('entry_firstname'), 'lastname' => $Qaddress->valueProtected('entry_lastname'), 'gender' => $Qaddress->valueProtected('entry_gender'), 'company' => $Qaddress->valueProtected('entry_company'), 'street_address' => $Qaddress->valueProtected('entry_street_address'), 'suburb' => $Qaddress->valueProtected('entry_suburb'), 'city' => $Qaddress->valueProtected('entry_city'), 'postcode' => $Qaddress->valueProtected('entry_postcode'), 'state' => strlen($Qaddress->valueProtected('entry_state')) > 0 ? $Qaddress->valueProtected('entry_state') : $Qaddress->valueProtected('zone_name'), 'zone_id' => $Qaddress->valueInt('entry_zone_id'), 'zone_code' => $Qaddress->value('zone_code'), 'country_id' => $Qaddress->valueInt('entry_country_id'), 'country_title' => $Qaddress->valueProtected('countries_name'), 'country_iso_code_2' => $Qaddress->valueProtected('countries_iso_code_2'), 'country_iso_code_3' => $Qaddress->valueProtected('countries_iso_code_3'), 'format' => $Qaddress->value('address_format'), 'telephone' => $Qaddress->valueProtected('entry_telephone'), 'fax' => $Qaddress->valueProtected('entry_fax'));
         }
     } else {
         $this->_billing_address = array('id' => 0, 'firstname' => HTML::outputProtected($address['firstname']), 'lastname' => HTML::outputProtected($address['lastname']), 'gender' => HTML::outputProtected($address['gender']), 'company' => HTML::outputProtected($address['company']), 'street_address' => HTML::outputProtected($address['street_address']), 'suburb' => HTML::outputProtected($address['suburb']), 'city' => HTML::outputProtected($address['city']), 'postcode' => HTML::outputProtected($address['postcode']), 'state' => isset($address['state']) && !empty($address['state']) ? HTML::outputProtected($address['state']) : HTML::outputProtected(Address::getZoneName($address['zone_id'])), 'zone_id' => (int) $address['zone_id'], 'zone_code' => HTML::outputProtected(Address::getZoneCode($address['zone_id'])), 'country_id' => HTML::outputProtected($address['country_id']), 'country_title' => HTML::outputProtected(Address::getCountryName($address['country_id'])), 'country_iso_code_2' => HTML::outputProtected(Address::getCountryIsoCode2($address['country_id'])), 'country_iso_code_3' => HTML::outputProtected(Address::getCountryIsoCode3($address['country_id'])), 'format' => Address::getFormat($address['country_id']), 'telephone' => HTML::outputProtected($address['telephone']), 'fax' => HTML::outputProtected($address['fax']));
     }
     if (is_array($previous_address) && ($previous_address['id'] != $this->_billing_address['id'] || $previous_address['country_id'] != $this->_billing_address['country_id'] || $previous_address['zone_id'] != $this->_billing_address['zone_id'] || $previous_address['state'] != $this->_billing_address['state'] || $previous_address['postcode'] != $this->_billing_address['postcode'])) {
         $this->_calculate();
     }
 }