示例#1
0
 /**
  * Edit/View Existing Customer form fields
  *
  * @param Varien_Data_Form $form
  * @param Varien_Data_Form_Element_Fieldset $fieldset
  * @param Mage_Customer_Model_Customer $customer
  */
 protected function _addEditCustomerFormFields($form, $fieldset, $customer)
 {
     $form->getElement('created_in')->setDisabled('disabled');
     if (!Mage::app()->isSingleStoreMode()) {
         $form->getElement('website_id')->setDisabled('disabled');
         $renderer = $this->getLayout()->createBlock('Mage_Adminhtml_Block_Store_Switcher_Form_Renderer_Fieldset_Element');
         $form->getElement('website_id')->setRenderer($renderer);
     } else {
         $fieldset->removeField('website_id');
     }
     if ($customer->isReadonly()) {
         return;
     }
     $this->_addPasswordManagementFieldset($form, 'New Password', true);
     // Prepare customer confirmation control (only for existing customers)
     $confirmationKey = $customer->getConfirmation();
     if ($confirmationKey || $customer->isConfirmationRequired()) {
         $confirmationAttr = $customer->getAttribute('confirmation');
         if (!$confirmationKey) {
             $confirmationKey = $customer->getRandomConfirmationKey();
         }
         $element = $fieldset->addField('confirmation', 'select', array('name' => 'confirmation', 'label' => Mage::helper('Mage_Customer_Helper_Data')->__($confirmationAttr->getFrontendLabel())));
         $element->setEntityAttribute($confirmationAttr);
         $element->setValues(array('' => 'Confirmed', $confirmationKey => 'Not confirmed'));
         // Prepare send welcome email checkbox if customer is not confirmed
         // no need to add it, if website ID is empty
         if ($customer->getConfirmation() && $customer->getWebsiteId()) {
             $fieldset->addField('sendemail', 'checkbox', array('name' => 'sendemail', 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Send Welcome Email after Confirmation')));
             $customer->setData('sendemail', '1');
         }
     }
 }