グリッドで製品名を入手してください
-
13-12-2019 - |
質問
カスタムモジュールでは、admin grid
で製品名を表示したいことを使用して、私のテーブルに製品IDを保存します。私はこのコードを試してテーブル
を結んでいます。$collection->getSelect()
->joinLeft(
array('prod' => 'catalog_product_entity'),
'prod.entity_id = main_table.mageproduct_id',
array('sku')
)
->joinLeft(
array('cpev' => 'catalog_product_entity_varchar'),
'cpev.entity_id=main_table.mageproduct_id ,
array('name' => 'value')
);
.
私はSKUを取得していますが、名前が表示されていない名前
解決
結合を使用するuはこの
のような製品名を取得する必要があります$entityTypeId = Mage::getModel('eav/entity')
->setType('catalog_product')
->getTypeId();
$prodNameAttrId = Mage::getModel('eav/entity_attribute')
->loadByCode($entityTypeId, 'name')
->getAttributeId();
$collection->getSelect()
->joinLeft(
array('prod' => 'catalog_product_entity'),
'prod.entity_id = main_table.mageproduct_id',
array('sku')
)
->joinLeft(
array('cpev' => 'catalog_product_entity_varchar'),
'cpev.entity_id=prod.entity_id AND cpev.attribute_id='.$prodNameAttrId.'',
array('name' => 'value')
);
.
これは私がこれがあなたを助けることを願っています
所属していません magento.stackexchange