当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Object::setTypes方法代码示例

本文整理汇总了PHP中Varien_Object::setTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::setTypes方法的具体用法?PHP Varien_Object::setTypes怎么用?PHP Varien_Object::setTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Object的用法示例。


在下文中一共展示了Varien_Object::setTypes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toOptionArray

 /**
  * Get product input types as option array
  *
  * @return array
  */
 public function toOptionArray()
 {
     $inputTypes = array(array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image')));
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_product_attribute_types', array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $inputTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     if (Mage::registry('attribute_type_hidden_fields') === null) {
         Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     }
     if (Mage::registry('attribute_type_disabled_types') === null) {
         Mage::register('attribute_type_disabled_types', $_disabledTypes);
     }
     return array_merge(parent::toOptionArray(), $inputTypes);
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:30,代码来源:Inputtype.php

示例2: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('customerattributemanager_data');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $this->setForm($form);
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Attribute Properties')));
     if ($model->getId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $this->_addElementTypes($fieldset);
     $yesno = array(array('value' => 0, 'label' => $this->__('No')), array('value' => 1, 'label' => $this->__('Yes')));
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => $this->__('Attribute Code'), 'title' => $this->__('Attribute Code'), 'note' => $this->__('For internal use. Must be unique with no spaces'), 'class' => 'validate-code', 'required' => true));
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => $this->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => $this->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => $this->__('Global'));
     if ($model->getAttributeCode() == 'status' || $model->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     $inputTypes = array(array('value' => 'text', 'label' => $this->__('Text Field')), array('value' => 'textarea', 'label' => $this->__('Text Area')), array('value' => 'date', 'label' => $this->__('Date')), array('value' => 'boolean', 'label' => $this->__('Yes/No')), array('value' => 'multiselect', 'label' => $this->__('Multiple Select')), array('value' => 'select', 'label' => $this->__('Dropdown')), array('value' => 'file', 'label' => $this->__('File')), array('value' => 'image', 'label' => $this->__('Image')));
     $response = new Varien_Object();
     $response->setTypes(array());
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $inputTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => $this->__('Input Type'), 'title' => $this->__('Input Type'), 'value' => 'text', 'values' => $inputTypes));
     $fieldset->addField('default_value', 'select', array('name' => 'default_value', 'label' => $this->__('As WYSWYG'), 'title' => $this->__('As WYSWYG'), 'value' => 'text', 'values' => $yesno));
     $fieldset->addField('entity_type_id', 'hidden', array('name' => 'entity_type_id', 'value' => Mage::getModel('eav/entity')->setType($this->getRequest()->getParam('type'))->getTypeId()));
     $fieldset->addField('is_user_defined', 'hidden', array('name' => 'is_user_defined', 'value' => 1));
     $fieldset->addField('attribute_set_id', 'hidden', array('name' => 'attribute_set_id', 'value' => Mage::getModel('eav/entity')->setType($this->getRequest()->getParam('type'))->getTypeId()));
     $fieldset->addField('attribute_group_id', 'hidden', array('name' => 'attribute_group_id', 'value' => Mage::getModel('eav/entity')->setType($this->getRequest()->getParam('type'))->getTypeId()));
     $fieldset->addField('note', 'select', array('name' => 'note', 'label' => $this->__('Values Required'), 'title' => $this->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => $this->__('Input Validation'), 'title' => $this->__('Input Validation'), 'values' => array(array('value' => '', 'label' => $this->__('None')), array('value' => 'validate-number', 'label' => $this->__('Decimal Number')), array('value' => 'validate-digits', 'label' => $this->__('Integer Number')), array('value' => 'validate-email', 'label' => $this->__('Email')), array('value' => 'validate-url', 'label' => $this->__('Url')), array('value' => 'validate-alpha', 'label' => $this->__('Letters')), array('value' => 'validate-alphanum', 'label' => $this->__('Letters(a-zA-Z) or Numbers(0-9)')))));
     // -----
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => $this->__('Frontend Properties')));
     $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => $this->__('Order'), 'title' => $this->__('Order in form'), 'note' => $this->__('order of attribute in form edit/create. Leave blank for form bottom.'), 'class' => 'validate-digits', 'value' => $model->getSortOrder()));
     if ($model->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
         if (isset($disableAttributeFields[$model->getAttributeCode()])) {
             foreach ($disableAttributeFields[$model->getAttributeCode()] as $field) {
                 $form->getElement($field)->setDisabled(1);
             }
         }
     }
     //var_dump($model->getData());exit;
     $form->addValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:58,代码来源:Main.php

示例3: _getAdditionalElementTypes

 protected function _getAdditionalElementTypes()
 {
     $result = array('price' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_price'), 'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_image'), 'boolean' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_boolean'));
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_catalog_product_edit_element_types', array('response' => $response));
     foreach ($response->getTypes() as $typeName => $typeClass) {
         $result[$typeName] = $typeClass;
     }
     return $result;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:11,代码来源:Attributes.php

