Adicionando o campo DDD no pagseguro.
Adicione o código abaixo em seu banco de dados através do phpmyadmin:
ALTER TABLE customers ADD customers_ddd int(2) NOT NULL;
No arquivo create_account.php localize:
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
Logo abaixo, adicione:
$ddd = tep_db_prepare_input($HTTP_POST_VARS['ddd']);
Localize:
'customers_lastname' => $lastname,
Logo abaixo adicione:
'customers_ddd' => $ddd,
Localize:
<tr>
<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
<td class="main"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
</tr>
Substitua por:
<tr>
<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
<td class="main"><?php echo tep_draw_input_field('ddd','','size="2"'); ?> - <?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
</tr>
No arquivo account_edit.php, localize:
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
Logo abaixo, adicione:
$ddd = tep_db_prepare_input($HTTP_POST_VARS['ddd']);
Localize:
'customers_lastname' => $lastname,
Logo abaixo adicione:
'customers_ddd' => $ddd,
Localize:
$account_query = tep_db_query("select customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_telephone, customers_fax from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
$account = tep_db_fetch_array($account_query);
Substitua por:
$account_query = tep_db_query("select customers_gender, customers_firstname, customers_lastname, customers_cpf, customers_rg,customers_dob, customers_email_address, customers_ddd, customers_telephone, customers_fax from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
$account = tep_db_fetch_array($account_query);
Localize:
<tr>
<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
<td class="main"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
</tr>
Substitua por:
<tr>
<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
<td class="main"><?php echo tep_draw_input_field('ddd','','size="2"'); ?> - <?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
</tr>
Agora no arquivo admin/customers.php, localize:
$customers_lastname = tep_db_prepare_input($HTTP_POST_VARS['customers_lastname']);
Logo abaixo, adicione:
$ddd = tep_db_prepare_input($HTTP_POST_VARS['ddd']);
Localize:
'customers_lastname' => $customers_lastname,
Abaixo adicione:
'customers_ddd' => $ddd,
Localize:
$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");
Substitua por:
$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_cpf, c.customers_rg, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_ddd, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");
Localize:
<?php
if ($error == true) {
if ($entry_telephone_error == true) {
echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"') . ' ' . ENTRY_TELEPHONE_NUMBER_ERROR;
} else {
echo $cInfo->customers_telephone . tep_draw_hidden_field('customers_telephone');
}
} else {
echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"', true);
}
?>
Substitua por:
<?php
echo tep_draw_input_field('customers_ddd', $cInfo->customers_ddd, 'maxlength="2" size="2"', false) . ' - ';
if ($error == true) {
if ($entry_telephone_error == true) {
echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"') . ' ' . ENTRY_TELEPHONE_NUMBER_ERROR;
} else {
echo $cInfo->customers_telephone . tep_draw_hidden_field('customers_telephone');
}
} else {
echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"', true);
}
?>
Abra o arquivo checkout_process.php e encontre:
'customers_telephone' => $order->customer['telephone'],
Abaixo, adicione:
'ddd' => $order->customer['ddd'],
Abra o arquivo includes/classes/order.php e ache:
$order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
Substitua por:
$order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_ddd, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
Encontre:
'telephone' => $order['customers_telephone'],
Abaixo, adicione:
'customers_ddd' => $order['customers_ddd'],
Encontre:
$customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");
Mude para:
$customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_ddd, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");
Encontre:
'telephone' => $customer_address['customers_telephone'],
Abaixo, adicione:
'ddd' => $customer_address['customers_ddd'],
Abra o arquivo pagseguro.php e ache:
Encontre:
$cust_telephone2 = eregi_replace ("[^0-9]", "", $order->customer['telephone']);
Mude para:
$cust_telephone2 = eregi_replace ("[^0-9]", "", $order->customer['ddd']);
Rode e veja se está tudo funcionando.