我已经完全按照本教程完成了第 2 步。实际上,我将除设计目录中的文件之外的所有文件都放在了我的应用程序目录中,他可以下载这些文件。巧合的是,我也在尝试添加“学校”属性,到目前为止我还没有改变任何东西。我在 eav_attribute 表中看到“学校”。该模块在系统>配置>高级>模块输出中列为启用。我已经重新索引和刷新缓存,登录和注销。当我尝试编辑客户时,我仍然看不到“学校”属性。我正在使用vs 1.7。是否应该在客户的“帐户信息”选项卡中找到此字段?这个教程有什么过时的吗?
这全部在代码下载中,但仅供参考(他缺少 php 标签的结尾,所以我也添加了这些标签):controllers/IndexController.php
<?php
class Excellence_Profile_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
等/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Excellence_Profile>
<version>0.1.0</version>
</Excellence_Profile>
</modules>
<frontend>
<routers>
<profile>
<use>standard</use>
<args>
<module>Excellence_Profile</module>
<frontName>profile</frontName>
</args>
</profile>
</routers>
<layout>
<updates>
<profile>
<file>profile.xml</file>
</profile>
</updates>
</layout>
</frontend>
<admin>
<routers>
<profile>
<use>admin</use>
<args>
<module>Excellence_Profile</module>
<frontName>profile</frontName>
</args>
</profile>
</routers>
</admin>
<global>
<fieldsets>
<checkout_onepage_quote>
<customer_school>
<to_customer>school</to_customer>
</customer_school>
</checkout_onepage_quote>
<customer_account>
<school>
<to_quote>customer_school</to_quote>
</school>
</customer_account>
</fieldsets>
</global>
<global>
<fieldsets>
<customer_account>
<school><create>1</create><update>1</update><name>1</name></school>
</customer_account>
</fieldsets>
</global>
<global>
<models>
<profile>
<class>Excellence_Profile_Model</class>
<resourceModel>profile_mysql4</resourceModel>
</profile>
<profile_mysql4>
<class>Excellence_Profile_Model_Mysql4</class>
<entities>
<profile>
<table>profile</table>
</profile>
</entities>
</profile_mysql4>
</models>
<resources>
<profile_setup>
<setup>
<module>Excellence_Profile</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</profile_setup>
<profile_write>
<connection>
<use>core_write</use>
</connection>
</profile_write>
<profile_read>
<connection>
<use>core_read</use>
</connection>
</profile_read>
</resources>
<blocks>
<profile>
<class>Excellence_Profile_Block</class>
</profile>
</blocks>
<helpers>
<profile>
<class>Excellence_Profile_Helper</class>
</profile>
</helpers>
</global>
</config>
模特/实体/学校
<?php
class Excellence_Profile_Model_Entity_School extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
public function getAllOptions()
{
if ($this->_options === null) {
$this->_options = array();
$this->_options[] = array(
'value' => '',
'label' => 'Choose Option..'
);
$this->_options[] = array(
'value' => 1,
'label' => 'School1'
);
$this->_options[] = array(
'value' => 2,
'label' => 'School2'
);
$this->_options[] = array(
'value' => 3,
'label' => 'School3'
);
}
return $this->_options;
}
}
?>