Magento - 自定义订单字段 - 教程错误?
我正在关注位于以下位置的教程:
没有提及这是针对哪个版本的,但它还不到一年,所以我不知道看看为什么它不能在 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:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
第二条日志消息中的路径很有趣...
如果您查看
app/code/core/Mage/Eav/Model/Attribute/Data
文件夹,您会看到一系列文件,每个属性输入类型一个。这让我认为您在设置脚本中的“输入”数组键,即以下行......对于您的属性之一无效或丢失。检查您的设置脚本,如果您需要进一步的帮助,可以在此处发布相关部分。
The path in the second log message is interesting...
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...... 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.
导致此错误的原因是没有为安装指定类。
将类
Mage_Eav_Model_Entity_Setup
添加到config.xml
中的模块设置配置中。这将修复错误,但不会产生工作属性。使用此模块向 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 inconfig.xml
.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.
我遇到了同样的问题(magento 1.7.0.2)。经过一番调查后,我通过将此数组参数添加到安装程序中的每个自定义属性来修复它:
而不是教程中的“类型”和“输入”。
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:
instead of 'type' and 'input' in the tutorial.