Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to to remove some * required fields


Or!

Recommended Posts

How to to remove some * required fields from the account creation form? I tryied to edit includes/form_..._js.php(here I removed the select_check for country) and create_account.php(and here I removed the form field for it) but I still get error, asking to select country.

Do I miss something?

thank you in advance.

Link to comment
Share on other sites

Assuming that you do not want the customer to select a country and you want it to default to the store's country, just change the field from a selection box to a hidden field with a value of STORES_COUNTRY.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Assuming that you do not want the customer to select a country and you want it to default to the store's country, just change the field from a selection box to a hidden field with a value of STORES_COUNTRY.

 

I did following change in the create_account.php:

 

$country = $STORES_CONTRY; // tep_db_prepare_input($HTTP_POST_VARS['country']);

 

but it was not enought I'm still asked to select the country.

What should I do to remove also other fields, like City etc.. Which files should I change? create_account.php doesn't seem to be enough...

Link to comment
Share on other sites

I did following change in the create_account.php:

 

    $country = $STORES_CONTRY; // tep_db_prepare_input($HTTP_POST_VARS['country']);

 

but it was not enought I'm still asked to select the country.

What should I do to remove also other fields, like City etc.. Which files should I change? create_account.php doesn't seem to be enough...

 

you have to change 3 spots:

 

1) where the form is displayed in create account, either remove item or remove that it's required

 

2) in the javascript, remove the item check

 

3) in the top part of the create account file, there is another check, you need to remove that too!

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

you have to change 3 spots:

 

1) where the form is displayed in create account, either remove item or remove that it's required

 

2) in the javascript, remove the item check

 

3) in the top part of the create account file, there is another check, you need to remove that too!

 

thank you,

 

but could you give an example, which lines should I delete to remove the country-Select from the form?

 

2)javascript in which file?

 

thank you in advance!

Link to comment
Share on other sites

thank you,

 

but could you give an example, which lines should I delete to remove the country-Select from the form?

 

2)javascript in which file?

 

thank you in advance!

 

will you be having the states, but not the country?

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

will you be having the states, but not the country?

 

no, no - I want to remove all of it, but country would be an example, actually what I want to have on the end is:

 

Name

Street

Telefonenumber

 

(I am using pwa-like contribution, but still I would like to have a bit more simple)

 

please, show me on example with one of those fields, how should I delete all of them...

 

thank you.

Link to comment
Share on other sites

no, no - I want to remove all of it, but country would be an example, actually what I want to have on the end is:

 

Name

Street

Telefonenumber

 

(I am using pwa-like contribution, but still I would like to have a bit more simple)

 

please, show me on example with one of those fields, how should I delete all of them...

 

thank you.

 

 

this should help you with it:

 

http://www.oscommerce.com/community/contri...all/search,vger

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

 

thank you for the hint, but it's not exactly what I want - I dont want to make those fields removable, I want to remove them. I have some of the files mentioned in the contrib. altered so it becomes a bit more difficult. Could you please go through one example of deleting a field?

 

thanks

Link to comment
Share on other sites

example, city:

 

create_account.php, line 407 if vanilla, get rid of this

              <tr>
               <td class="main"><?php echo ENTRY_CITY; ?></td>
               <td class="main"><?php echo tep_draw_input_field('city') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
             </tr>

 

line 37

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

 

line 117

    if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
     $error = true;

     $messageStack->add('create_account', ENTRY_CITY_ERROR);
   }

 

line 191

                              'entry_city' => $city,

 

 

form_check.js.php

line 115

  check_input("city", <?php echo ENTRY_CITY_MIN_LENGTH; ?>, "<?php echo ENTRY_CITY_ERROR; ?>");

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

  • 2 years later...

Thank you Monica,

 

It's works!

 

But only in normal create account.

On PWA, i have some errors:

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /var/www/virtual/adifar.ro/htdocs/includes/classes/order.php on line 161

 

I guess it is in different pages that fields required..

 

 

 

example, city:

 

create_account.php, line 407 if vanilla, get rid of this

			  <tr>
			<td class="main"><?php echo ENTRY_CITY; ?></td>
			<td class="main"><?php echo tep_draw_input_field('city') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
		  </tr>

 

line 37

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

 

line 117

	if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_CITY_ERROR);
}

 

line 191

							  'entry_city' => $city,

form_check.js.php

line 115

  check_input("city", <?php echo ENTRY_CITY_MIN_LENGTH; ?>, "<?php echo ENTRY_CITY_ERROR; ?>");

Link to comment
Share on other sites

Hello!

 

I am finding this code pretty useful but I need some extra help. I'm interested in keeping the city and state fields on create_account.php but I don't want them to be a required field. How do I go about doing it and also removing the asterisk next to the fields. Thanks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...