问题描述
我想更改管理类别"页面,以便在产品"选项卡中也将产品类型作为一列.这样,我将能够快速添加可配置的主产品,而不必筛选其简单的子产品.
I would like to change the admin category page so that in the products tab I also have the product type as a column. In that way I will be able to rapidly add configurable master products without having to sift through their simple child products.
一个替代选项-或附加列-将具有具有常规目录/搜索,搜索,目录选项的可见性列.
An alternative option - or additional column - would be to have the visibility column with the usual catalog/search, search, catalog options.
我在这里尝试过@clockworkgeek对该主题的介绍:添加列到Magento管理员目录>管理产品但是我需要在在此处添加sql"部分添加更多指针.
I have tried @clockworkgeek's intro to the topic here: Add column to Magento admin catolog > manage productsBut I need more pointers at the 'add sql here' part.
推荐答案
有时候,要使用本地替代而不是尝试编写另一个模块,要说很多话.
Sometimes there is a lot to be said for using a local over-ride rather than trying to write yet another module.
我通过制作用于产品网格的文件的本地副本解决了我的问题:app/code/local/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
I solved my problem by making a local copy of the file that does the product grid: app/code/local/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
在准备好产品系列之后,我立即添加了这一行:
I added this line immediately after after the product collection is prepared:
$collection->joinAttribute(
'visibility',
'catalog_product/visibility',
'entity_id',
null,
'inner'
);
然后在我添加的'prepareColumns'函数中:
Then in 'prepareColumns' function I added:
$this->addColumn('visibility',
array(
'header'=> Mage::helper('catalog')->__('Visibility'),
'width' => '70px',
'index' => 'visibility',
'type' => 'options',
'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
));
这现在意味着我有我的目录/搜索,在网格中没有单独可见的选项.
This now means that I have my catalogue/search, not visible individually options in the grid.
如何添加列的模板是普通产品网格:app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php
The template for how to add columns is the normal product grid: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php
这篇关于Magento:如何在“管理类别"页面的产品选择中添加一列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!