function loadCardsInformation() { global $toC_Json; $data = array('STORE_NAME' => STORE_NAME, 'STORE_OWNER' => STORE_OWNER, 'STORE_COUNTRY' => STORE_COUNTRY, 'STORE_COUNTRY_NAME' => osC_Address::getCountryName(STORE_COUNTRY), 'STORE_ZONE' => STORE_ZONE, 'STORE_ZONE_NAME' => osC_Address::getZoneName(STORE_ZONE), 'TAX_DECIMAL_PLACES' => TAX_DECIMAL_PLACES, 'INVOICE_START_NUMBER' => INVOICE_START_NUMBER, 'STORE_NAME_ADDRESS' => STORE_NAME_ADDRESS, 'STORE_OWNER_EMAIL_ADDRESS' => STORE_OWNER_EMAIL_ADDRESS, 'EMAIL_FROM' => EMAIL_FROM, 'SEND_EXTRA_ORDER_EMAILS_TO' => SEND_EXTRA_ORDER_EMAILS_TO, 'EMAIL_TRANSPORT' => EMAIL_TRANSPORT, 'SMTP_HOST' => SMTP_HOST, 'SMTP_PORT' => SMTP_PORT, 'SMTP_USERNAME' => SMTP_USERNAME, 'SMTP_PASSWORD' => SMTP_PASSWORD, 'SEND_EMAILS' => SEND_EMAILS, 'SHIPPING_ORIGIN_COUNTRY' => SHIPPING_ORIGIN_COUNTRY, 'SHIPPING_ORIGIN_ZIP' => SHIPPING_ORIGIN_ZIP, 'SHIPPING_MAX_WEIGHT' => SHIPPING_MAX_WEIGHT, 'SHIPPING_BOX_WEIGHT' => SHIPPING_BOX_WEIGHT, 'SHIPPING_BOX_PADDING' => SHIPPING_BOX_PADDING, 'SHIPPING_WEIGHT_UNIT' => SHIPPING_WEIGHT_UNIT); $response = array('success' => true, 'data' => $data); echo $toC_Json->encode($response); }
function format($address, $new_line = "\n") { global $osC_Database; $address_format = ''; if (is_numeric($address)) { $Qaddress = $osC_Database->query('select ab.entry_firstname as firstname, ab.entry_lastname as lastname, ab.entry_company as company, ab.entry_street_address as street_address, ab.entry_suburb as suburb, ab.entry_city as city, ab.entry_postcode as postcode, ab.entry_state as state, ab.entry_zone_id as zone_id, ab.entry_country_id as country_id, ab.entry_telephone as telephone_number, z.zone_code as zone_code, c.countries_name as country_title from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id), :table_countries c where ab.address_book_id = :address_book_id and ab.entry_country_id = c.countries_id'); $Qaddress->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qaddress->bindTable(':table_zones', TABLE_ZONES); $Qaddress->bindTable(':table_countries', TABLE_COUNTRIES); $Qaddress->bindInt(':address_book_id', $address); $Qaddress->execute(); $address = $Qaddress->toArray(); } $firstname = $lastname = ''; if (isset($address['firstname']) && !empty($address['firstname'])) { $firstname = $address['firstname']; $lastname = $address['lastname']; } elseif (isset($address['name']) && !empty($address['name'])) { $firstname = $address['name']; } $state = $address['state']; $state_code = $address['zone_code']; if (isset($address['zone_id']) && is_numeric($address['zone_id']) && $address['zone_id'] > 0) { $state = osC_Address::getZoneName($address['zone_id']); $state_code = osC_Address::getZoneCode($address['zone_id']); } $country = $address['country_title']; if (empty($country) && isset($address['country_id']) && is_numeric($address['country_id']) && $address['country_id'] > 0) { $country = osC_Address::getCountryName($address['country_id']); } if (isset($address['format'])) { $address_format = $address['format']; } elseif (isset($address['country_id']) && is_numeric($address['country_id']) && $address['country_id'] > 0) { $address_format = osC_Address::getFormat($address['country_id']); } if (empty($address_format)) { $address_format = ":name\n:street_address\n:postcode :city\n:country"; } if (defined('DISPLAY_TELEPHONE_NUMBER') && (int) DISPLAY_TELEPHONE_NUMBER == 1) { if (strpos($address_format, 'telephone_number') == false) { $address_format .= "\n:telephone_number"; } } $find_array = array('/\\:name\\b/', '/\\:street_address\\b/', '/\\:suburb\\b/', '/\\:city\\b/', '/\\:postcode\\b/', '/\\:state\\b/', '/\\:state_code\\b/', '/\\:country\\b/', '/\\:telephone_number\\b/'); $replace_array = array(osc_output_string_protected($firstname . ' ' . $lastname), osc_output_string_protected($address['street_address']), osc_output_string_protected($address['suburb']), osc_output_string_protected($address['city']), osc_output_string_protected($address['postcode']), osc_output_string_protected($state), osc_output_string_protected($state_code), osc_output_string_protected($country), osc_output_string_protected($address['telephone_number'])); $formated = preg_replace($find_array, $replace_array, $address_format); if (ACCOUNT_COMPANY > -1 && !empty($address['company'])) { $company = osc_output_string_protected($address['company']); $formated = $company . $new_line . $formated; } if ($new_line != "\n") { $formated = str_replace("\n", $new_line, $formated); } return $formated; }
$Qzones->bindTable(':table_zones', TABLE_ZONES); $Qzones->bindInt(':zone_country_id', $_POST['country']); $Qzones->execute(); $zones_array = array(); while ($Qzones->next()) { $zones_array[] = array('id' => $Qzones->value('zone_name'), 'text' => $Qzones->value('zone_name')); } echo osc_draw_pull_down_menu('state', $zones_array); } else { echo osc_draw_input_field('state'); } } else { if (isset($Qentry)) { $zone = $Qentry->value('entry_state'); if ($Qentry->valueInt('entry_zone_id') > 0) { $zone = osC_Address::getZoneName($Qentry->valueInt('entry_zone_id')); } } echo osc_draw_input_field('state', isset($Qentry) ? $zone : null); } ?> </div> </div> <?php } ?> <?php if (ACCOUNT_TELEPHONE > -1) { ?>
</td> <td width="70%"> <?php if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm' && isset($entry_state_has_zones) && $entry_state_has_zones === true) { $Qzones = $osC_Database->query('select zone_name from :table_zones where zone_country_id = :zone_country_id order by zone_name'); $Qzones->bindTable(':table_zones', TABLE_ZONES); $Qzones->bindInt(':zone_country_id', $_POST['ab_country']); $Qzones->execute(); $zones_array = array(); while ($Qzones->next()) { $zones_array[] = array('id' => $Qzones->value('zone_name'), 'text' => $Qzones->value('zone_name')); } echo osc_draw_pull_down_menu('ab_state', $zones_array); } else { echo osc_draw_input_field('ab_state', !osc_empty($osC_ObjectInfo->get('zone_id')) ? osC_Address::getZoneName($osC_ObjectInfo->get('zone_id')) : $osC_ObjectInfo->get('state')); } ?> </td> </tr> <?php } ?> <tr> <td width="30%"><?php echo $osC_Language->get('field_country'); ?> </td>