0

I am overriding default related.phtml in custom theme Magento_Catalog but data is not showing properly.If Any One have idea please help me.

<?php 
if ($currentProduct = $block->getProduct()) {
    $relatedProducts = $currentProduct->getRelatedProducts();
    $blockObj = $block->getLayout()->createBlock('Vendor\Module\Block\Feature');
    if (!empty($relatedProducts)) {


        foreach ($relatedProducts as $relatedProduct) {

                $productId = $relatedProduct->getId();  
                $ProCollection = $blockObj->getProductData($productId);

                $ProductType = $relatedProduct->getData('type_product');
                 //$productType = $relatedProduct->getResource()->getAttribute('type_product')->getFrontend()->getValue($relatedProduct);
                ?>

                <?php 

        }

    }    

}

?>
  • can you mention layout file for this template ? – Ajwad Taqvi Nov 22 '18 at 6:10
  • please check the code i mentioned in question – hitesh balpande Nov 22 '18 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.