Magento - 自定义订单字段 - 教程错误?

发布于 2025-01-01 08:16:32 字数 1386 浏览 4 评论 0原文

我正在关注位于以下位置的教程:

http://www.magentocommerce.com/wiki/5_-_modules_and_development/how_to_add_custom_field_in_billing_and_shipping_address_in_frontend_and_backend

没有提及这是针对哪个版本的,但它还不到一年,所以我不知道看看为什么它不能在 1.6.2 上工作(我正在测试它的沙箱 -全新安装,除了更改包/主题之外什么也没做)。

然而,将这些放在一起后,帐单地址块在结帐期间(以及应该可见的其他区域)失败,并且日志状态:

2012-01-31T20:46:01+00:00 ERR (3): Warning: led to open stream: No such file or directory  in /var/www/order-add-field/lib/Varien/Autoload.php on line 93
2012-01-31T20:46:01+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Eav/Model/Attribute/Data/.php' for inclusion (include_path='/var/www/order-add-field/app/code/local:/var/www/order-add-field/app/code/community:/var/www/order-add-field/app/code/core:/var/www/order-add-field/lib:.:/usr/share/php:/usr/share/pear')  in /var/www/order-add-field/lib/Varien/Autoload.php on line 93

所以我相信模型的设置方式有问题。根据本教程,config.xml 包括(在全局标记内):

<models>
    <orderfields>
        <class>Ps_Orderfields_Model</class>             
    </orderfields>      
</models>

本教程没有说明需要设置的任何模型,但看起来好像缺少了一些东西。我需要模型文件吗?我认为 mysql 安装脚本可以处理这个问题...感觉只是一步之遥,但我不确定是什么。

I'm following the tutorial located at:

http://www.magentocommerce.com/wiki/5_-_modules_and_development/how_to_add_custom_field_in_billing_and_shipping_address_in_frontend_and_backend

There's no mention of which version this is for, but it's less than a year old, so I don't see why it shouldn't work on 1.6.2 (the sandbox I'm testing it in - fresh install, nothing done other than change package/theme).

However, after getting this together, the billing address block is failing during checkout (as well as other areas where this should be visible) and the log states:

2012-01-31T20:46:01+00:00 ERR (3): Warning: led to open stream: No such file or directory  in /var/www/order-add-field/lib/Varien/Autoload.php on line 93
2012-01-31T20:46:01+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Eav/Model/Attribute/Data/.php' for inclusion (include_path='/var/www/order-add-field/app/code/local:/var/www/order-add-field/app/code/community:/var/www/order-add-field/app/code/core:/var/www/order-add-field/lib:.:/usr/share/php:/usr/share/pear')  in /var/www/order-add-field/lib/Varien/Autoload.php on line 93

So I'm led to believe there is something wrong with how the model is set up. Per the tutorial, config.xml includes (inside global tag):

<models>
    <orderfields>
        <class>Ps_Orderfields_Model</class>             
    </orderfields>      
</models>

The tutorial doesn't state any models needing to be set up, yet it appears as though something is missing. Do I need the Model file? The mysql install script I assumed would handle this... It feels just a step away, but I'm not sure what.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

把时间冻结 2025-01-08 08:16:32

第二条日志消息中的路径很有趣...

Failed opening 'Mage/Eav/Model/Attribute/Data/.php' for inclusion 

如果您查看 app/code/core/Mage/Eav/Model/Attribute/Data 文件夹,您会看到一系列文件,每个属性输入类型一个。这让我认为您在设置脚本中的“输入”数组键,即以下行...

'input'    => 'text',

...对于您的属性之一无效或丢失。检查您的设置脚本,如果您需要进一步的帮助,可以在此处发布相关部分。

The path in the second log message is interesting...

Failed opening 'Mage/Eav/Model/Attribute/Data/.php' for inclusion 

IF you take a look in the app/code/core/Mage/Eav/Model/Attribute/Data folder you'll see a series of files, one for each attribute input type. This leads me to think that your 'input' array key in the setup script, i.e. the following line...

'input'    => 'text',

... is invalid or missing for one of your attributes. Check your setup script, and maybe post the relevant sections here if you need further assistance.

陌生 2025-01-08 08:16:32

导致此错误的原因是没有为安装指定类。

将类 Mage_Eav_Model_Entity_Setup 添加到 config.xml 中的模块设置配置中。

<setup>
    <module>Ps_Orderfields</module>
    <class>Mage_Eav_Model_Entity_Setup</class>
</setup>

这将修复错误,但不会产生工作属性。使用此模块向 Magento 地址添加属性。该模块已使用最新版本的 Magento 进行了测试。

This error is caused because no class is specified for the setup.

Add the class Mage_Eav_Model_Entity_Setup to the module setup configuration in config.xml.

<setup>
    <module>Ps_Orderfields</module>
    <class>Mage_Eav_Model_Entity_Setup</class>
</setup>

This will fix the error, but it will not result in a working attribute. Use this module to add an attribute to the Magento addresses. The module has been tested with the most recent version of Magento.

傻比既视感 2025-01-08 08:16:32

我遇到了同样的问题(magento 1.7.0.2)。经过一番调查后,我通过将此数组参数添加到安装程序中的每个自定义属性来修复它:

 'backend_type'     => 'varchar',
 'frontend_input'   => 'text',

而不是教程中的“类型”和“输入”。

I was faced with same problem (magento 1.7.0.2). After some investigation i fix it by adding this array params to each custom attribute in the installer:

 'backend_type'     => 'varchar',
 'frontend_input'   => 'text',

instead of 'type' and 'input' in the tutorial.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文