magento - 可配置产品的关联产品名称在管理中不可见?

标签 magento magento-1.5

在 Magento 1.5.1.0 的普通安装中,我创建了简单的产品“COLOR-RED”、“COLOR-BLUE”,并创建了一个可配置的产品“COLOR”,将这些产品与其关联。这一切正常,除了关联产品的名称未显示在可配置产品的“ super 产品属性配置”表的后端中这一事实之外。 我在 htdocs/app/design/adminhtml/default/default/template/widget/grid.phtml 添加了一个简单的调试语句,以在显示之前显示项目的数据。看下面,name属性不存在。 有人知道为什么吗?这是 Magento 中的错误,还是其他错误?

Array
(
    [entity_id] => 1
    [entity_type_id] => 4
    [attribute_set_id] => 9
    [type_id] => simple
    [sku] => COLOR-RED
    [has_options] => 0
    [required_options] => 0
    [created_at] => 2011-12-13 15:08:36
    [updated_at] => 2011-12-13 15:08:36
    [is_saleable] => 0
    [inventory_in_stock] => 0
    [color] => 3
    [price] => 12.0000
    [stock_item] => Varien_Object Object
        (
            [_data:protected] => Array
                (
                    [is_in_stock] => 
                )

            [_hasDataChanges:protected] => 
            [_origData:protected] => 
            [_idFieldName:protected] => 
            [_isDeleted:protected] => 
        )
)

最佳答案

您可能正在使用简单可配置产品模块。在文件 app/code/community/OrganicInternet/SimpleConfigurableProducts/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php 中,Organic Internet 的开发人员留下了一个很好的小提示;

#Copied from Magento v1.3.1 code.
#Only need to comment out addFilterByRequiredOptions but there's no
#nice way of doing that without cutting and pasting the method into my own
#derived class. Boo.
#This change stops the filtering-out of any configurable product's 'associated products' that have compulsory custom options
#Have also replaced parent::_prepareCollection with Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();

我认为 1.3.1 中使用的代码已过时,因此如果您使用 >1.3.1,此文件也会过时。所以我只是查看了核心文件app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php的内容并寻找差异,并找到了罪魁祸首。

您所要做的就是添加这一行;

->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'inner')

在这两行之间;

->addFieldToFilter('attribute_set_id',$product->getAttributeSetId())
        ->addFieldToFilter('type_id', $allowProductTypes);

一切准备就绪!

关于magento - 可配置产品的关联产品名称在管理中不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8491838/

相关文章:

Magento,启用 DHL, "Site Id is wrong"

Magento 编译后死亡 : how to disable using compiled files without admin panel access?

paypal - 从结帐页面删除 Paypal 快速结帐单选按钮

Magento - 对运费金额应用折扣

Magento - 查找过去一小时内创建的产品

php - 在 Magento 上找不到基表或 View

外部脚本中的 Magento 翻译

php - 具有固定价格的 Magento 简单 bundle

Magento - 从优惠券代码中获取规则

magento - 在 Magento CMS 页面上显示产品列表的分页链接