public static function getZonesDropdown() { $result = array(); $result = lC_AddressBook::getZonesDropdownHtml($_GET['country'], $_GET['zone']); if (is_array($result)) { $result['rpcStatus'] = '1'; } echo json_encode($result); }
protected function _delete($id) { global $lC_MessageStack, $lC_Language, $lC_Customer; if ($id != $lC_Customer->getDefaultAddressID()) { if (lC_AddressBook::deleteEntry($id)) { $lC_MessageStack->add('address_book', $lC_Language->get('success_address_book_entry_deleted'), 'success'); } } else { $lC_MessageStack->add('address_book', $lC_Language->get('warning_primary_address_deletion'), 'warning'); } lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL')); }
@version $Id: address_book_details.php v1.0 2013-08-08 datazen $ */ if (ACCOUNT_GENDER > -1) { echo '<li>' . lc_draw_label($lC_Language->get('field_customer_gender'), null, 'fake', ACCOUNT_GENDER > 0) . lc_draw_radio_field('gender', array(array('id' => 'm', 'text' => $lC_Language->get('gender_male')), array('id' => 'f', 'text' => $lC_Language->get('gender_female'))), isset($Qentry) ? $Qentry->value('entry_gender') : (!$lC_Customer->hasDefaultAddress() ? $lC_Customer->getGender() : null)) . '</li>'; } echo '<li>' . lc_draw_label($lC_Language->get('field_customer_first_name'), null, 'firstname', true) . lc_draw_input_field('firstname', isset($Qentry) ? $Qentry->value('entry_firstname') : (!$lC_Customer->hasDefaultAddress() ? $lC_Customer->getFirstName() : null)) . '</li>'; echo '<li>' . lc_draw_label($lC_Language->get('field_customer_last_name'), null, 'lastname', true) . lc_draw_input_field('lastname', isset($Qentry) ? $Qentry->value('entry_lastname') : (!$lC_Customer->hasDefaultAddress() ? $lC_Customer->getLastName() : null)) . '</li>'; if (ACCOUNT_COMPANY > -1) { echo '<li>' . lc_draw_label($lC_Language->get('field_customer_company'), null, 'company', ACCOUNT_COMPANY > 0) . lc_draw_input_field('company', isset($Qentry) ? $Qentry->value('entry_company') : null) . '</li>'; } echo '<li>' . lc_draw_label($lC_Language->get('field_customer_street_address'), null, 'street_address', true) . lc_draw_input_field('street_address', isset($Qentry) ? $Qentry->value('entry_street_address') : null) . '</li>'; if (ACCOUNT_SUBURB > -1) { echo '<li>' . lc_draw_label($lC_Language->get('field_customer_suburb'), null, 'suburb', ACCOUNT_SUBURB > 0) . lc_draw_input_field('suburb', isset($Qentry) ? $Qentry->value('entry_suburb') : null) . '</li>'; } if (ACCOUNT_POST_CODE > -1) { echo '<li>' . lc_draw_label($lC_Language->get('field_customer_post_code'), null, 'postcode', ACCOUNT_POST_CODE > 0) . lc_draw_input_field('postcode', isset($Qentry) ? $Qentry->value('entry_postcode') : null) . '</li>'; } echo '<li>' . lc_draw_label($lC_Language->get('field_customer_city'), null, 'city', true) . lc_draw_input_field('city', isset($Qentry) ? $Qentry->value('entry_city') : null) . '</li>'; if (ACCOUNT_STATE > -1) { echo '<li>' . lc_draw_label($lC_Language->get('field_customer_state'), null, 'state', ACCOUNT_STATE > 0) . (isset($Qentry) ? lC_AddressBook::getZonesField($Qentry->valueInt('entry_country_id')) : lC_AddressBook::getZonesField(STORE_COUNTRY)) . '</li>'; } echo '<li>' . lc_draw_label($lC_Language->get('field_customer_country'), null, 'country', true) . lc_draw_pull_down_menu('country', lC_AddressBook::getCountriesDropdownArray(), isset($Qentry) ? $Qentry->valueInt('entry_country_id') : STORE_COUNTRY) . '</li>'; if (ACCOUNT_TELEPHONE > -1) { echo '<li>' . lc_draw_label($lC_Language->get('field_customer_telephone_number'), null, 'telephone', ACCOUNT_TELEPHONE > 0) . lc_draw_input_field('telephone', isset($Qentry) ? $Qentry->value('entry_telephone') : null) . '</li>'; } if (ACCOUNT_FAX > -1) { echo '<li>' . lc_draw_label($lC_Language->get('field_customer_fax_number'), null, 'fax', ACCOUNT_FAX > 0) . lc_draw_input_field('fax', isset($Qentry) ? $Qentry->value('entry_fax') : null) . '</li>'; } if ($lC_Customer->hasDefaultAddress() && (isset($_GET['edit']) && $lC_Customer->getDefaultAddressID() != $_GET['address_book'] || isset($_GET['new']))) { echo '<li>' . lc_draw_label($lC_Language->get('set_as_primary'), null) . lc_draw_checkbox_field('primary') . '</li>'; }
public function lC_Checkout_Payment() { global $lC_Database, $lC_Session, $lC_ShoppingCart, $lC_Customer, $lC_Services, $lC_Language, $lC_NavigationHistory, $lC_Breadcrumb, $lC_Payment, $lC_MessageStack, $lC_Vqmod; require $lC_Vqmod->modCheck('includes/classes/address_book.php'); if ($lC_Customer->isLoggedOn() === false) { $lC_NavigationHistory->setSnapshot(); lc_redirect(lc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } if ($lC_ShoppingCart->hasContents() === false) { lc_redirect(lc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($lC_ShoppingCart->hasShippingMethod() === false) { if (defined('SKIP_CHECKOUT_SHIPPING_PAGE') && SKIP_CHECKOUT_SHIPPING_PAGE == '1') { if (lC_AddressBook::numberOfEntries() < 1) { lc_redirect(lc_href_link(FILENAME_CHECKOUT, 'payment_address', 'SSL')); } } else { lc_redirect(lc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } } else { if (defined('SKIP_CHECKOUT_SHIPPING_PAGE') && SKIP_CHECKOUT_SHIPPING_PAGE == '1') { if (lC_AddressBook::numberOfEntries() < 1) { lc_redirect(lc_href_link(FILENAME_CHECKOUT, 'payment_address', 'SSL')); } } } // Stock Check if (STOCK_CHECK == '1' && AUTODISABLE_OUT_OF_STOCK_PRODUCT == '1') { foreach ($lC_ShoppingCart->getProducts() as $products) { if ($lC_ShoppingCart->isInStock($products['id']) === false) { lc_redirect(lc_href_link(FILENAME_CHECKOUT, 'SSL')); break; } } } $this->_page_title = $lC_Language->get('payment_method_heading'); if ($lC_Services->isStarted('breadcrumb')) { $lC_Breadcrumb->add($lC_Language->get('breadcrumb_checkout_payment'), lc_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL')); } // redirect to the billing address page when no default address exists if ($lC_Customer->hasDefaultAddress() === false) { $this->_page_title = $lC_Language->get('payment_address_heading'); $this->_page_contents = 'checkout_payment_address.php'; $this->addJavascriptPhpFilename('templates/' . $this->getCode() . '/javascript/addressBookDetails.js.php'); } else { // if no billing destination address was selected, use the customers own address as default if ($lC_ShoppingCart->hasBillingAddress() == false) { $lC_ShoppingCart->setBillingAddress($lC_Customer->getDefaultAddressID()); } else { // verify the selected billing address $Qcheck = $lC_Database->query('select address_book_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id limit 1'); $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qcheck->bindInt(':address_book_id', $lC_ShoppingCart->getBillingAddress('id')); $Qcheck->bindInt(':customers_id', $lC_Customer->getID()); $Qcheck->execute(); if ($Qcheck->numberOfRows() !== 1) { $lC_ShoppingCart->setBillingAddress($lC_Customer->getDefaultAddressID()); $lC_ShoppingCart->resetBillingMethod(); } } // load all enabled payment modules include $lC_Vqmod->modCheck('includes/classes/payment.php'); $lC_Payment = new lC_Payment(); $this->addJavascriptBlock($lC_Payment->getJavascriptBlocks()); } if (isset($_GET['payment_error'])) { $lC_MessageStack->add('checkout_payment', urldecode($_GET['payment_error']), 'error'); } if (isset($_SESSION['messageToStack']) && !empty($_SESSION['messageToStack'])) { $lC_MessageStack->__construct(); } // ppec inject if (isset($_GET['skip']) && $_GET['skip'] == 'no' || isset($_GET['payment_error'])) { if (isset($_SESSION['SKIP_PAYMENT_PAGE'])) { unset($_SESSION['SKIP_PAYMENT_PAGE']); } if (isset($_SESSION['cartSync'])) { unset($_SESSION['cartSync']); } } else { if (isset($_SESSION['SKIP_PAYMENT_PAGE']) && $_SESSION['SKIP_PAYMENT_PAGE'] === TRUE) { lc_redirect(lc_href_link(FILENAME_CHECKOUT, 'confirmation', 'SSL')); } } }
/** * Save an address book entry * * @param array $data An array containing the address book information * @param int $id The ID of the address book entry to update (if this is not provided, a new address book entry is created) * @access public * @return boolean */ public static function saveEntry($data, $id = '') { global $lC_Database, $lC_Customer; $updated_record = false; if (is_numeric($id)) { $Qab = $lC_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', $lC_Customer->getID()); } else { $Qab = $lC_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', $lC_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)) { $id = $lC_Database->nextID(); } if (lC_AddressBook::setPrimaryAddress($id)) { $lC_Customer->setCountryID($data['country']); $lC_Customer->setZoneID($data['zone_id'] > 0 ? (int) $data['zone_id'] : '0'); $lC_Customer->setDefaultAddressID($id); if ($updated_record === false) { $updated_record = true; } } } if ($updated_record === true) { return true; } return false; }
<div class="well"> <p><?php echo $lC_Language->get('primary_address_description'); ?> </p> </div> </div> </div> <div class="row"> <div class="col-sm-12 col-lg-12"> <h3 class="no-margin-top"><?php echo $lC_Language->get('address_book_title'); ?> </h3> <?php $Qaddresses = lC_AddressBook::getListing(); while ($Qaddresses->next()) { echo '<div class="well relative">' . "\n"; echo ' <address class="no-margin-bottom">' . "\n"; echo $Qaddresses->valueProtected('firstname') . ' ' . $Qaddresses->valueProtected('lastname'); if ($Qaddresses->valueInt('address_book_id') == $lC_Customer->getDefaultAddressID()) { echo ' <small class="margin-left"><i>' . $lC_Language->get('primary_address_marker') . '</i></small>'; } echo ' <br />' . "\n"; echo lC_Address::format($Qaddresses->toArray(), '<br />'); echo ' </address>' . "\n"; ?> <div class="btn-group clearfix absolute-top-right-large-padding"> <form action="<?php echo lc_href_link(FILENAME_ACCOUNT, 'address_book=' . $Qaddresses->valueInt('address_book_id') . '&edit', 'SSL'); ?>
?> <script> var selected; $(document).ready(function() { $('#payment-address-form').show(); if (_setMediaType() == 'mobile-portrait') { $('#payment-address-form').text('<?php echo $lC_Language->get('text_add'); ?> '); } $('#addressBookDetails > div').removeClass('large-padding-left').addClass('padding-left'); $('.small-margin-left-neg').removeClass('small-margin-left-neg').removeClass('no-margin-top').addClass('large-margin-top-neg'); var paymentAddressEntries = '<?php echo lC_AddressBook::numberOfEntries(); ?> '; if (paymentAddressEntries < 1) { $('#checkoutBillingAddressDetails').show(); } }); $('#payment-address-form').click(function(){ var isVisible = $('#checkoutBillingAddressDetails').is(':visible'); var mediaType = _setMediaType(); if (!isVisible) { var text = (mediaType == 'mobile-portrait') ? '<?php echo $lC_Language->get('text_hide'); ?> ' : '<?php
public function process($order_id, $status_id = '') { global $lC_Database, $lC_Customer, $lC_Language, $lC_Currencies, $lC_ShoppingCart, $lC_Coupons, $lC_Tax; if (empty($status_id) || is_numeric($status_id) === false) { $status_id = DEFAULT_ORDERS_STATUS_ID; } if (isset($_SESSION['cartSync']['orderCreated']) && $_SESSION['cartSync']['orderCreated'] === TRUE) { if (isset($_SESSION['cartSync']['orderID']) && $_SESSION['cartSync']['orderID'] != NULL) { $order_id = $_SESSION['cartSync']['orderID']; } // update the order info if ($lC_Customer->getDefaultAddressID() == '') { $lC_Customer->setCustomerData($lC_Customer->getID()); } $customer_address = lC_AddressBook::getEntry($lC_Customer->getDefaultAddressID())->toArray(); $Qupdate = $lC_Database->query('update :table_orders set customers_id = :customers_id, customers_name = :customers_name, customers_company = :customers_company, customers_street_address = :customers_street_address, customers_suburb = :customers_suburb, customers_city = :customers_city, customers_postcode = :customers_postcode, customers_state = :customers_state, customers_state_code = :customers_state_code, customers_country = :customers_country, customers_country_iso2 = :customers_country_iso2, customers_country_iso3 = :customers_country_iso3, customers_telephone = :customers_telephone, customers_email_address = :customers_email_address, customers_address_format = :customers_address_format, customers_ip_address = :customers_ip_address, delivery_name = :delivery_name, delivery_company = :delivery_company, delivery_street_address = :delivery_street_address, delivery_suburb = :delivery_suburb, delivery_city = :delivery_city, delivery_postcode = :delivery_postcode, delivery_state = :delivery_state, delivery_state_code = :delivery_state_code, delivery_country = :delivery_country, delivery_country_iso2 = :delivery_country_iso2, delivery_country_iso3 = :delivery_country_iso3, delivery_address_format = :delivery_address_format, billing_company = :billing_company, billing_street_address = :billing_street_address, billing_suburb = :billing_suburb, billing_city = :billing_city, billing_postcode = :billing_postcode, billing_state = :billing_state, billing_state_code = :billing_state_code, billing_country = :billing_country, billing_country_iso2 = :billing_country_iso2, billing_country_iso3 = :billing_country_iso3, billing_address_format = :billing_address_format, currency = :currency, currency_value = :currency_value, orders_status = :orders_status where orders_id = :orders_id'); $Qupdate->bindInt(':customers_id', $lC_Customer->getID()); $Qupdate->bindValue(':customers_name', $lC_Customer->getName()); $Qupdate->bindValue(':customers_company', $customer_address['entry_company']); $Qupdate->bindValue(':customers_street_address', $customer_address['entry_street_address']); $Qupdate->bindValue(':customers_suburb', $customer_address['entry_suburb']); $Qupdate->bindValue(':customers_city', $customer_address['entry_city']); $Qupdate->bindValue(':customers_postcode', $customer_address['entry_postcode']); $Qupdate->bindValue(':customers_state', $customer_address['entry_state']); $Qupdate->bindValue(':customers_state_code', lC_Address::getZoneCode($customer_address['entry_zone_id'])); $Qupdate->bindValue(':customers_country', lC_Address::getCountryName($customer_address['entry_country_id'])); $Qupdate->bindValue(':customers_country_iso2', lC_Address::getCountryIsoCode2($customer_address['entry_country_id'])); $Qupdate->bindValue(':customers_country_iso3', lC_Address::getCountryIsoCode3($customer_address['entry_country_id'])); $Qupdate->bindValue(':customers_telephone', $customer_address['entry_telephone']); $Qupdate->bindValue(':customers_email_address', $lC_Customer->getEmailAddress()); $Qupdate->bindValue(':customers_address_format', lC_Address::getFormat($customer_address['entry_country_id'])); $Qupdate->bindValue(':customers_ip_address', lc_get_ip_address()); $Qupdate->bindValue(':delivery_name', $lC_ShoppingCart->getShippingAddress('lastname') != NULL ? $lC_ShoppingCart->getShippingAddress('firstname') . ' ' . $lC_ShoppingCart->getShippingAddress('lastname') : $lC_Customer->getName()); $Qupdate->bindValue(':delivery_company', $lC_ShoppingCart->getShippingAddress('company')); $Qupdate->bindValue(':delivery_street_address', $lC_ShoppingCart->getShippingAddress('street_address')); $Qupdate->bindValue(':delivery_suburb', $lC_ShoppingCart->getShippingAddress('suburb')); $Qupdate->bindValue(':delivery_city', $lC_ShoppingCart->getShippingAddress('city')); $Qupdate->bindValue(':delivery_postcode', $lC_ShoppingCart->getShippingAddress('postcode')); $Qupdate->bindValue(':delivery_state', $lC_ShoppingCart->getShippingAddress('state')); $Qupdate->bindValue(':delivery_state_code', $lC_ShoppingCart->getShippingAddress('zone_code')); $Qupdate->bindValue(':delivery_country', $lC_ShoppingCart->getShippingAddress('country_title')); $Qupdate->bindValue(':delivery_country_iso2', $lC_ShoppingCart->getShippingAddress('country_iso_code_2')); $Qupdate->bindValue(':delivery_country_iso3', $lC_ShoppingCart->getShippingAddress('country_iso_code_3')); $Qupdate->bindValue(':delivery_address_format', $lC_ShoppingCart->getShippingAddress('format')); $Qupdate->bindValue(':billing_name', $lC_ShoppingCart->getBillingAddress('lastname') != NULL ? $lC_ShoppingCart->getBillingAddress('firstname') . ' ' . $lC_ShoppingCart->getBillingAddress('lastname') : $lC_Customer->getName()); $Qupdate->bindValue(':billing_company', $lC_ShoppingCart->getBillingAddress('company')); $Qupdate->bindValue(':billing_street_address', $lC_ShoppingCart->getBillingAddress('street_address')); $Qupdate->bindValue(':billing_suburb', $lC_ShoppingCart->getBillingAddress('suburb')); $Qupdate->bindValue(':billing_city', $lC_ShoppingCart->getBillingAddress('city')); $Qupdate->bindValue(':billing_postcode', $lC_ShoppingCart->getBillingAddress('postcode')); $Qupdate->bindValue(':billing_state', $lC_ShoppingCart->getBillingAddress('state')); $Qupdate->bindValue(':billing_state_code', $lC_ShoppingCart->getBillingAddress('zone_code')); $Qupdate->bindValue(':billing_country', $lC_ShoppingCart->getBillingAddress('country_title')); $Qupdate->bindValue(':billing_country_iso2', $lC_ShoppingCart->getBillingAddress('country_iso_code_2')); $Qupdate->bindValue(':billing_country_iso3', $lC_ShoppingCart->getBillingAddress('country_iso_code_3')); $Qupdate->bindValue(':billing_address_format', $lC_ShoppingCart->getBillingAddress('format')); $Qupdate->bindValue(':currency', $lC_Currencies->getCode()); $Qupdate->bindValue(':currency_value', $lC_Currencies->value($lC_Currencies->getCode())); $Qpt = $lC_Database->query('delete from :table_orders_total where orders_id = :orders_id'); $Qpt->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL); $Qpt->bindInt(':orders_id', $order_id); $Qpt->execute(); foreach ($lC_ShoppingCart->getOrderTotals() as $module) { $Qtotals = $lC_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', $order_id); $Qtotals->bindValue(':title', $module['title']); $Qtotals->bindValue(':text', strip_tags(str_replace(' ', '', $module['text']))); $Qtotals->bindValue(':value', $module['value']); $Qtotals->bindValue(':class', $module['code']); $Qtotals->bindInt(':sort_order', $module['sort_order']); $Qtotals->execute(); if (defined('MODULE_SERVICES_INSTALLED') && in_array('coupons', explode(';', MODULE_SERVICES_INSTALLED)) && isset($lC_Coupons)) { if ($lC_Coupons->is_enabled) { preg_match('#\\((.*?)\\)#', $module['title'], $match); $lC_Coupons->redeem($match[1], $order_id); } } } $Qpd = $lC_Database->query('delete from :table_orders_products where orders_id = :orders_id'); $Qpd->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); $Qpd->bindInt(':orders_id', $order_id); $Qpd->execute(); foreach ($lC_ShoppingCart->getProducts() as $products) { $Qproducts = $lC_Database->query('insert into :table_orders_products (orders_id, products_id, products_model, products_sku, products_name, products_price, products_tax, products_quantity, products_simple_options_meta_data) values (:orders_id, :products_id, :products_model, :products_sku, :products_name, :products_price, :products_tax, :products_quantity, :products_simple_options_meta_data)'); $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); $Qproducts->bindInt(':orders_id', $order_id); $Qproducts->bindInt(':products_id', lc_get_product_id($products['id'])); $Qproducts->bindValue(':products_model', $products['model']); $Qproducts->bindValue(':products_sku', $products['sku']); $Qproducts->bindValue(':products_name', $products['name']); $Qproducts->bindValue(':products_price', $products['price']); $Qproducts->bindValue(':products_tax', $lC_Tax->getTaxRate($products['tax_class_id'])); $Qproducts->bindInt(':products_quantity', $products['quantity']); $Qproducts->bindValue(':products_simple_options_meta_data', serialize($products['simple_options'])); $Qproducts->execute(); $order_products_id = $lC_Database->nextID(); if ($lC_ShoppingCart->isVariant($products['item_id'])) { foreach ($lC_ShoppingCart->getVariant($products['item_id']) as $variant) { $Qvariant = $lC_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(); } } } } else { $Qupdate = $lC_Database->query('update :table_orders set orders_status = :orders_status where orders_id = :orders_id'); } $Qupdate->bindTable(':table_orders', TABLE_ORDERS); $Qupdate->bindInt(':orders_status', $status_id); $Qupdate->bindInt(':orders_id', $order_id); $Qupdate->execute(); $Qstatus = $lC_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', $order_id); $Qstatus->bindInt(':orders_status_id', $status_id); $Qstatus->bindInt(':customer_notified', SEND_EMAILS == '1' ? '1' : '0'); $Qstatus->bindValue(':comments', isset($_SESSION['comments']) ? $_SESSION['comments'] : $_POST['comments']); $Qstatus->execute(); $lC_ShoppingCart->synchronizeWithDatabase(); $Qproducts = $lC_Database->query('select products_id, products_quantity from :table_orders_products where orders_id = :orders_id'); $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS); $Qproducts->bindInt(':orders_id', $order_id); $Qproducts->execute(); while ($Qproducts->next()) { if (STOCK_LIMITED == '1') { /**** still uses logic from the shopping cart class if (DOWNLOAD_ENABLED == '1') { $Qstock = $lC_Database->query('select products_quantity, pad.products_attributes_filename from :table_products p left join :table_products_attributes pa on (p.products_id = pa.products_id) left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where p.products_id = :products_id'); $Qstock->bindTable(':table_products', TABLE_PRODUCTS); $Qstock->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES); $Qstock->bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD); $Qstock->bindInt(':products_id', $Qproducts->valueInt('products_id')); // Will work with only one option for downloadable products otherwise, we have to build the query dynamically with a loop if ($lC_ShoppingCart->hasAttributes($products['id'])) { $products_attributes = $lC_ShoppingCart->getAttributes($products['id']); $products_attributes = array_shift($products_attributes); $Qstock->appendQuery('and pa.options_id = :options_id and pa.options_values_id = :options_values_id'); $Qstock->bindInt(':options_id', $products_attributes['options_id']); $Qstock->bindInt(':options_values_id', $products_attributes['options_values_id']); } } else { *****/ $Qstock = $lC_Database->query('select products_quantity from :table_products where products_id = :products_id'); $Qstock->bindTable(':table_products', TABLE_PRODUCTS); $Qstock->bindInt(':products_id', $Qproducts->valueInt('products_id')); // } $Qstock->execute(); if ($Qstock->numberOfRows() > 0) { $stock_left = $Qstock->valueInt('products_quantity'); // do not decrement quantities if products_attributes_filename exists // if ((DOWNLOAD_ENABLED == '-1') || ((DOWNLOAD_ENABLED == '1') && (strlen($Qstock->value('products_attributes_filename')) < 1))) { $stock_left = $stock_left - $Qproducts->valueInt('products_quantity'); $Qupdate = $lC_Database->query('update :table_products set products_quantity = :products_quantity where products_id = :products_id'); $Qupdate->bindTable(':table_products', TABLE_PRODUCTS); $Qupdate->bindInt(':products_quantity', $stock_left); $Qupdate->bindInt(':products_id', $Qproducts->valueInt('products_id')); $Qupdate->execute(); // } if (AUTODISABLE_OUT_OF_STOCK_PRODUCT == '1' && $stock_left < 1) { $Qupdate = $lC_Database->query('update :table_products set products_status = 0 where products_id = :products_id'); $Qupdate->bindTable(':table_products', TABLE_PRODUCTS); $Qupdate->bindInt(':products_id', $Qproducts->valueInt('products_id')); $Qupdate->execute(); } } } // Update products_ordered (for bestsellers list) $Qupdate = $lC_Database->query('update :table_products set products_ordered = products_ordered + :products_ordered where products_id = :products_id'); $Qupdate->bindTable(':table_products', TABLE_PRODUCTS); $Qupdate->bindInt(':products_ordered', $Qproducts->valueInt('products_quantity')); $Qupdate->bindInt(':products_id', $Qproducts->valueInt('products_id')); $Qupdate->execute(); } lC_Order::sendEmail($order_id); $_SESSION['savedOrderID'] = $order_id; unset($_SESSION['prepOrderID']); }
} ?> </div> </div> <?php } ?> </form> <div class="btn-set clearfix"> <button class="btn btn-lg btn-success pull-right" onclick="$('#checkout_address').submit();" type="button"><?php echo $lC_Language->get('button_continue'); ?> </button> <?php if (lC_AddressBook::numberOfEntries() < 1) { ?> <button class="btn btn-lg" type="button" id="shipping-address-form"><?php echo $lC_Language->get('text_cancel'); ?> </button> <?php } else { ?> <button class="btn btn-lg btn-primary" type="button" id="shipping-address-form" style="display:none;"><?php echo $lC_Language->get('show_address_form'); ?> </button> <?php } ?>
?> </td> </tr> </table> <?php $radio_buttons++; } ?> </div> <?php } } ?> </div> <?php if (lC_AddressBook::numberOfEntries() < MAX_ADDRESS_BOOK_ENTRIES) { ?> <div class="" id="checkoutBillingAddressDetails" style="display:none;"> <h3 class="no-margin-top"><?php echo $lC_Language->get('new_billing_address_title'); ?> </h3> <p><?php echo $lC_Language->get('new_billing_address'); ?> </p> <div id="addressBookDetails"> <?php if (file_exists(DIR_FS_TEMPLATE . 'modules/address_book_details.php')) { require $lC_Vqmod->modCheck(DIR_FS_TEMPLATE . 'modules/address_book_details.php'); } else {
$lC_MessageStack->add('address_book', $lC_Language->get('error_address_book_full')); } } ?> <!--content/account/address_book_process.php start--> <div class="row"> <div class="col-sm-12 col-lg-12"> <h1 class="no-margin-top"><?php echo $lC_Template->getPageTitle(); ?> </h1> <?php if ($lC_MessageStack->size('address_book') > 0) { echo '<div class="message-stack-container alert alert-danger small-margin-bottom small-margin-left">' . $lC_MessageStack->get('address_book') . '</div>' . "\n"; } if ($lC_Customer->hasDefaultAddress() === false || isset($_GET['new']) && lC_AddressBook::numberOfEntries() < MAX_ADDRESS_BOOK_ENTRIES || isset($Qentry) && $Qentry->numberOfRows() === 1) { ?> <div class="row"> <form role="form" class="form-inline" name="address_book" id="address_book" action="<?php echo lc_href_link(FILENAME_ACCOUNT, 'address_book=' . $_GET['address_book'] . '&' . (isset($_GET['edit']) ? 'edit' : 'new') . '=save', 'SSL'); ?> " method="post" onsubmit="return check_form(address_book);"> <?php if (file_exists(DIR_FS_TEMPLATE . 'modules/address_book_details.php')) { require $lC_Vqmod->modCheck(DIR_FS_TEMPLATE . 'modules/address_book_details.php'); } else { require $lC_Vqmod->modCheck('includes/modules/address_book_details.php'); } ?> </form> </div>