Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Custom field will only save from the backend
 
MartinaL
Sr. Member
 
Total Posts:  82
Joined:  2008-03-31
 

I have followed the wiki and all of the forum posts on how to add a custom field at registration and yet no matter what I do it won’t save from the front end.

I can add, edit and see the value through the backend for customers, and if I set the value in the backend I can see the selected value (it is a drop down list) in the front end, but I can’t add or edit through the front end, nothing is going into the database?

I have copied the required fields to app/local;

app/code/local/Mage/Customer/Model/Entity/Setup.php
<fieldsets>
<customer_account>
<prefix><create>1</create><update>1</update><name>1</name></prefix>
<firstname><create>1</create><update>1</update><name>1</name></firstname>
<middlename><create>1</create><update>1</update><name>1</name></middlename>
<lastname><create>1</create><update>1</update><name>1</name></lastname>
<suffix><create>1</create><update>1</update><name>1</name></suffix>
<email><create>1</create><update>1</update></email>
<campus_location><create>1</create><update>1</update></campus_location> ---> My field
<group_id><create>1</create><update>1</update></group_id>
<password><create>1</create></password>
<confirmation><create>1</create></confirmation>
<dob><create>1</create><update>1</update></dob>
<taxvat><create>1</create><update>1</update></taxvat>
</customer_account>
</fieldsets>

app/code/local/Mage/Customer/etc/config.xml

‘campus_location’ => array(
‘label’ => ‘Campus Location’,
‘required’ => false,
‘sort_order’ => 65,
),

app/design/frontend/default/yourstore/template/customer/form/register.html

<li>
<div class="input-box">
<label for="campus_location"><?php echo $this->__('Campus Location') ?></label><br/>
<select id="campus_location" name="campus_location" title="<?php echo $this->__('Campus Location') ?>” class="validate-select">
<option value=""><?php echo $this->__('Please select your campus location') ?></option>
<option value="Campus">Campus</option>
<option value="Downtown">Downtown</option>
<option value="Southside">Southside</option>
<option value="Westside">Westside</option>
<option value="Mall">Mall</option>
<option value="Stadium">Stadium</option>
</select>
</div>
</li>

app/design/frontend/default/yourstore/template/customer/form/edit.html

<li>
<div class="input-box">
<label for="campus_location"><?php echo $this->__('Campus Location') ?></label><br/>
<select id="campus_location" name="campus_location" title="<?php echo $this->__('Campus Location') ?>” class="validate-select">
<option value="” <?php if($this->htmlEscape($this->getCustomer()->getcampus_location()) == '') echo 'selected' ?>><?php echo $this->__('Please select your campus location') ?></option>
<option value="Campus" <?php if($this->htmlEscape($this->getCustomer()->getcampus_location()) == 'Campus') echo 'selected' ?>>Campus</option>
<option value="Downtown" <?php if($this->htmlEscape($this->getCustomer()->getcampus_location()) == 'Downtown') echo 'selected' ?>>Downtown</option>
<option value="Southside" <?php if($this->htmlEscape($this->getCustomer()->getcampus_location()) == 'Southside') echo 'selected' ?>>Southside</option>
<option value="Westside" <?php if($this->htmlEscape($this->getCustomer()->getcampus_location()) == 'Westside') echo 'selected' ?>>Westside</option>
<option value="Mall" <?php if($this->htmlEscape($this->getCustomer()->getcampus_location()) == 'Mall') echo 'selected' ?>>Mall</option>
<option value="Stadium" <?php if($this->htmlEscape($this->getCustomer()->getcampus_location()) == 'Stadium') echo 'selected' ?>>Stadium</option>
</select>
</div>
</li>

 
Magento Community Magento Community
Magento Community
Magento Community
 
MartinaL
Sr. Member
 
Total Posts:  82
Joined:  2008-03-31
 

I am using version 1.3.1

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top