  |
52 | 52 | | $billto = $customer_default_address_id; |
| |
53 | 53 | | } else { |
| |
54 | 54 | | // verify the selected billing address |
  |
55 | | - | $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); |
| |
56 | | - | $check_address = tep_db_fetch_array($check_address_query); |
| |
| 55 | + | if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) { |
| |
| 56 | + | $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); |
| |
| 57 | + | $check_address = tep_db_fetch_array($check_address_query); |
|
57 | 58 | | |
  |
58 | | - | if ($check_address['total'] != '1') { |
| |
59 | | - | $billto = $customer_default_address_id; |
| |
60 | | - | if (tep_session_is_registered('payment')) tep_session_unregister('payment'); |
| |
| 59 | + | if ($check_address['total'] != '1') { |
| |
| 60 | + | $billto = $customer_default_address_id; |
| |
| 61 | + | if (tep_session_is_registered('payment')) tep_session_unregister('payment'); |
| |
| 62 | + | } |
  |
61 | 63 | | } |
| |
62 | 64 | | } |
| |
63 | 65 | | |