I've seen a similar thread here but it just doesn't work for me, maybe because of using Magento 2.15 instead of Magento 2.0 which had some major changes.

I'm not able to get Products to show on the Product page, due to "Call to an undefined function toHtml() on null", the getImage function is returning null.

Following this here: Magento 2 - How To Display Cross Sell Products On Product Details Page (PDP)?

Thanks for any help.

  • Did you ever get to the bottom of this? I Have the same issue however unsure how to resolve.
    – harri
    Commented Jun 30, 2017 at 9:51

2 Answers 2


I've just had this issue also and after a few hours playing have got a solution here: Crosssell Products on Product Page with Magento 2


Paste this code to inside contaner of catalog_product_view.xml

<block class="Magento\Checkout\Block\Cart\Crosssell" name="product.view.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-">
        <argument name="type" xsi:type="string">crosssell</argument>
    <block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="crosssell.product.view" as="addto">
        <block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare" name="crosssell.product.addto.compare.view" as="compare" template="Magento_Catalog::product/list/addto/compare.phtml"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.