我正在尝试通过模块中的设置脚本添加属性,但它没有显示在管理面板中。
这就是我所拥有的:
应用程序的/ etc /模块/ MyCompanyName_UpgradeScripts.xml
<?xml version="1.0"?>
<config>
<modules>
<MyCompanyName_UpgradeScripts>
<active>true</active>
<codePool>local</codePool>
</MyCompanyName_UpgradeScripts>
</modules>
</config>
应用程序/代码/本地/ MyCompanyName / UpgradeScripts /控制器/ IndexController.php
<?php
class MyCompanyName_UpgradeScripts_IndexController extends Mage_Core_Controller_Front_Action{
public function indexAction(){
$this->loadLayout();
$this->renderLayout();
}
}
应用程序/代码/本地/ MyCompanyName / UpgradeScripts的/ etc / config.xml中
<?xml version="1.0"?> <config>
<modules>
<mycompanyname_upgradescripts>
<version>
0.1.0
</version>
</mycompanyname_upgradescripts>
</modules>
<global>
<resources>
<add_category_attribute>
<setup>
<module>MyCompanyName_UpgradeScripts</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
</add_category_attribute>
</resources>
</global>
<frontend>
<routers>
<helloworld>
<use>standard</use>
<args>
<module>MyCompanyName_UpgradeScripts</module>
<frontName>ebayaffload</frontName>
</args>
</helloworld>
</routers>
</frontend>
</config>
应用程序/代码/本地/ MyCompanyName / UpgradeScripts / add_category_attribute \ mysql4安装-0.1.0.php
<?php
$this->startSetup();
$this->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'mycompanyname_upgradescripts_cat', array(
'group' => 'General Information',
'input' => 'text',
'type' => 'text',
'label' => 'Category ID',
'backend' => '',
'visible' => true,
'required' => false,
'visible_on_front' => true,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->endSetup();
答案 0 :(得分:0)
添加ctegory属性。
文件结构:
应用程序/代码/本地/ Amanweb / Catattr的/ etc / config.xml中 应用程序/代码/本地/ Amanweb / Catattr /助手/ Data.php 应用程序/代码/本地/ Amanweb / Catattr / SQL / categoryaddattr_setup / mysql4安装,0.1.0.php 应用程序的/ etc /模块/ Amanweb_Catattr.xml
config.xml中的代码
$installer = $this;
$installer->startSetup();
$installer->removeAttribute('catalog_category','bottomblock_image');
$installer->addAttribute("catalog_category", "bottomblock_image", array(
"type" => "text",
"backend" => "",
"frontend" => "",
"label" => "Label",
"input" => "text",
"class" => "",
"source" => "",
"global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
"visible" => true,
"required" => false,
"user_defined" => false,
"default" => "",
"searchable" => false,
"filterable" => false,
"comparable" => false,
"visible_on_front" => true,
"unique" => false,
"note" => "",
'group' => "Custom Design"
));
$installer->endSetup();
Data.php中的代码 类Amanweb_Catattr_Helper_Data扩展了Mage_Core_Helper_Abstract { }
mysql4-install-0.1.0.php中的代码
<?xml version="1.0"?>
<config>
<modules>
<Amanweb_Catattr>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</Amanweb_Catattr>
</modules>
</config>
Amanweb_Catattr.xml中的代码
core_resource
注意:如果您的安装脚本不起作用,请检查您的Appointment other = obj as Appointment;
bool equal = false; // init to false is better
if (other != null)
{
equal = (this.date == null ? (other.date == null) : (this.date.Equals(other.date)));
}
return equal;
表,它们是您的模块设置的条目,删除该条目并从管理员刷新magento缓存,它应该正常工作。