Post by spidermycron » Wed Dec 31, 2014 5:34 pm

Hello,
how possible to remove some fields from registration form please ?

Thanks

New member

Posts

Joined
Sun Aug 11, 2013 9:53 pm

Post by IP_CAM » Thu Jan 01, 2015 8:17 am

Update: I just found out, I replied on knowledge on the version v.1.5.6.x, therefore, do not just copy and paste anything. Sorry, I overlooked it. Basically, it will still answer your question, I assume...
---

You cannot simply REMOVE anything, since all 'required' data needs to contain at least a FIXED Value in order to be accepted as a valid entry. But you can HIDE certain Form-Fields from beeing visible, and you can and MUST PLACE a DB-Matching FIXED Value for the specific Field. This is done by use of >> style="display: none;"<< CSS-Command as well as >> <input type="hidden" name=" " value=" "> << Data Values to be stored.

Example:
IN:

Code: Select all

\shop\catalog\view\theme\default\template\account\register.tpl
Default Code Country and State Selection:

Code: Select all

<tr>
          <td><span class="required">*</span> <?php echo $entry_country; ?></td>
          <td><select name="country_id">
              <option value=""><?php echo $text_select; ?></option>
              <?php foreach ($countries as $country) { ?>
              <?php if ($country['country_id'] == $country_id) { ?>
              <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
              <?php } ?>
              <?php } ?>
            </select>
            <?php if ($error_country) { ?>
            <span class="error"><?php echo $error_country; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><span class="required">*</span> <?php echo $entry_zone; ?></td>
          <td><select name="zone_id">
            </select>
            <?php if ($error_zone) { ?>
            <span class="error"><?php echo $error_zone; ?></span>
            <?php } ?></td>
        </tr>

Same Sections, containing a FIXED and HIDDEN Value:

Code: Select all

<tr>
 <td style="display: none;">Country</span></td>
 <td style="display: none;"><input type="hidden" name="country_id" value="204">Switzerland</td>
 </tr> 
 <tr>
 <td style="display: none;">State</td>
 <td style="display: none;"><input type="hidden" name="zone_id" value="3095">All</td>  
</tr>
The Fixed Value represents the 'valid' Content for, i.E. Switzerland and Kanton Aargau. for the Database.
Requires much less Code, as well!!

Just to give you an Idea...

Good Luck
Ernie
ipc.li

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 14 guests