문제

We need to display grouped products without simple products associated with it in listing page. By default in Magento 2, if there is no simple product associated with grouped product then the grouped product doesn't show in product listing ,but we need to display grouped products without simple products associated with it. Can anyone done this before.

도움이 되었습니까?

해결책

Try This :-

$productFactory = $obj->create('Magento\Catalog\Model\ProductFactory')->create()
    ->getCollection()->addFieldToFilter('type_id', array('eq' => 'grouped'));
foreach ($productFactory as $product)
{
   $associatedProduct = $product->getTypeInstance()->getAssociatedProducts();
   if(!isset($associatedProduct))
   {
       $productName = $product->getName();
   }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top