示例4: render

 public function render(Varien_Object $row)
 {
     $row->setTypes(explode(',', $row->getTypes()));
     $out = '';
     foreach (AW_Helpdesk3_Model_Source_Gateway_Mail_RejectPattern::toOptionArray() as $type) {
         if (in_array($type['value'], $row->getTypes())) {
             $out .= $type['label'] . '<br/>';
         }
     }
     return $out;
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:11,代码来源:Types.php

示例5: _getAdditionalElementTypes

 protected function _getAdditionalElementTypes()
 {
     $result = array('price' => Mage::getConfig()->getBlockClassName('customgrid/widget_grid_form_helper_product_price'), 'gallery' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_gallery'), 'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_image'), 'boolean' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_boolean'), 'textarea' => Mage::getConfig()->getBlockClassName('customgrid/widget_grid_form_helper_product_wysiwyg'));
     if ($this->helper('customgrid')->isMageVersionGreaterThan(1, 6)) {
         $result['weight'] = Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_weight');
     }
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_catalog_product_edit_element_types', array('response' => $response));
     foreach ($response->getTypes() as $typeName => $typeClass) {
         $result[$typeName] = $typeClass;
     }
     return $result;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:14,代码来源:Product.php

示例6: _prepareForm

 /**
  * Adding category form elements for editing attribute
  *
  * @return Hackathon_CatalogAttributes_Block_Adminhtml_Catalog_Category_Attribute_Edit_Tab_Main
  */
 protected function _prepareForm()
 {
     parent::_prepareForm();
     $attributeObject = $this->getAttributeObject();
     /* @var $form Varien_Data_Form */
     $form = $this->getForm();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $form->getElement('base_fieldset');
     $frontendInputElm = $form->getElement('frontend_input');
     $additionalTypes = array(array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image')));
     if ($attributeObject->getFrontendInput() == 'gallery') {
         $additionalTypes[] = array('value' => 'gallery', 'label' => Mage::helper('catalog')->__('Gallery'));
     }
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_category_attribute_types', array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $additionalTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
     $frontendInputElm->setValues($frontendInputValues);
     $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'));
     if ($attributeObject->getAttributeCode() == 'status' || $attributeObject->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'), 'values' => $scopes), 'attribute_code');
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('catalog')->__('Frontend Properties')));
     $fieldset->addField('is_wysiwyg_enabled', 'select', array('name' => 'is_wysiwyg_enabled', 'label' => Mage::helper('catalog')->__('Enable WYSIWYG'), 'title' => Mage::helper('catalog')->__('Enable WYSIWYG'), 'values' => $yesnoSource));
     $htmlAllowed = $fieldset->addField('is_html_allowed_on_front', 'select', array('name' => 'is_html_allowed_on_front', 'label' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), 'title' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), 'values' => $yesnoSource));
     if (!$attributeObject->getId() || $attributeObject->getIsWysiwygEnabled()) {
         $attributeObject->setIsHtmlAllowedOnFront(1);
     }
     // define field dependencies
     $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')->addFieldMap("frontend_input", 'frontend_input_type')->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0'));
     Mage::dispatchEvent('adminhtml_catalog_category_attribute_edit_prepare_form', array('form' => $form, 'attribute' => $attributeObject));
     return $this;
 }
开发者ID:marius-grad,项目名称:hackathon_ro_2014,代码行数:54,代码来源:Main.php

示例7: _prepareForm

 /**
  * Adding product form elements for editing attribute
  *
  * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main
  */
 protected function _prepareForm()
 {
     parent::_prepareForm();
     $attributeObject = $this->getAttributeObject();
     /* @var $form Varien_Data_Form */
     $form = $this->getForm();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $form->getElement('base_fieldset');
     $frontendInputElm = $form->getElement('frontend_input');
     $additionalTypes = array();
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_customer_attribute_types', array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $additionalTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
     foreach ($frontendInputValues as $key => $_frontendInput) {
         if ($_frontendInput["value"] == 'multiselect') {
             unset($frontendInputValues[$key]);
         }
     }
     $frontendInputElm->setValues($frontendInputValues);
     $frontendInputElm->setLabel(Mage::helper("profile")->__("Input Type for Store Owner"));
     $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('profile')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('profile')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('profile')->__('Global'));
     if ($attributeObject->getAttributeCode() == 'status' || $attributeObject->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('profile')->__('Scope'), 'title' => Mage::helper('profile')->__('Scope'), 'note' => Mage::helper('profile')->__('Declare attribute value saving scope'), 'values' => $scopes), 'attribute_code');
     $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('profile')->__('Sort Order'), 'title' => Mage::helper('profile')->__('Sort Order'), 'note' => Mage::helper('profile')->__('This is the order according to which this field will display.')));
     // frontend properties fieldset
     // define field dependencies
     $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')->addFieldMap("frontend_input", 'frontend_input_type')->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0'));
     Mage::dispatchEvent('adminhtml_catalog_product_attribute_edit_prepare_form', array('form' => $form, 'attribute' => $attributeObject));
     return $this;
 }
开发者ID:tesorogithub,项目名称:tesoroshop,代码行数:52,代码来源:Main.php

