맞춤 가격을 허용하려면 예 / 아니오 만 있지만지도 적용과 같은 "구성 사용"옵션을 추가하고 싶습니다. 어떻게 할 수 있습니까?
이것은 속성입니다.
$setup->addAttribute('catalog_product', 'allow_customprice', array(
'group' => 'Prices',
'input' => 'select',
'label' => 'Allow Custom Price',
'source' => 'eav/entity_attribute_source_boolean',
'backend' => '',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'searchable' => 1,
'filterable' => 0,
'default' => 1,
'comparable' => 1,
'visible_on_front' => 1,
'visible_in_advanced_search' => 0,
'is_html_allowed_on_front' => 0,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
그게 바로 system.xml입니다.
<fields>
<enablecp translate="label">
<label>Enable Custom Price</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<comment>Option for all products.</comment>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</enablecp>
<!-- END FIELD -->
<minprice translate="label">
<label>Min Price</label>
<frontend_type>text</frontend_type>
<validate>validate-number</validate>
<comment>Min price for all products.</comment>
<sort_order>60</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</minprice>
<!-- END FIELD -->
</fields>
사전에 감사합니다
속성 구성에서 소스 모델을 eav/entity_attribute_source_boolean
. 이 클래스에는 옵션 데이터를 채우는 다음 메서드가 포함되어 있습니다.
public function getAllOptions()
{
if (is_null($this->_options)) {
$this->_options = array(
array(
'label' => Mage::helper('eav')->__('Yes'),
'value' => self::VALUE_YES
),
array(
'label' => Mage::helper('eav')->__('No'),
'value' => self::VALUE_NO
),
);
}
return $this->_options;
}
수정하려면 고유 한 소스 클래스를 만들고 Mage_Eav_Model_Entity_Attribute_Source_Abstract
.
편집하다:
Mage_Catalog_Model_Product_Attribute_Source_Boolean
출처로 삼 을 수 있습니다 . 여기에는 다음과 같은 옵션이 있습니다.
따라서 소스는 다음과 같이 설정되어야합니다. catalog/product_attribute_source_boolean
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다