Dav*_*ims 5 magento magento-1.8
我目前正在尝试将新的类别属性添加到Magento 1.8.1中的类别管理界面,但是我遇到了一些问题.
我能找到的唯一代码示例包括mysql4,但我认为这已经退役了?请允许任何人在这里指出我们正确的方向.
我可以在Config> Advanced和core_resources表中看到我的扩展.但不是在网站的前端.
Set*_*aki 16
我们最近用1.8.2.0尝试了这个.你并不真的需要创建一个模块,只需增加一个类别属性,一次.似乎这样的废物要经过这么多的文件克鲁夫特获得安装只有一次的东西.
类别属性一旦安装就会永久保留,因此对我们来说更好的方法就是使用一次性脚本.在magento root保存这个.
<?php
require_once "app/Mage.php";
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
// change details below:
$attribute = array(
'type' => 'int',
'label'=> 'Your attribute label',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'your_attribute_code', $attribute);
$installer->endSetup();
Run Code Online (Sandbox Code Playgroud)
把它保存为add_category_attribute.php或者其他令人难忘的东西.
您可以使用浏览器访问此文件,也可以使用php-cli以运行此文件:
php -f add_category_attribute.php
Run Code Online (Sandbox Code Playgroud)
祝好运.