示例8: _prepareForm

 /**
  * Adding product form elements for editing attribute
  *
  * @access protected
  * @return Lionleap_Temples_Block_Adminhtml_Temple_Attribute_Edit_Tab_Main
  * @author Ultimate Module Creator
  */
 protected function _prepareForm()
 {
     parent::_prepareForm();
     $attributeObject = $this->getAttributeObject();
     $form = $this->getForm();
     $fieldset = $form->getElement('base_fieldset');
     $frontendInputElm = $form->getElement('frontend_input');
     $additionalTypes = array(array('value' => 'image', 'label' => Mage::helper('lionleap_temples')->__('Image')), array('value' => 'file', 'label' => Mage::helper('lionleap_temples')->__('File')));
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_temple_attribute_types', array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $additionalTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
     $frontendInputElm->setValues($frontendInputValues);
     $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('lionleap_temples')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('lionleap_temples')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('lionleap_temples')->__('Global'));
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('lionleap_temples')->__('Scope'), 'title' => Mage::helper('lionleap_temples')->__('Scope'), 'note' => Mage::helper('lionleap_temples')->__('Declare attribute value saving scope'), 'values' => $scopes), 'attribute_code');
     $fieldset->addField('position', 'text', array('name' => 'position', 'label' => Mage::helper('lionleap_temples')->__('Position'), 'title' => Mage::helper('lionleap_temples')->__('Position'), 'note' => Mage::helper('lionleap_temples')->__('Position in the admin form')), 'is_global');
     $fieldset->addField('note', 'textarea', array('name' => 'note', 'label' => Mage::helper('lionleap_temples')->__('Note'), 'title' => Mage::helper('lionleap_temples')->__('Note'), 'note' => Mage::helper('lionleap_temples')->__('Text to appear below the input.')), 'position');
     $fieldset->removeField('is_unique');
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('lionleap_temples')->__('Frontend Properties')));
     $fieldset->addField('is_wysiwyg_enabled', 'select', array('name' => 'is_wysiwyg_enabled', 'label' => Mage::helper('lionleap_temples')->__('Enable WYSIWYG'), 'title' => Mage::helper('lionleap_temples')->__('Enable WYSIWYG'), 'values' => $yesnoSource));
     Mage::dispatchEvent('lionleap_temples_adminhtml_temple_attribute_edit_prepare_form', array('form' => $form, 'attribute' => $attributeObject));
     return $this;
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:45,代码来源:Main.php

示例9: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('attributemanager_data');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('Attribute Properties')));
     if ($model->getId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $this->_addElementTypes($fieldset);
     $yesno = array(array('value' => 0, 'label' => Mage::helper('catalog')->__('No')), array('value' => 1, 'label' => Mage::helper('catalog')->__('Yes')));
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => Mage::helper('catalog')->__('Attribute Code'), 'title' => Mage::helper('catalog')->__('Attribute Code'), 'note' => Mage::helper('catalog')->__('For internal use. Must be unique with no spaces'), 'class' => 'validate-code', 'required' => true));
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'));
     if ($model->getAttributeCode() == 'status' || $model->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'), 'values' => $scopes));
     $inputTypes = array(array('value' => 'text', 'label' => Mage::helper('catalog')->__('Text Field')), array('value' => 'textarea', 'label' => Mage::helper('catalog')->__('Text Area')), array('value' => 'date', 'label' => Mage::helper('catalog')->__('Date')), array('value' => 'boolean', 'label' => Mage::helper('catalog')->__('Yes/No')), array('value' => 'multiselect', 'label' => Mage::helper('catalog')->__('Multiple Select')), array('value' => 'select', 'label' => Mage::helper('catalog')->__('Dropdown')));
     $response = new Varien_Object();
     $response->setTypes(array());
     //Mage::dispatchEvent('adminhtml_product_attribute_types', array('response'=>$response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $inputTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'title' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'value' => 'text', 'values' => $inputTypes));
     /****** champs cach�s dans le formulaire **********/
     $fieldset->addField('entity_type_id', 'hidden', array('name' => 'entity_type_id', 'value' => Mage::getModel('eav/entity')->setType($this->getRequest()->getParam('type'))->getTypeId()));
     $fieldset->addField('is_user_defined', 'hidden', array('name' => 'is_user_defined', 'value' => 1));
     $fieldset->addField('attribute_set_id', 'hidden', array('name' => 'attribute_set_id', 'value' => Mage::getModel('eav/entity')->setType($this->getRequest()->getParam('type'))->getTypeId()));
     $fieldset->addField('attribute_group_id', 'hidden', array('name' => 'attribute_group_id', 'value' => Mage::getModel('eav/entity')->setType($this->getRequest()->getParam('type'))->getTypeId()));
     /*******************************************************/
     $fieldset->addField('is_unique', 'select', array('name' => 'is_unique', 'label' => Mage::helper('catalog')->__('Unique Value'), 'title' => Mage::helper('catalog')->__('Unique Value (not shared with other products)'), 'note' => Mage::helper('catalog')->__('Not shared with other products'), 'values' => $yesno));
     $fieldset->addField('is_required', 'select', array('name' => 'is_required', 'label' => Mage::helper('catalog')->__('Values Required'), 'title' => Mage::helper('catalog')->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('is_visible', 'select', array('name' => 'is_visible', 'label' => Mage::helper('catalog')->__('Is Visible'), 'title' => Mage::helper('catalog')->__('Is Visible'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'title' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'values' => array(array('value' => '', 'label' => Mage::helper('catalog')->__('None')), array('value' => 'validate-number', 'label' => Mage::helper('catalog')->__('Decimal Number')), array('value' => 'validate-digits', 'label' => Mage::helper('catalog')->__('Integer Number')), array('value' => 'validate-email', 'label' => Mage::helper('catalog')->__('Email')), array('value' => 'validate-url', 'label' => Mage::helper('catalog')->__('Url')), array('value' => 'validate-alpha', 'label' => Mage::helper('catalog')->__('Letters')), array('value' => 'validate-alphanum', 'label' => Mage::helper('catalog')->__('Letters(a-zA-Z) or Numbers(0-9)')))));
     // -----
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('catalog')->__('Frontend Properties')));
     /* $fieldset->addField('position', 'text', array(
            'name' => 'position',
            'label' => Mage::helper('catalog')->__('Position'),
            'title' => Mage::helper('catalog')->__('Position In Layered Navigation'),
            'note' => Mage::helper('catalog')->__('Position of attribute in layered navigation block'),
            'class' => 'validate-digits',
        ));*/
     if ($model->getId()) {
         $write = Mage::getSingleton('core/resource')->getConnection('core_write');
         $readresult = $write->query("SELECT * from customer_form_attribute WHERE attribute_id=" . $model->getId());
         while ($row = $readresult->fetch()) {
             $customerForm[$row['form_code']] = 'checked';
         }
     }
     /*$fieldset->addField('adminhtml_customer', 'checkbox', array(
                'name' => 'customer_form[]',
                'label' => Mage::helper('catalog')->__('Adminhtml Customer'),
     		'value' => 'adminhtml_customer',
     		'checked' => isset($customerForm['adminhtml_customer'])?$customerForm['adminhtml_customer']:'',
            ));*/
     $fieldset->addField('customer_account_edit', 'checkbox', array('name' => 'customer_form[]', 'label' => Mage::helper('catalog')->__('Customer Account Edit'), 'value' => 'customer_account_edit', 'checked' => isset($customerForm['customer_account_edit']) ? $customerForm['customer_account_edit'] : ''));
     $fieldset->addField('adminhtml_customer_address', 'checkbox', array('name' => 'customer_form[]', 'label' => Mage::helper('catalog')->__('Adminhtml Customer Address'), 'value' => 'adminhtml_customer_address', 'checked' => isset($customerForm['adminhtml_customer_address']) ? $customerForm['adminhtml_customer_address'] : ''));
     $fieldset->addField('checkout_register', 'checkbox', array('name' => 'customer_form[]', 'label' => Mage::helper('catalog')->__('Checkout Register'), 'value' => 'checkout_register', 'checked' => isset($customerForm['checkout_register']) ? $customerForm['checkout_register'] : ''));
     $fieldset->addField('customer_account_create', 'checkbox', array('name' => 'customer_form[]', 'label' => Mage::helper('catalog')->__('Customer Account Create'), 'value' => 'customer_account_create', 'checked' => isset($customerForm['customer_account_create']) ? $customerForm['customer_account_create'] : ''));
     $fieldset->addField('customer_register_address', 'checkbox', array('name' => 'customer_form[]', 'label' => Mage::helper('catalog')->__('Customer Register Address'), 'value' => 'customer_register_address', 'checked' => isset($customerForm['customer_register_address']) ? $customerForm['customer_register_address'] : ''));
     $fieldset->addField('customer_address_edit', 'checkbox', array('name' => 'customer_form[]', 'label' => Mage::helper('catalog')->__('Customer Address Edit'), 'value' => 'customer_address_edit', 'checked' => isset($customerForm['customer_address_edit']) ? $customerForm['customer_address_edit'] : ''));
     $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('catalog')->__('Sort Order'), 'title' => Mage::helper('catalog')->__('Order in form'), 'class' => 'validate-digits', 'value' => $model->getAttributeSetInfo()));
     if ($model->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
         if (isset($disableAttributeFields[$model->getAttributeCode()])) {
             foreach ($disableAttributeFields[$model->getAttributeCode()] as $field) {
                 $form->getElement($field)->setDisabled(1);
             }
         }
     }
     /* if (!$model->getIsUserDefined() && $model->getId()) {
                 $form->getElement('is_unique')->setDisabled(1);
             }
     		*/
     //var_dump($model->getData());exit;
     $form->addValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:monarcmoso,项目名称:beta2,代码行数:92,代码来源:Main.php

