我想更改管理类别页面,以便在产品选项卡中,我也有产品类型作为一列。通过这种方式,我将能够快速添加可配置的主产品,而不必筛选其简单的子产品。
另一个选项-或附加列-将具有可见性列,其中包含通常的目录/搜索、搜索、目录选项。
我已经尝试了@clockworkgeek在这里的主题介绍:Add column to Magento admin catolog > manage products,但我需要更多的指针在'add sql here‘部分。
发布于 2012-01-16 20:14:27
您应该添加此文件: app/code/local/your company/you app/Model/Resource/Eav/Mysql4/Setup.php
class [YourNameSpace]_[YourModule]_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup{
public function getDefaultEntities(){
return array(
'catalog_product' => array(
'entity_model' => 'catalog/product',
'attribute_model' => 'catalog/resource_eav_attribute',
'table' => 'catalog/product',
'additional_attribute_table' => 'catalog/eav_attribute',
'entity_attribute_collection' => 'catalog/product_attribute_collection',
'attributes' => array(
'**Name of your column 1**' => array(
'type' => 'varchar',
'backend' => '',
'frontend' => '',
'label' => 'Your Column Label ...',
'input' => 'text',
'class' => '',
'source' => '',
'global' => 1,
'group' =>'General',
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => true,
'filterable' => true,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'visible_in_advanced_search' => true,
'used_in_product_listing' => true,
'used_for_sort_by' => true,
),
// your other columns...
)
)
);
}
}您需要首先从表core_resource中删除您的模块。然后编辑您模块/etc/config.xml的文件,在全局区域中添加以下代码:
.
<resources>
<[your_module_name_in_lowercase]_setup>
<setup>
<module>[YourNamespace]_[YourModuleName]</module>
<class>
[YourNamespace]_[YourModuleName]_Model_Resource_Eav_Mysql4_Setup
</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</[your_module_name_in_lowercase]_setup>
<[your_module_name_in_lowercase]_write>
<connection>
<use>core_write</use>
</connection>
</[your_module_name_in_lowercase]_write>
<[your_module_name_in_lowercase]_read>
<connection>
<use>core_read</use>
</connection>
</[your_module_name_in_lowercase]_read>
</resources>.
发布于 2012-01-17 00:11:32
有时,使用本地重写而不是尝试编写另一个模块有很多话要说。
我通过创建产品网格文件的本地副本解决了我的问题: app/code/local/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
在准备好产品集合之后,我立即添加了这一行:
$collection->joinAttribute(
'visibility',
'catalog_product/visibility',
'entity_id',
null,
'inner'
);然后在'prepareColumns‘函数中我添加了:
$this->addColumn('visibility',
array(
'header'=> Mage::helper('catalog')->__('Visibility'),
'width' => '70px',
'index' => 'visibility',
'type' => 'options',
'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
));这意味着我在网格中有我的目录/搜索,不单独可见的选项。
如何添加列的模板是普通的产品网格: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php
https://stackoverflow.com/questions/8879130
复制相似问题