0byt3m1n1 - D7net
0byt3m1n1 - D7net
Path:
/
home
/
s13cf5ef
/
www
/
ropadefutbolbarata
/
[
Home
]
Name File: checkout_payment_address.php
< back
<?php /* $Id: checkout_payment_address.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // needs to be included earlier to set the success message in the messageStack require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT_ADDRESS); $error = false; $process = false; if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'submit')) { // process a new billing address if (tep_not_null($HTTP_POST_VARS['firstname']) && tep_not_null($HTTP_POST_VARS['lastname']) && tep_not_null($HTTP_POST_VARS['street_address'])) { $process = true; if (ACCOUNT_GENDER == 'true') $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']); if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']); //NIF start if (ACCOUNT_NIF == 'true') $nif = tep_db_prepare_input($HTTP_POST_VARS['nif']); //NIF end $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']); $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']); $street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']); if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']); $postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']); $city = tep_db_prepare_input($HTTP_POST_VARS['city']); $country = tep_db_prepare_input($HTTP_POST_VARS['country']); if (ACCOUNT_STATE == 'true') { if (isset($HTTP_POST_VARS['zone_id'])) { $zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']); } else { $zone_id = false; } $state = tep_db_prepare_input($HTTP_POST_VARS['state']); } if (ACCOUNT_GENDER == 'true') { if ( ($gender != 'm') && ($gender != 'f') ) { $error = true; $messageStack->add('checkout_address', ENTRY_GENDER_ERROR); } } //NIF start if ((ACCOUNT_NIF == 'true') && ($country == "195")){ if (($nif == "") && (ACCOUNT_NIF_REQ == 'true')) { $error = true; $messageStack->add('checkout_address', ENTRY_NO_NIF_ERROR); } else if ((strlen($nif) != 9) && ($nif != "")) { $error = true; $messageStack->add('checkout_address', ENTRY_FORMATO_NIF_ERROR); } else if (strlen($nif) == 9) { $result = tep_valida_nif_cif_nie($nif); if ($result <= 0) { $error = true; $messageStack->add('checkout_address', ENTRY_FORMATO_NIF_ERROR); } else { //correcto } } else { //correcto } } //NIF end if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) { $error = true; $messageStack->add('checkout_address', ENTRY_FIRST_NAME_ERROR); } if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) { $error = true; $messageStack->add('checkout_address', ENTRY_LAST_NAME_ERROR); } if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('checkout_address', ENTRY_STREET_ADDRESS_ERROR); } if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) { $error = true; $messageStack->add('checkout_address', ENTRY_POST_CODE_ERROR); } if (strlen($city) < ENTRY_CITY_MIN_LENGTH) { $error = true; $messageStack->add('checkout_address', ENTRY_CITY_ERROR); } if (ACCOUNT_STATE == 'true') { $zone_id = 0; $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'"); $check = tep_db_fetch_array($check_query); $entry_state_has_zones = ($check['total'] > 0); if ($entry_state_has_zones == true) { $zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')"); if (tep_db_num_rows($zone_query) == 1) { $zone = tep_db_fetch_array($zone_query); $zone_id = $zone['zone_id']; } else { $error = true; $messageStack->add('checkout_address', ENTRY_STATE_ERROR_SELECT); } } else { if (strlen($state) < ENTRY_STATE_MIN_LENGTH) { $error = true; $messageStack->add('checkout_address', ENTRY_STATE_ERROR); } } } if ( (is_numeric($country) == false) || ($country < 1) ) { $error = true; $messageStack->add('checkout_address', ENTRY_COUNTRY_ERROR); } if ($error == false) { $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country); if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender; if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company; //NIF start if (ACCOUNT_NIF == 'true') $sql_data_array['entry_nif'] = $nif; //NIF end if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb; if (ACCOUNT_STATE == 'true') { if ($zone_id > 0) { $sql_data_array['entry_zone_id'] = $zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $state; } } if (!tep_session_is_registered('billto')) tep_session_register('billto'); tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $billto = tep_db_insert_id(); if (tep_session_is_registered('payment')) tep_session_unregister('payment'); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } // process the selected billing destination } elseif (isset($HTTP_POST_VARS['address'])) { $reset_payment = false; if (tep_session_is_registered('billto')) { if ($billto != $HTTP_POST_VARS['address']) { if (tep_session_is_registered('payment')) { $reset_payment = true; } } } else { tep_session_register('billto'); } $billto = $HTTP_POST_VARS['address']; $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "' and address_book_id = '" . $billto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] == '1') { if ($reset_payment == true) tep_session_unregister('payment'); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } else { tep_session_unregister('billto'); } // no addresses to select from - customer decided to keep the current assigned address } else { if (!tep_session_is_registered('billto')) tep_session_register('billto'); $billto = $customer_default_address_id; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } } // if no billing destination address was selected, use their own address as default if (!tep_session_is_registered('billto')) { $billto = $customer_default_address_id; } $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); $addresses_count = tep_count_customer_address_book_entries(); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <?php require(DIR_WS_INCLUDES . 'header_tags.php'); require(DIR_WS_INCLUDES . 'header_includes.php'); ?> <script language="javascript"><!-- var selected; function selectRowEffect(object, buttonSelect) { if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_address.address[0]) { document.checkout_address.address[buttonSelect].checked=true; } else { document.checkout_address.address.checked=true; } } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } function check_form_optional(form_name) { var form = form_name; var firstname = form.elements['firstname'].value; var lastname = form.elements['lastname'].value; var street_address = form.elements['street_address'].value; if (firstname == '' && lastname == '' && street_address == '') { return true; } else { return check_form(form_name); } } //--></script> <?php require(DIR_WS_INCLUDES . 'form_check.js.php'); ?> </head> <body> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0" align="center"> <tr> <td class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php include(DIR_WS_BOXES . 'panel_top.php');?><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL'), 'post', 'onSubmit="return check_form_optional(checkout_address);"'); ?> <?php echo tep_draw_top();?> <?php echo tep_draw_title_top();?> <?php echo HEADING_TITLE; ?> <?php echo tep_draw_title_bottom();?> <?php echo tep_draw1_top();?> <?php if ($messageStack->size('checkout_address') > 0) { ?> <table cellpadding="0" cellspacing="0" border="0"> <tr><td><?php echo $messageStack->output('checkout_address'); ?></td></tr> </table> <?php echo tep_pixel_trans();?> <?php } if ($process == false) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main indent_2"><b><?php echo TABLE_HEADING_PAYMENT_ADDRESS; ?></b></td> </tr> </table> <?php echo tep_draw_infoBox_top();?> <table border="0" width="100%" cellspacing="0" cellpadding="2"><tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="50%"><?php echo TEXT_SELECTED_PAYMENT_DESTINATION; ?></td> <td align="right" width="50%"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" align="center"><?php echo '<b>' . TITLE_PAYMENT_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table> <?php echo tep_draw_infoBox_bottom();?> <?php echo tep_pixel_trans();?> <?php if ($addresses_count > 1) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main indent_2"><b><?php echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES; ?></b></td> </tr> </table> <?php echo tep_draw_infoBox_top();?> <table border="0" width="100%" cellspacing="0" cellpadding="2"><tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="50%"><?php echo TEXT_SELECT_OTHER_PAYMENT_DESTINATION; ?></td> <td class="main" width="50%" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php $radio_buttons = 0; //NIF start if (ACCOUNT_NIF_REQ == 'true'){ // Ahora, cuando el nif es requerido, solo vemos las direcciones que incluyen el nif. $addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_nif as nif, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and entry_nif != ''"); }else{ // Fin de Solo direcciones que incluyen el nif. $addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_nif as nif, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "'"); } //NIF end while ($addresses = tep_db_fetch_array($addresses_query)) { $format_id = tep_get_address_format_id($addresses['country_id']); ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ($addresses['address_book_id'] == $billto) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" colspan="2"><b><?php echo $addresses['firstname'] . ' ' . $addresses['lastname']; ?></b></td> <td class="main" align="right"><?php echo tep_draw_radio_field('address', $addresses['address_book_id'], ($addresses['address_book_id'] == $billto)); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td colspan="3"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo tep_address_format($format_id, $addresses, true, ' ', ', '); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <?php $radio_buttons++; } ?> </table> <?php echo tep_draw_infoBox_bottom();?> <?php echo tep_pixel_trans();?> <?php } } if ($addresses_count < MAX_ADDRESS_BOOK_ENTRIES) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main indent_2"><b><?php echo TABLE_HEADING_NEW_PAYMENT_ADDRESS; ?></b></td> </tr> </table> <?php echo tep_draw_infoBox_top();?> <table border="0" width="100%" cellspacing="0" cellpadding="2"><tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" width="100%"><?php echo TEXT_CREATE_NEW_PAYMENT_ADDRESS; ?></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td><?php require(DIR_WS_MODULES . 'checkout_new_address_nif.php'); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table> <?php echo tep_draw_infoBox_bottom();?> <?php } ?> <?php echo tep_pixel_trans();?> <?php echo tep_draw_infoBox_top();?> <table border="0" width="100%" cellspacing="0" cellpadding="2"><tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo '<b>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td> <td class="main bg_input" align="right"><?php echo tep_draw_hidden_field('action', 'submit') . tep_image_submit('button_continue.png', IMAGE_BUTTON_CONTINUE); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table> <?php echo tep_draw_infoBox_bottom();?> <?php if ($process == true) { ?> <?php echo tep_pixel_trans();?> <table cellpadding="0" cellspacing="0" border="0"> <tr><td><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_back1.png', IMAGE_BUTTON_BACK) . '</a>'; ?></td></tr> </table> <?php } ?> <?php echo tep_pixel_trans();?> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> </tr> </table></td> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> </tr> </table></td> <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td> <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td> </tr> </table></td> </tr> <tr> <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td> <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td> <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td> <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td> </tr> </table> <?php echo tep_draw1_bottom();?> <?php echo tep_draw_bottom();?> </form></td> <!-- body_text_eof //--> <td class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> <?php require(DIR_WS_INCLUDES . 'footer_includes.php'); ?> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
©
2018. | Recode by D7net