示例10: _prepareForm

 /**
  * Preparing form elements for editing Entity Type Attribute
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     parent::_prepareForm();
     /** @var Goodahead_Etm_Model_Entity_Type $entityType */
     $entityType = Mage::registry('etm_entity_type');
     $attributeObject = $this->getAttributeObject();
     /* @var $form Varien_Data_Form */
     $form = $this->getForm();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $form->getElement('base_fieldset');
     $frontendInputElm = $form->getElement('frontend_input');
     $additionalTypes = array(array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'image', 'label' => Mage::helper('catalog')->__('Media Image')));
     if ($attributeObject->getFrontendInput() == 'gallery') {
         $additionalTypes[] = array('value' => 'gallery', 'label' => Mage::helper('catalog')->__('Gallery'));
     }
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('goodahead_etm_entity_attribute_types', array('response' => $response));
     Mage::dispatchEvent(sprintf('goodahead_etm_%s_entity_attribute_types', $entityType->getEntityTypeCode()), array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $additionalTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
     $frontendInputElm->setValues($frontendInputValues);
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'));
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'), 'values' => $scopes), 'attribute_code');
     $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('core')->__('Sort Order'), 'title' => Mage::helper('core')->__('Sort Order')));
     Mage::dispatchEvent('goodahead_etm_entity_attribute_edit_prepare_form', array('form' => $form, 'attribute' => $attributeObject));
     return $this;
 }
开发者ID:eniuz,项目名称:entitytype-manager,代码行数:45,代码来源:Form.php

