Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New fields in address_book


waitsee

Recommended Posts

Posted

OK, I have a strange problem. Nobody on the Dutch board has answered yet, so I

 

post my question here, since the world is bigger than the Netherlands.

 

I have added 3 fields to the table address_book; entry_printertype,

 

entry_zwartnummer and entry_kleurnummer.

 

In create_account.php I added after line 33= if (ACCOUNT_COMPANY == 'true')

 

$company = tep_db_prepare_input($HTTP_POST_VARS['company']); this 3 lines:

==================================================================

if (ACCOUNT_PRINTERTYPE == 'true') $printertype =

 

tep_db_prepare_input($HTTP_POST_VARS['printertype']);

if (ACCOUNT_ZWARTNUMMER == 'true') $zwartnummer =

 

tep_db_prepare_input($HTTP_POST_VARS['zwartnummer']);

if (ACCOUNT_KLEURNUMMER == 'true') $kleurnummer =

 

tep_db_prepare_input($HTTP_POST_VARS['kleurnummer']);

==================================================================

 

After

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] =

 

$company;

I added:

 

===================================================================

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_printertype'] =

 

$printertype;

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_zwartnummer'] =

 

$nummerzwart;

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_kleurnummer'] =

 

$nummerkleur;

===================================================================

 

After

<td class="main"><?php echo ENTRY_COMPANY; ?></td>

<td class="main"><?php echo tep_draw_input_field('company') .

 

' ' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">'

 

. ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>

</tr>

I added:

===================================================================

<td class="main"><?php echo ENTRY_PRINTERTYPE; ?></td>

<td class="main"><?php echo tep_draw_input_field('printertype') .

 

' ' . (tep_not_null(ENTRY_PRINTERTYPE_TEXT) ? '<span

 

class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>

<td class="main"><?php echo ENTRY_ZWARTNUMMER; ?></td>

<td class="main"><?php echo tep_draw_input_field('nummerzwart') .

 

' ' . (tep_not_null(ENTRY_ZWARTNUMMER_TEXT) ? '<span

 

class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>

<td class="main"><?php echo ENTRY_KLEURNUMMER; ?></td>

<td class="main"><?php echo tep_draw_input_field('nummerkleur') .

 

' ' . (tep_not_null(ENTRY_KLEURNUMMER_TEXT) ? '<span

 

class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>

</tr>

===================================================================

 

This is fine. When I new customer registers the right values are inserted in the

 

table address_book.

 

In account_edit.php I inserted after line 30:

===================================================================

$printertype = tep_db_prepare_input($HTTP_POST_VARS['printertype']);

$zwartnummer = tep_db_prepare_input($HTTP_POST_VARS['zwartnummer']);

$kleurnummer = tep_db_prepare_input($HTTP_POST_VARS['kleurnummer']);

====================================================================

 

And after:

tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set

 

customers_info_date_account_last_modified = now() where customers_info_id = '" .

 

(int)$customer_id . "'");

===================================================================

$sql_data_array = array('entry_company' => $company,

'entry_printertype' => $printertype,

'entry_zwartnummer' => $zwartnummer,

'entry_kleurnummer' => $kleurnummer);

====================================================================

 

In the

$account_query = tep_db_query("select c.customers_id, c.customers_gender,

 

c.customers_firstname, c.customers_lastname, c.customers_dob,

 

c.customers_email_address, customers_telephone, customers_fax, a.entry_company,

 

a.entry_printertype, a.entry_zwartnummer, a.entry_kleurnummer from " .

 

TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id =

 

a.customers_id where a.customers_id = c.customers_id and c.customers_id = '" .

 

(int)$customer_id . "'");

I inserted

=====================================================================

a.entry_printertype, a.entry_zwartnummer, a.entry_kleurnummer

=====================================================================

 

When a customer opens account_edit.php to view or change my account information,

 

the right data are shown.

 

But when he updates some data, all fields

fax

company name

printertype

zwartnummer

kleurnummer

have been changed to the data that was changed in the "kleurnummer"

 

What is wrong? What have I forgotten. In the meantime I am blind for this code!

 

Who can help?

  • 2 weeks later...
Posted

I believe that this statement is where you are going wrong.

 

$sql_data_array = array('entry_company' => $company,

'entry_printertype' => $printertype,

'entry_zwartnummer' => $zwartnummer,

'entry_kleurnummer' => $kleurnummer);

 

On line 102 of account_edit.php you will find

$sql_data_array = array('entry_firstname' => $firstname,
                             'entry_lastname' => $lastname);

 

Just add what's above, and it should look like this

$sql_data_array = array('entry_firstname' => $firstname,
                             'entry_lastname' => $lastname,
                             'entry_company' => $company,
                             'entry_printertype' => $printertype,
                             'entry_zwartnummer' => $zwartnummer,
                             'entry_kleurnummer' => $kleurnummer);

  • 1 month later...
Posted
I believe that this statement is where you are going wrong.

On line 102 of account_edit.php you will find

$sql_data_array = array('entry_firstname' => $firstname,
                             'entry_lastname' => $lastname);

 

Just add what's above, and it should look like this

$sql_data_array = array('entry_firstname' => $firstname,
                             'entry_lastname' => $lastname,
                             'entry_company' => $company,
                             'entry_printertype' => $printertype,
                             'entry_zwartnummer' => $zwartnummer,
                             'entry_kleurnummer' => $kleurnummer);

Thanks, I will give it a try.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...