2016-03-28 11 views
1

Carrier Modelinde, ürünlerin çekilmesi $request->getAllItems() aracılığıyla çalışıyor ve Ürün $item->getProduct() ürününü alıyor. özel ürün niteliğini nasıl çekebileceğimi anlayamıyorum.Magento 2 özel ürün niteliğine sahip olun Ürüne ait gönderim bedeli

$item->getProduct()->getAttribute('custom_attr'); // nothing 
    $item->getProduct()->getResource()->getAttribute('custom_attr'); // uses up 3GB memory and dies 
    $item->getProduct()->getCustomAttributes(); //empty array 
    $item->getProduct()->getExtensionAttributes(); //empty array 

da

cevap

2

buldum extension_attributes.xml oluşturma çalıştı, nihayet :) orada bütün ürünü yüklemek için daha iyi bir yoldur ama şimdilik çalışıyor emin değilim.

 $_product = $objectManager->get('Magento\Catalog\Model\Product')->load($item->getProduct()->getId()); 
    $attr = $_product->getData('attribute_name'); 
İlgili konular