Magento 设置功能不适用于除 faq_question、faq_answer 之外的任何其他列。主键只是继续增加,但数据没有插入到列中。
不管我给列名起什么名字,但它只是继续显示为空。奇怪的是,如果我手动填充该文件并使用它,getFaqJugaad()
那么它就可以工作。我可以从数据库中获取值。但没有设置请帮忙。谢谢
配置文件
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Gagan_Faq>
<version>0.2.0</version>
</Gagan_Faq>
</modules>
<frontend>
<routers>
<faq>
<use>standard</use>
<args>
<module>Gagan_Faq</module>
<frontName>faq</frontName>
</args>
</faq>
</routers>
<layout>
<updates>
<faq>
<file>gaganfaq.xml</file>
</faq>
</updates>
</layout>
</frontend>
<global>
<blocks>
<faq>
<class>Gagan_Faq_Block</class>
</faq>
</blocks>
<helpers>
<faq>
<class>Gagan_Faq_Helper</class>
</faq>
</helpers>
<models>
<faq>
<class>Gagan_Faq_Model</class>
<resourceModel>faq_mysql4</resourceModel>
</faq>
<faq_mysql4>
<class>Gagan_Faq_Model_Mysql4</class>
<entities>
<dinkchika>
<table>gagan_faq</table>
</dinkchika>
<dinkchika02>
<table>gagan_faq_creation</table>
</dinkchika02>
</entities>
</faq_mysql4>
</models>
<resources>
<faq_setup>
<setup>
<module>Gagan_Faq</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</faq_setup>
<faq_write>
<connection>
<use>core_write</use>
</connection>
</faq_write>
<faq_read>
<connection>
<use>core_read</use>
</connection>
</faq_read>
</resources>
</global>
这是我的安装脚本
<?php
$installer = $this;
$installer->startSetup();
$installer->run("
CREATE TABLE IF NOT EXISTS {$this->getTable('faq/dinkchika')} (
`faq_id` int(11) NOT NULL AUTO_INCREMENT,
`faq_question` varchar(255) DEFAULT NULL,
`faq_answer` varchar(255) DEFAULT NULL,
`faq_jugaad` varchar(255) DEFAULT NULL,
PRIMARY KEY (`faq_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
索引控制器
<?php
class Gagan_Faq_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$mod = Mage::getModel('faq/faq');
$mod->setFaqQuestion('how are 5454you?');
$mod->setFaqAnswer('gooddsfsfsdfsfdffsd?');
$mod->setFaqJugaad('sfsfdsfsfsdfsfdffsd?');
$mod->save();
$this->renderLayout();
}
}
数据库表