그리드에서 제품 이름을 가져옵니다
-
13-12-2019 - |
문제
사용자 정의 모듈 i 관리 격자에 제품 이름을 표시하려는 내 테이블에 제품 ID를 저장합니다
i
테이블에 가입하도록이 코드를 시도하는 것$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를 얻고 있지만 이름이 표시되는 방법이 표시되지 않습니다
해결책
가입을 사용하면 이와 같은 제품 이름을 가져와야합니다
$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