I want to know how to solve this issue, I have a problem with the saving value of the custom attribute, i referred to this tutorial .I had done the same thing as the tutorial thats why I didn't put my code. So when i create or edit an account he dont save the value of this custom attribute, but when i edit it manually in a backend and i save, i can get it in front !

The field that doesn't set value:

   <label for="w_telephone"><?php echo $this->__('Telephone') ?></label>
      <div class="input-box">
         <input type="text" name="w_telephone" id="w_telephone" value="<?php echo $this->htmlEscape($this->getCustomer()->getWTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text" />

the new one for testing:

   <label for="w_pincode" class="required"><em>*</em><?php echo $this->__('Code pin') ?></label>
      <div class="input-box">
        <input type="text" name="w_pincode" id="w_pincode" value="<?php echo $this->escapeHtml($this->getCustomer()->getWPincode()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Code pin')) ?>" class="input-text required-entry" />

I tried to add a new one for testing, this new one "w_pine" works fine but not that of before "w_telephone".

  • did you add the form field to relevant form – Mujahidh Feb 19 '17 at 4:11
  • once print your post request in proper controller and find that your field is in request with value or not – Gopal Patel Feb 19 '17 at 6:35
  • Update your controller saveAction – Magento 2 Feb 19 '17 at 6:40
  • Logout admin and then try – Supravat M Feb 19 '17 at 8:39
  • Look my edit please, yes i have my form field @Mujahidh i checked all parameters in navigator and he set the value of telephone field @ Gopal Patel Why i should update the savAction() ? @ Kothari the samthing doesnt work @ Supravat – PЯINCƏ Feb 19 '17 at 10:06

I solved my problem, i hade some lines commented in my install script

$installer = $this;

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

$entityTypeId     = $setup->getEntityTypeId('customer');
$attributeSetId   = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

$installer->addAttribute("customer", "w_telephone",  array(
    "type"     => "varchar",
    "backend"  => "",
    "label"    => "Telephone",
    "input"    => "text",
    "source"   => "",
    "visible"  => true,
    "required" => true,
    "default" => "",
    "frontend" => "",
    "unique"     => true


$attribute   = Mage::getSingleton("eav/config")->getAttribute("customer", "w_telephone");

    '999'  //sort_order

//these lines start
//these lines end
$attribute->setData("used_in_forms", $used_in_forms)
    ->setData("is_used_for_customer_segment", true)
    ->setData("is_system", 0)
    ->setData("is_user_defined", 1)
    ->setData("is_visible", 1)
    ->setData("sort_order", 100)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.