Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
海关;“店主目录输入类型”;对于magento产品属性_Magento_Input_Attributes_Magento 1.6_Catalog - Fatal编程技术网

海关;“店主目录输入类型”;对于magento产品属性

海关;“店主目录输入类型”;对于magento产品属性,magento,input,attributes,magento-1.6,catalog,Magento,Input,Attributes,Magento 1.6,Catalog,在magento中,可以创建具有特定类型的新属性(然后添加到产品继承的属性集) 默认选项(textfield/area、data、boolean)相当有限,我想添加我自己的选项,包括后端字段渲染器和它自己的验证。这将创建一个youtube字段,该字段接受仅转换为youtube id的一系列URL 但我真的很想对如何添加您自己的“店主目录输入类型”有一个很好的解释。我见过其他插件也这么做,但挖掘代码是很乏味的,这肯定也是其他人感兴趣的事情(这个问题在网络上被问了很多) 我已经搜索了一段时间,但没有

在magento中,可以创建具有特定类型的新属性(然后添加到产品继承的属性集)

默认选项(textfield/area、data、boolean)相当有限,我想添加我自己的选项,包括后端字段渲染器和它自己的验证。这将创建一个youtube字段,该字段接受仅转换为youtube id的一系列URL

但我真的很想对如何添加您自己的“店主目录输入类型”有一个很好的解释。我见过其他插件也这么做,但挖掘代码是很乏味的,这肯定也是其他人感兴趣的事情(这个问题在网络上被问了很多)

我已经搜索了一段时间,但没有结果,我将继续寻找答案,直到我找到它

tl;dr

所以我的问题是:如何添加“商店所有者的目录输入类型”,可能还有一个参考如何向这个字段类型添加自定义验证。这是正确的MVC风格,因此如果可能,不需要编辑核心文件


对于详细、一般性的解释和代码示例,如果值得的话,我将根据答案的质量给予奖励(因为这将适用于更多的读者)。

对不起,我没有时间写长的答案。Wee模块接下来的4名观察员将为您提供所需的指导:

<config>
    <global>
        <events>
            <catalog_entity_attribute_save_before>
                <observers>
                    <weee>
                        <type>model</type>
                        <class>weee/observer</class>
                        <method>assignBackendModelToAttribute</method>
                    </weee>
                </observers>
            </catalog_entity_attribute_save_before>
        </events>
    </global>
...

    <adminhtml>
        <events>
            <adminhtml_catalog_product_edit_prepare_form>
                <observers>
                    <weee>
                        <class>weee/observer</class>
                        <method>setWeeeRendererInForm</method>
                    </weee>
                </observers>
            </adminhtml_catalog_product_edit_prepare_form>
            <adminhtml_product_attribute_types>
                <observers>
                    <weee>
                        <type>model</type>
                        <class>weee/observer</class>
                        <method>addWeeeTaxAttributeType</method>
                    </weee>
                </observers>
            </adminhtml_product_attribute_types>
            <adminhtml_catalog_product_edit_element_types>
                <observers>
                    <weee>
                        <class>weee/observer</class>
                        <method>updateElementTypes</method>
                    </weee>
                </observers>
            </adminhtml_catalog_product_edit_element_types>
        </events>
    </adminhtml>
</config>

模型
weee/观察员
将后端模型分配给属性
...
weee/观察员
Setweeerendereinform
模型
weee/观察员
AddWeeTaxatTributeType
weee/观察员
updateElementTypes