我正在尝试在Magento插件中创建一个新模型,即使我接着写了几个教程,它似乎也不起作用:
在 app / code / local / O2 / OCustomer / etc / config.xml
下<?xml version="1.0"?>
<config>
<modules>
<O2_OCustomer>
<version>0.0.1</version>
</O2_OCustomer>
</modules>
<global>
<models>
<o2_ocustomer>
<class>O2_OCustomer_Model</class>
<resourceModel>o2_ocustomer_resource</resourceModel>
</o2_ocustomer>
<o2_ocustomer_resource>
<class>O2_OCustomer_Model_Resource</class>
<deprecatedNode>customer_mysql4</deprecatedNode>
<entities>
<customer_group_website>
<table>o2_ocustomer_group_website</table>
</customer_group_website>
</entities>
</o2_ocustomer_resource>
</models>
app / code / local / O2 / Ocustomer / Model / Customer / Group / Website.php
<?php
class O2_OCustomer_Model_Customer_Group_Website extends Mage_Core_Model_Abstract
{
public function __construct()
{
$this->_init('o2_ocustomer/customer_group_website');
}
}
app / code / local / O2 / Ocustomer / Model / Resource / Customer / Group / Website.php
<?php
class O2_OCustomer_Model_Resource_Customer_Group_Website extends Mage_Core_Model_Resource_Db_Abstract
{
public function __construct()
{
$this->_init('o2_ocustomer/customer_group_website', 'customer_group_website_id');
}
}
我已经尝试过这两个电话,但都没有工作:
<?php
$model = Mage::getModel('ocustomer/customer_group_website');
var_dump(get_class($model));
$model = Mage::getModel('o2_ocustomer/customer_group_website');
var_dump(get_class($model));
你可以告诉我我做错了什么吗?我被困在这一天超过一天,这是不对的......
提前多多感谢!
答案 0 :(得分:0)
好的,修好了......抱歉打扰了。终于看到一个班级被严重命名了。