示例11: _getAdditionalElementTypes

 /**
  * Retrieve additional element types
  *
  * @return array
  */
 protected function _getAdditionalElementTypes()
 {
     $result = array('price' => Mage::getConfig()->getBlockClassName('Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price'), 'weight' => Mage::getConfig()->getBlockClassName('Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Weight'), 'gallery' => Mage::getConfig()->getBlockClassName('Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery'), 'image' => Mage::getConfig()->getBlockClassName('Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Image'), 'boolean' => Mage::getConfig()->getBlockClassName('Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Boolean'), 'textarea' => Mage::getConfig()->getBlockClassName('Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg'));
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_catalog_product_edit_element_types', array('response' => $response));
     foreach ($response->getTypes() as $typeName => $typeClass) {
         $result[$typeName] = $typeClass;
     }
     return $result;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:16,代码来源:Attributes.php

示例12: _initAdditionalElementTypes

 protected function _initAdditionalElementTypes()
 {
     if (is_null($this->_additionalElementTypes)) {
         $result = array('tier_price' => Mage::getConfig()->getBlockClassName('udprod/vendor_product_form_tierPrice'), 'price' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_price'), 'weight' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_weight'), 'gallery' => Mage::getConfig()->getBlockClassName('udprod/vendor_product_gallery'), 'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_image'), 'boolean' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_boolean'), 'textarea' => Mage::getConfig()->getBlockClassName('udprod/vendor_product_wysiwyg'), 'product_categories' => Mage::getConfig()->getBlockClassName('udropship/categoriesField'));
         $events = array('adminhtml_catalog_product_edit_element_types', 'udprod_product_edit_element_types');
         foreach ($events as $event) {
             $response = new Varien_Object();
             $response->setTypes(array());
             Mage::dispatchEvent($event, array('response' => $response));
             foreach ($response->getTypes() as $typeName => $typeClass) {
                 $result[$typeName] = $typeClass;
             }
         }
         $this->_additionalElementTypes = $result;
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:17,代码来源:Product.php

示例13: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('attributemanager_data');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('Attribute Properties')));
     if ($model->getId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $this->_addElementTypes($fieldset);
     $yesno = array(array('value' => 0, 'label' => Mage::helper('catalog')->__('No')), array('value' => 1, 'label' => Mage::helper('catalog')->__('Yes')));
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => Mage::helper('catalog')->__('Attribute Code'), 'title' => Mage::helper('catalog')->__('Attribute Code'), 'note' => Mage::helper('catalog')->__('For internal use. Must be unique with no spaces'), 'class' => 'validate-code', 'required' => true));
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'));
     if ($model->getAttributeCode() == 'status' || $model->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'), 'values' => $scopes));
     $inputTypes = array(array('value' => 'text', 'label' => Mage::helper('catalog')->__('Text Field')), array('value' => 'textarea', 'label' => Mage::helper('catalog')->__('Text Area')), array('value' => 'date', 'label' => Mage::helper('catalog')->__('Date')), array('value' => 'boolean', 'label' => Mage::helper('catalog')->__('Yes/No')), array('value' => 'multiselect', 'label' => Mage::helper('catalog')->__('Multiple Select')), array('value' => 'select', 'label' => Mage::helper('catalog')->__('Dropdown')));
     if ($this->getRequest()->getParam('type') === "catalog_category") {
         $inputTypes[] = array('value' => 'image', 'label' => Mage::helper('catalog')->__('Image'));
     }
     $response = new Varien_Object();
     $response->setTypes(array());
     //Mage::dispatchEvent('adminhtml_product_attribute_types', array('response'=>$response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $inputTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'title' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'value' => 'text', 'values' => $inputTypes));
     /****** champs cachés dans le formulaire **********/
     $fieldset->addField('entity_type_id', 'hidden', array('name' => 'entity_type_id', 'value' => Mage::getModel('eav/entity')->setType($this->getRequest()->getParam('type'))->getTypeId()));
     $fieldset->addField('is_user_defined', 'hidden', array('name' => 'is_user_defined', 'value' => 1));
     //// replaced code //////
     //        $fieldset->addField('attribute_set_id', 'hidden', array(
     //            'name' => 'attribute_set_id',
     //            'value' => Mage::getModel('eav/entity')->setType($this->getRequest ()->getParam ( 'type' ))->getTypeId()
     //        ));
     ///// new code //////////
     $setId = Mage::getModel('eav/entity_type')->loadByCode($this->getRequest()->getParam('type'))->getDefaultAttributeSetId();
     $fieldset->addField('attribute_set_id', 'hidden', array('name' => 'attribute_set_id', 'value' => $setId));
     ///// end ///////////////
     //// replaced code //////
     //        $fieldset->addField('attribute_group_id', 'hidden', array(
     //            'name' => 'attribute_group_id',
     //            'value' => Mage::getModel('eav/entity')->setType($this->getRequest ()->getParam ( 'type' ))->getTypeId()
     //       ));
     ///// new code //////////
     $groupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection')->setAttributeSetFilter($setId)->load();
     $defaultGroupId = 0;
     foreach ($groupCollection as $group) {
         if ($defaultGroupId == 0 or $group->getIsDefault()) {
             $defaultGroupId = $group->getId();
         }
     }
     $fieldset->addField('attribute_group_id', 'hidden', array('name' => 'attribute_group_id', 'value' => $defaultGroupId));
     ///// end ///////////////
     /*******************************************************/
     $fieldset->addField('is_unique', 'select', array('name' => 'is_unique', 'label' => Mage::helper('catalog')->__('Unique Value'), 'title' => Mage::helper('catalog')->__('Unique Value (not shared with other products)'), 'note' => Mage::helper('catalog')->__('Not shared with other products'), 'values' => $yesno));
     $fieldset->addField('is_required', 'select', array('name' => 'is_required', 'label' => Mage::helper('catalog')->__('Values Required'), 'title' => Mage::helper('catalog')->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'title' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'values' => array(array('value' => '', 'label' => Mage::helper('catalog')->__('None')), array('value' => 'validate-number', 'label' => Mage::helper('catalog')->__('Decimal Number')), array('value' => 'validate-digits', 'label' => Mage::helper('catalog')->__('Integer Number')), array('value' => 'validate-email', 'label' => Mage::helper('catalog')->__('Email')), array('value' => 'validate-url', 'label' => Mage::helper('catalog')->__('Url')), array('value' => 'validate-alpha', 'label' => Mage::helper('catalog')->__('Letters')), array('value' => 'validate-alphanum', 'label' => Mage::helper('catalog')->__('Letters(a-zA-Z) or Numbers(0-9)')))));
     // -----
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('catalog')->__('Frontend Properties')));
     $fieldset->addField('position', 'text', array('name' => 'position', 'label' => Mage::helper('catalog')->__('Position'), 'title' => Mage::helper('catalog')->__('Position In Layered Navigation'), 'note' => Mage::helper('catalog')->__('Position of attribute in layered navigation block'), 'class' => 'validate-digits'));
     if ($model->getIsUserDefined() || !$model->getId()) {
         $fieldset->addField('is_visible_on_front', 'select', array('name' => 'is_visible_on_front', 'label' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'), 'title' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'), 'values' => $yesno));
     }
     $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('catalog')->__('Order'), 'title' => Mage::helper('catalog')->__('Order in form'), 'note' => Mage::helper('catalog')->__('order of attribute in form edit/create. Leave blank for form bottom.'), 'class' => 'validate-digits', 'value' => $model->getAttributeSetInfo()));
     if ($model->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
         if (isset($disableAttributeFields[$model->getAttributeCode()])) {
             foreach ($disableAttributeFields[$model->getAttributeCode()] as $field) {
                 $form->getElement($field)->setDisabled(1);
             }
         }
     }
     /* if (!$model->getIsUserDefined() && $model->getId()) {
                 $form->getElement('is_unique')->setDisabled(1);
             }
     		*/
     //var_dump($model->getData());exit;
     $form->addValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:94,代码来源:Main.php

