<td width="10"> </td> </tr> <?php $radio_buttons++; } ?> </table> </div> </div> <?php } } if (osC_AddressBook::numberOfEntries() < MAX_ADDRESS_BOOK_ENTRIES) { ?> <div class="moduleBox"> <h6><?php echo $osC_Language->get('new_billing_address_title'); ?> </h6> <div class="content"> <?php echo $osC_Language->get('new_billing_address'); ?> <div style="margin: 10px 30px 10px 30px;"> <?php
<?php /* $Id: address_book_delete.php $ TomatoCart Open Source Shopping Cart Solutions http://www.tomatocart.com Copyright (c) 2009 Wuxi Elootec Technology Co., Ltd; Copyright (c) 2006 osCommerce 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. */ $Qentry = osC_AddressBook::getEntry($_GET['address_book']); ?> <h1><?php echo $osC_Template->getPageTitle(); ?> </h1> <div class="moduleBox"> <h6><?php echo $osC_Language->get('address_book_delete_address_title'); ?> </h6> <div class="content"> <div style="float: right; padding: 0px 0px 10px 20px;"> <?php echo osC_Address::format($_GET['address_book'], '<br />');
?> <li> <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;"> <?php echo '<b>' . $osC_Language->get('please_select') . '</b><br />' . osc_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?> </div> <p style="margin-top: 0px;"><?php echo $osC_Language->get('choose_billing_address'); ?> </p> </li> <li style="margin-bottom: 10px"> <?php $Qaddresses = osC_AddressBook::getListing(); $address = array(); while ($Qaddresses->next()) { $address[] = array('id' => $Qaddresses->valueInt('address_book_id'), 'text' => osC_Address::format($Qaddresses->toArray(), ', ')); } if ($create_billing_address == null) { $create_billing_address = false; } echo osc_draw_pull_down_menu('sel_billing_address', $address); ?> </li> <?php } ?> <div id="billingAddressDetails" style="display: <?php
function saveEntry($data, $id = '') { global $osC_Database, $osC_Customer; $updated_record = false; if (is_numeric($id)) { $Qab = $osC_Database->query('update :table_address_book set customers_id = :customers_id, entry_gender = :entry_gender, entry_company = :entry_company, entry_firstname = :entry_firstname, entry_lastname = :entry_lastname, entry_street_address = :entry_street_address, entry_suburb = :entry_suburb, entry_postcode = :entry_postcode, entry_city = :entry_city, entry_state = :entry_state, entry_country_id = :entry_country_id, entry_zone_id = :entry_zone_id, entry_telephone = :entry_telephone, entry_fax = :entry_fax where address_book_id = :address_book_id and customers_id = :customers_id'); $Qab->bindInt(':address_book_id', $id); $Qab->bindInt(':customers_id', $osC_Customer->getID()); } else { $Qab = $osC_Database->query('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->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qab->bindInt(':customers_id', $osC_Customer->getID()); $Qab->bindValue(':entry_gender', ACCOUNT_GENDER > -1 && isset($data['gender']) && ($data['gender'] == 'm' || $data['gender'] == 'f') ? $data['gender'] : ''); $Qab->bindValue(':entry_company', ACCOUNT_COMPANY > -1 ? $data['company'] : ''); $Qab->bindValue(':entry_firstname', $data['firstname']); $Qab->bindValue(':entry_lastname', $data['lastname']); $Qab->bindValue(':entry_street_address', $data['street_address']); $Qab->bindValue(':entry_suburb', ACCOUNT_SUBURB > -1 ? $data['suburb'] : ''); $Qab->bindValue(':entry_postcode', ACCOUNT_POST_CODE > -1 ? $data['postcode'] : ''); $Qab->bindValue(':entry_city', $data['city']); $Qab->bindValue(':entry_state', ACCOUNT_STATE > -1 ? isset($data['zone_id']) && $data['zone_id'] > 0 ? '' : $data['state'] : ''); $Qab->bindInt(':entry_country_id', $data['country']); $Qab->bindInt(':entry_zone_id', ACCOUNT_STATE > -1 ? isset($data['zone_id']) && $data['zone_id'] > 0 ? $data['zone_id'] : 0 : ''); $Qab->bindValue(':entry_telephone', ACCOUNT_TELEPHONE > -1 ? $data['telephone'] : ''); $Qab->bindValue(':entry_fax', ACCOUNT_FAX > -1 ? $data['fax'] : ''); $Qab->execute(); if ($Qab->affectedRows() === 1) { $updated_record = true; } if (isset($data['primary']) && $data['primary'] === true) { if (is_numeric($id) === false) { $id = $osC_Database->nextID(); } if (osC_AddressBook::setPrimaryAddress($id)) { $osC_Customer->setCountryID($data['country']); $osC_Customer->setZoneID($data['zone_id'] > 0 ? (int) $data['zone_id'] : '0'); $osC_Customer->setDefaultAddressID($id); if ($updated_record === false) { $updated_record = true; } } } if ($updated_record === true) { return true; } return false; }
if (osC_AddressBook::numberOfEntries() >= MAX_ADDRESS_BOOK_ENTRIES) { $messageStack->add('address_book', $osC_Language->get('error_address_book_full')); } } ?> <h1><?php echo $osC_Template->getPageTitle(); ?> </h1> <?php if ($messageStack->size('address_book') > 0) { echo $messageStack->output('address_book'); } if ($osC_Customer->hasDefaultAddress() === false || isset($_GET['new']) && osC_AddressBook::numberOfEntries() < MAX_ADDRESS_BOOK_ENTRIES || isset($Qentry) && $Qentry->numberOfRows() === 1) { ?> <form name="address_book" action="<?php echo osc_href_link(FILENAME_ACCOUNT, 'address_book=' . $_GET['address_book'] . '&' . (isset($_GET['edit']) ? 'edit' : 'new') . '=save', 'SSL'); ?> " method="post" onsubmit="return check_form(address_book);"> <div class="moduleBox"> <h6><em><?php echo $osC_Language->get('form_required_information'); ?> </em><?php echo $osC_Language->get('address_book_new_address_title'); ?>
function createNewAddress($customers_id, $address) { global $osC_Database, $osC_Customer; $Qab = $osC_Database->query('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->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qab->bindInt(':customers_id', $customers_id); $Qab->bindValue(':entry_gender', $address['gender']); $Qab->bindValue(':entry_company', $address['company']); $Qab->bindValue(':entry_firstname', $address['firstname']); $Qab->bindValue(':entry_lastname', $address['lastname']); $Qab->bindValue(':entry_street_address', $address['street_address']); $Qab->bindValue(':entry_suburb', $address['suburb']); $Qab->bindValue(':entry_postcode', $address['postcode']); $Qab->bindValue(':entry_city', $address['city']); $Qab->bindValue(':entry_state', $address['state']); $Qab->bindInt(':entry_country_id', $address['country_id']); $Qab->bindInt(':entry_zone_id', $address['zone_id']); $Qab->bindValue(':entry_telephone', $address['ship_to_this_address']); $Qab->bindValue(':entry_fax', $address['fax']); $Qab->execute(); if (!$osC_Database->isError()) { $address_book_id = $osC_Database->nextID(); $Qcheck = $osC_Database->query('select customers_default_address_id from :table_customers where customers_id = :customers_id'); $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); $Qcheck->bindInt(':customers_id', $customers_id); $Qcheck->execute(); if ($Qcheck->valueInt('customers_default_address_id') == 0) { require_once 'includes/classes/address_book.php'; if (osC_AddressBook::setPrimaryAddress($address_book_id)) { $osC_Customer->setCountryID($address['country_id']); $osC_Customer->setZoneID($address['zone_id'] > 0 ? (int) $address['zone_id'] : '0'); $osC_Customer->setDefaultAddressID($address_book_id); $osC_Customer->synchronizeCustomerDataWithSession(); return true; } else { return false; } } return true; } return false; }
function _delete($id) { global $osC_MessageStack, $osC_Language, $osC_Customer; if ($id != $osC_Customer->getDefaultAddressID()) { if (osC_AddressBook::deleteEntry($id)) { $osC_MessageStack->add('address_book', $osC_Language->get('success_address_book_entry_deleted'), 'success'); } } else { $osC_MessageStack->add('address_book', $osC_Language->get('warning_primary_address_deletion'), 'warning'); } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL')); }
function insert() { global $osC_Database, $osC_Customer, $osC_Language, $osC_Currencies, $osC_ShoppingCart, $osC_Tax; if (isset($_SESSION['prepOrderID'])) { $_prep = explode('-', $_SESSION['prepOrderID']); if ($_prep[0] == $osC_ShoppingCart->getCartID()) { return $_prep[1]; // order_id } else { if (osC_Order::getStatusID($_prep[1]) === 4) { osC_Order::remove($_prep[1]); } } } $customer_address = osC_AddressBook::getEntry($osC_Customer->getDefaultAddressID())->toArray(); $Qorder = $osC_Database->query('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->bindTable(':table_orders', TABLE_ORDERS); $Qorder->bindInt(':customers_id', $osC_Customer->getID()); $Qorder->bindValue(':customers_name', $osC_Customer->getName()); $Qorder->bindValue(':customers_company', $customer_address['entry_company']); $Qorder->bindValue(':customers_street_address', $customer_address['entry_street_address']); $Qorder->bindValue(':customers_suburb', $customer_address['entry_suburb']); $Qorder->bindValue(':customers_city', $customer_address['entry_city']); $Qorder->bindValue(':customers_postcode', $customer_address['entry_postcode']); $Qorder->bindValue(':customers_state', $customer_address['entry_state']); $Qorder->bindValue(':customers_state_code', osC_Address::getZoneCode($customer_address['entry_zone_id'])); $Qorder->bindValue(':customers_country', osC_Address::getCountryName($customer_address['entry_country_id'])); $Qorder->bindValue(':customers_country_iso2', osC_Address::getCountryIsoCode2($customer_address['entry_country_id'])); $Qorder->bindValue(':customers_country_iso3', osC_Address::getCountryIsoCode3($customer_address['entry_country_id'])); $Qorder->bindValue(':customers_telephone', $customer_address['entry_telephone']); $Qorder->bindValue(':customers_email_address', $osC_Customer->getEmailAddress()); $Qorder->bindValue(':customers_address_format', osC_Address::getFormat($customer_address['entry_country_id'])); $Qorder->bindValue(':customers_ip_address', osc_get_ip_address()); $Qorder->bindValue(':delivery_name', $osC_ShoppingCart->getShippingAddress('firstname') . ' ' . $osC_ShoppingCart->getShippingAddress('lastname')); $Qorder->bindValue(':delivery_company', $osC_ShoppingCart->getShippingAddress('company')); $Qorder->bindValue(':delivery_street_address', $osC_ShoppingCart->getShippingAddress('street_address')); $Qorder->bindValue(':delivery_suburb', $osC_ShoppingCart->getShippingAddress('suburb')); $Qorder->bindValue(':delivery_city', $osC_ShoppingCart->getShippingAddress('city')); $Qorder->bindValue(':delivery_postcode', $osC_ShoppingCart->getShippingAddress('postcode')); $Qorder->bindValue(':delivery_state', $osC_ShoppingCart->getShippingAddress('state')); $Qorder->bindValue(':delivery_state_code', $osC_ShoppingCart->getShippingAddress('zone_code')); $Qorder->bindValue(':delivery_country', $osC_ShoppingCart->getShippingAddress('country_title')); $Qorder->bindValue(':delivery_country_iso2', $osC_ShoppingCart->getShippingAddress('country_iso_code_2')); $Qorder->bindValue(':delivery_country_iso3', $osC_ShoppingCart->getShippingAddress('country_iso_code_3')); $Qorder->bindValue(':delivery_address_format', $osC_ShoppingCart->getShippingAddress('format')); $Qorder->bindValue(':billing_name', $osC_ShoppingCart->getBillingAddress('firstname') . ' ' . $osC_ShoppingCart->getBillingAddress('lastname')); $Qorder->bindValue(':billing_company', $osC_ShoppingCart->getBillingAddress('company')); $Qorder->bindValue(':billing_street_address', $osC_ShoppingCart->getBillingAddress('street_address')); $Qorder->bindValue(':billing_suburb', $osC_ShoppingCart->getBillingAddress('suburb')); $Qorder->bindValue(':billing_city', $osC_ShoppingCart->getBillingAddress('city')); $Qorder->bindValue(':billing_postcode', $osC_ShoppingCart->getBillingAddress('postcode')); $Qorder->bindValue(':billing_state', $osC_ShoppingCart->getBillingAddress('state')); $Qorder->bindValue(':billing_state_code', $osC_ShoppingCart->getBillingAddress('zone_code')); $Qorder->bindValue(':billing_country', $osC_ShoppingCart->getBillingAddress('country_title')); $Qorder->bindValue(':billing_country_iso2', $osC_ShoppingCart->getBillingAddress('country_iso_code_2')); $Qorder->bindValue(':billing_country_iso3', $osC_ShoppingCart->getBillingAddress('country_iso_code_3')); $Qorder->bindValue(':billing_address_format', $osC_ShoppingCart->getBillingAddress('format')); $Qorder->bindValue(':payment_method', $osC_ShoppingCart->getBillingMethod('title')); $Qorder->bindValue(':payment_module', $GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]->getCode()); $Qorder->bindInt(':orders_status', 4); $Qorder->bindValue(':currency', $osC_Currencies->getCode()); $Qorder->bindValue(':currency_value', $osC_Currencies->value($osC_Currencies->getCode())); $Qorder->execute(); $insert_id = $osC_Database->nextID(); foreach ($osC_ShoppingCart->getOrderTotals() as $module) { $Qtotals = $osC_Database->query('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)'); $Qtotals->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL); $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 = $osC_Database->query('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->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY); $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 ($osC_ShoppingCart->getProducts() as $products) { $Qproducts = $osC_Database->query('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->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); $Qproducts->bindInt(':orders_id', $insert_id); $Qproducts->bindInt(':products_id', osc_get_product_id($products['id'])); $Qproducts->bindValue(':products_model', $products['model']); $Qproducts->bindValue(':products_name', $products['name']); $Qproducts->bindValue(':products_price', $products['price']); $Qproducts->bindValue(':products_tax', $osC_Tax->getTaxRate($products['tax_class_id'])); $Qproducts->bindInt(':products_quantity', $products['quantity']); $Qproducts->execute(); $order_products_id = $osC_Database->nextID(); if ($osC_ShoppingCart->isVariant($products['item_id'])) { foreach ($osC_ShoppingCart->getVariant($products['item_id']) as $variant) { /* HPDL if (DOWNLOAD_ENABLED == '1') { $Qattributes = $osC_Database->query('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->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS); $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES); $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES); $Qattributes->bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD); $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', $osC_Language->getID()); $Qattributes->bindInt(':poval_language_id', $osC_Language->getID()); $Qattributes->execute(); } */ $Qvariant = $osC_Database->query('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->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS); $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 = $osC_Database->query('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->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD); $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'] = $osC_ShoppingCart->getCartID() . '-' . $insert_id; return $insert_id; }