Question

Dans le module personnalisé I m Saving ID de produit dans ma table à l'aide de celle que je souhaite afficher le nom du produit dans la grille d'administration

i m Essayez ce code de rejoindre la table

$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')
    ); 

Je reçois SKU mais le nom ne s'affiche pas comment obtenir le nom

Était-ce utile?

La solution

Utiliser Joindre vous devez obtenir un nom de produit comme celui-ci

$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')
    ); 

Ceci est travaillé pour moi espère que cela vous aidera

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top