gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 06:04:44 25 4
gpt4 key购买 nike

在 Magento 1.5.1.0 的 vanilla 安装中,我创建了简单的产品 COLOR-RED、COLOR-BLUE 并创建了一个可配置的产品 COLOR,它与这些产品相关联。这一切正常,除了关联产品的名称未显示在可配置产品的“ super 产品属性配置”表的后端。
我在 htdocs/app/design/adminhtml/default/default/template/widget/grid.phtml 中添加了一个简单的调试语句,以在显示之前显示项目的数据。见下文,名称属性不存在。
有人知道为什么吗?这是 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] =>
)
)

最佳答案

您可能正在使用 Simple Configurable Products 模块。在文件 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com