示例14: _prepareForm

 /**
  * Adding product form elements for editing attribute
  *
  * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main
  */
 protected function _prepareForm()
 {
     parent::_prepareForm();
     $attributeObject = $this->getAttributeObject();
     /* @var $form Varien_Data_Form */
     $form = $this->getForm();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $form->getElement('base_fieldset');
     $frontendInputElm = $form->getElement('frontend_input');
     $additionalTypes = array(array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image')));
     if ($attributeObject->getFrontendInput() == 'gallery') {
         $additionalTypes[] = array('value' => 'gallery', 'label' => Mage::helper('catalog')->__('Gallery'));
     }
     $response = new Varien_Object();
     $response->setTypes(array());
     Mage::dispatchEvent('adminhtml_product_attribute_types', array('response' => $response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $additionalTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
     $frontendInputElm->setValues($frontendInputValues);
     $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'));
     if ($attributeObject->getAttributeCode() == 'status' || $attributeObject->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'), 'values' => $scopes), 'attribute_code');
     $fieldset->addField('apply_to', 'apply', array('name' => 'apply_to[]', 'label' => Mage::helper('catalog')->__('Apply To'), 'values' => Mage_Catalog_Model_Product_Type::getOptions(), 'mode_labels' => array('all' => Mage::helper('catalog')->__('All Product Types'), 'custom' => Mage::helper('catalog')->__('Selected Product Types')), 'required' => true), 'frontend_class');
     $fieldset->addField('is_configurable', 'select', array('name' => 'is_configurable', 'label' => Mage::helper('catalog')->__('Use To Create Configurable Product'), 'values' => $yesnoSource), 'apply_to');
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('catalog')->__('Frontend Properties')));
     $fieldset->addField('is_searchable', 'select', array('name' => 'is_searchable', 'label' => Mage::helper('catalog')->__('Use in Quick Search'), 'title' => Mage::helper('catalog')->__('Use in Quick Search'), 'values' => $yesnoSource));
     $fieldset->addField('is_visible_in_advanced_search', 'select', array('name' => 'is_visible_in_advanced_search', 'label' => Mage::helper('catalog')->__('Use in Advanced Search'), 'title' => Mage::helper('catalog')->__('Use in Advanced Search'), 'values' => $yesnoSource));
     $fieldset->addField('is_comparable', 'select', array('name' => 'is_comparable', 'label' => Mage::helper('catalog')->__('Comparable on Front-end'), 'title' => Mage::helper('catalog')->__('Comparable on Front-end'), 'values' => $yesnoSource));
     $fieldset->addField('is_filterable', 'select', array('name' => 'is_filterable', 'label' => Mage::helper('catalog')->__("Use In Layered Navigation"), 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'values' => array(array('value' => '0', 'label' => Mage::helper('catalog')->__('No')), array('value' => '1', 'label' => Mage::helper('catalog')->__('Filterable (with results)')), array('value' => '2', 'label' => Mage::helper('catalog')->__('Filterable (no results)')))));
     $fieldset->addField('is_filterable_in_search', 'select', array('name' => 'is_filterable_in_search', 'label' => Mage::helper('catalog')->__("Use In Search Results Layered Navigation"), 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown, Multiple Select and Price'), 'values' => $yesnoSource));
     $fieldset->addField('is_used_for_promo_rules', 'select', array('name' => 'is_used_for_promo_rules', 'label' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'), 'title' => Mage::helper('catalog')->__('Use for Promo Rule Conditions'), 'values' => $yesnoSource));
     $fieldset->addField('position', 'text', array('name' => 'position', 'label' => Mage::helper('catalog')->__('Position'), 'title' => Mage::helper('catalog')->__('Position in Layered Navigation'), 'note' => Mage::helper('catalog')->__('Position of attribute in layered navigation block'), 'class' => 'validate-digits'));
     $fieldset->addField('is_wysiwyg_enabled', 'select', array('name' => 'is_wysiwyg_enabled', 'label' => Mage::helper('catalog')->__('Enable WYSIWYG'), 'title' => Mage::helper('catalog')->__('Enable WYSIWYG'), 'values' => $yesnoSource));
     $htmlAllowed = $fieldset->addField('is_html_allowed_on_front', 'select', array('name' => 'is_html_allowed_on_front', 'label' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), 'title' => Mage::helper('catalog')->__('Allow HTML Tags on Frontend'), 'values' => $yesnoSource));
     if (!$attributeObject->getId() || $attributeObject->getIsWysiwygEnabled()) {
         $attributeObject->setIsHtmlAllowedOnFront(1);
     }
     $fieldset->addField('is_visible_on_front', 'select', array('name' => 'is_visible_on_front', 'label' => Mage::helper('catalog')->__('Visible on Product View Page on Front-end'), 'title' => Mage::helper('catalog')->__('Visible on Product View Page on Front-end'), 'values' => $yesnoSource));
     $fieldset->addField('used_in_product_listing', 'select', array('name' => 'used_in_product_listing', 'label' => Mage::helper('catalog')->__('Used in Product Listing'), 'title' => Mage::helper('catalog')->__('Used in Product Listing'), 'note' => Mage::helper('catalog')->__('Depends on design theme'), 'values' => $yesnoSource));
     $fieldset->addField('used_for_sort_by', 'select', array('name' => 'used_for_sort_by', 'label' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'), 'title' => Mage::helper('catalog')->__('Used for Sorting in Product Listing'), 'note' => Mage::helper('catalog')->__('Depends on design theme'), 'values' => $yesnoSource));
     $form->getElement('apply_to')->setSize(5);
     if ($applyTo = $attributeObject->getApplyTo()) {
         $applyTo = is_array($applyTo) ? $applyTo : explode(',', $applyTo);
         $form->getElement('apply_to')->setValue($applyTo);
     } else {
         $form->getElement('apply_to')->addClass('no-display ignore-validate');
     }
     // define field dependencies
     $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')->addFieldMap("frontend_input", 'frontend_input_type')->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0'));
     Mage::dispatchEvent('adminhtml_catalog_product_attribute_edit_prepare_form', array('form' => $form, 'attribute' => $attributeObject));
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:73,代码来源:Main.php

示例15: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('entity_attribute');
     if (!Mage::app()->isSingleStoreMode()) {
         $model->setData('stores', explode(',', $model->getData('store_ids')));
     }
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $disableAttributeFields = array();
     $rewriteAttributeValue = array('status' => array('is_configurable' => 0));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('Attribute Properties')));
     if ($model->getAttributeId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $this->_addElementTypes($fieldset);
     $yesno = array(array('value' => 0, 'label' => Mage::helper('catalog')->__('No')), array('value' => 1, 'label' => Mage::helper('catalog')->__('Yes')));
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => Mage::helper('catalog')->__('Attribute Code'), 'title' => Mage::helper('catalog')->__('Attribute Code'), 'note' => Mage::helper('catalog')->__('For internal use. Must be unique with no spaces'), 'class' => 'validate-code', 'required' => true));
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('stores', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $fieldset->addField('stores', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $scopes = array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'));
     if ($model->getAttributeCode() == 'status' || $model->getAttributeCode() == 'tax_class_id') {
         unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
     }
     /*$fieldset->addField('is_global', 'select', array(
                 'name'  => 'is_global',
                 'label' => Mage::helper('catalog')->__('Scope'),
                 'title' => Mage::helper('catalog')->__('Scope'),
                 'note'  => Mage::helper('catalog')->__('Declare attribute value saving scope'),
     //            'class' => 'no-display',
                 'values'=> $scopes
             ));*/
     $inputTypes = array(array('value' => 'text', 'label' => Mage::helper('catalog')->__('Text Field')), array('value' => 'textarea', 'label' => Mage::helper('catalog')->__('Text Area')), array('value' => 'date', 'label' => Mage::helper('catalog')->__('Date')), array('value' => 'datetime', 'label' => Mage::helper('catalog')->__('Date With Time')), array('value' => 'select', 'label' => Mage::helper('catalog')->__('Dropdown')));
     $response = new Varien_Object();
     $response->setTypes(array());
     //      do not need additional types  Mage::dispatchEvent('adminhtml_product_attribute_types', array('response'=>$response));
     $_disabledTypes = array();
     $_hiddenFields = array();
     foreach ($response->getTypes() as $type) {
         $inputTypes[] = $type;
         if (isset($type['hide_fields'])) {
             $_hiddenFields[$type['value']] = $type['hide_fields'];
         }
         if (isset($type['disabled_types'])) {
             $_disabledTypes[$type['value']] = $type['disabled_types'];
         }
     }
     //Mage::register('attribute_type_hidden_fields', $_hiddenFields);
     //Mage::register('attribute_type_disabled_types', $_disabledTypes);
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'title' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'value' => 'text', 'values' => $inputTypes));
     $fieldset->addField('default_value_text', 'text', array('name' => 'default_value_text', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('default_value_yesno', 'select', array('name' => 'default_value_yesno', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'values' => $yesno, 'value' => $model->getDefaultValue()));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('default_value_date', 'date', array('name' => 'default_value_date', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'value' => $model->getDefaultValue(), 'format' => $dateFormatIso));
     $fieldset->addField('default_value_textarea', 'textarea', array('name' => 'default_value_textarea', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('is_visible_on_front', 'select', array('name' => 'is_visible_on_front', 'label' => Mage::helper('catalog')->__('Visible on Front-end'), 'title' => Mage::helper('catalog')->__('Visible on Front-end'), 'values' => $yesno));
     /*$fieldset->addField('is_unique', 'select', array(
           'name' => 'is_unique',
           'label' => Mage::helper('catalog')->__('Unique Value'),
           'title' => Mage::helper('catalog')->__('Unique Value (not shared with other products)'),
           'note'  => Mage::helper('catalog')->__('Not shared with other products'),
           'values' => $yesno,
       ));*/
     $fieldset->addField('is_required', 'select', array('name' => 'is_required', 'label' => Mage::helper('catalog')->__('Values Required'), 'title' => Mage::helper('catalog')->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => Mage::helper('catalog')->__('Input Validation'), 'title' => Mage::helper('catalog')->__('Input Validation'), 'values' => array(array('value' => '', 'label' => Mage::helper('catalog')->__('None')), array('value' => 'validate-number', 'label' => Mage::helper('catalog')->__('Decimal Number')), array('value' => 'validate-digits', 'label' => Mage::helper('catalog')->__('Integer Number')), array('value' => 'validate-email', 'label' => Mage::helper('catalog')->__('Email')), array('value' => 'validate-url', 'label' => Mage::helper('catalog')->__('Url')), array('value' => 'validate-alpha', 'label' => Mage::helper('catalog')->__('Letters')), array('value' => 'validate-alphanum', 'label' => Mage::helper('catalog')->__('Letters(a-zA-Z) or Numbers(0-9)')))));
     /*
             $fieldset->addField('use_in_super_product', 'select', array(
                 'name' => 'use_in_super_product',
                 'label' => Mage::helper('catalog')->__('Apply To Configurable/Grouped Product'),
                 'values' => $yesno,
             )); */
     /*$fieldset->addField('apply_to', 'apply', array(
           'name'        => 'apply_to[]',
           'label'       => Mage::helper('catalog')->__('Apply To'),
           'values'      => Mage_Catalog_Model_Product_Type::getOptions(),
           'mode_labels' => array(
               'all'     => Mage::helper('catalog')->__('All Product Types'),
               'custom'  => Mage::helper('catalog')->__('Selected Product Types')
           ),
           'required'    => true
       ));*/
     /*$fieldset->addField('is_configurable', 'select', array(
           'name' => 'is_configurable',
           'label' => Mage::helper('catalog')->__('Use To Create Configurable Product'),
           'values' => $yesno,
       ));*/
     // -----
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('amorderattr')->__('Attribute Configuration')));
     $fieldset->addField('checkout_step', 'select', array('name' => 'checkout_step', 'label' => Mage::helper('amorderattr')->__('Show On Checkout Step'), 'title' => Mage::helper('amorderattr')->__('Show On Checkout Step'), 'values' => array(array('value' => '2', 'label' => Mage::helper('amorderattr')->__('2. Billing Information')), array('value' => '3', 'label' => Mage::helper('amorderattr')->__('3. Shipping Information')), array('value' => '4', 'label' => Mage::helper('amorderattr')->__('4. Shipping Method')), array('value' => '5', 'label' => Mage::helper('amorderattr')->__('5. Payment Information')))));
     $fieldset->addField('sorting_order', 'text', array('name' => 'sorting_order', 'label' => Mage::helper('catalog')->__('Display Sorting Order'), 'title' => Mage::helper('catalog')->__('Display Sorting Order'), 'note' => Mage::helper('catalog')->__('Numeric, used in front-end to sort attributes')));
     $fieldset->addField('save_selected', 'select', array('name' => 'save_selected', 'label' => Mage::helper('amorderattr')->__('Save Entered Value For Future Checkout'), 'title' => Mage::helper('amorderattr')->__('Save Entered Value For Future Checkout'), 'note' => Mage::helper('catalog')->__('If set to "Yes", previously entered value will be used during checkout. Works for registered customers only.'), 'values' => $yesno));
     $fieldset->addField('show_on_grid', 'select', array('name' => 'show_on_grid', 'label' => Mage::helper('amorderattr')->__('Show on Orders Grid'), 'title' => Mage::helper('amorderattr')->__('Show on Orders Grid'), 'values' => $yesno));
     $fieldset->addField('include_pdf', 'select', array('name' => 'include_pdf', 'label' => Mage::helper('amorderattr')->__('Include Into PDF Documents'), 'title' => Mage::helper('amorderattr')->__('Include Into PDF Documents'), 'values' => $yesno));
     $fieldset->addField('apply_default', 'select', array('name' => 'apply_default', 'label' => $this->__('Automatically Apply Default Value'), 'title' => $this->__('Automatically Apply Default Value'), 'note' => $this->__('If set to "Yes", the default value will be automatically applied for each order if attribute value is not entered or not visible at the frontend.'), 'values' => $yesno));
     if ($model->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
//.........这里部分代码省略.........
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:101,代码来源:Main.php


注:本文中的Varien_Object::setTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。