cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4.3 issues - many of the shop by brand module

Magento 2.4.3 issues - many of the shop by brand module

I have installed multiple shop by brand module but they have an common issue after I upgraded to magento 2.4.3... there is no issue on 2.4.2 

composer require coderkube/brand:1.0.1 --no-update
composer update


So when I click on the brand , it suppose to list all the product under this brand. and Please note, this extension create an attributes for every product and we use brand attributes on the product. 

 

 

The following error appears: 


Error: Call to a member function getOptionsData() on null in /usr/share/nginx/html/sample.com.uk/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml:90


and in line 90, this is the content of the code below:

<?php $optionsData = $block->getData('viewModel')->getOptionsData($_product); ?>

Please note, this only happens in magento 2.4.3 not 2.4.2 and and this error only happens when i click on one brand to list the product under this brand

2 REPLIES 2

Re: Magento 2.4.3 issues - many of the shop by brand module

Did you find a fix for this? I am experiencing the same error when attempting to add a product list to a cms page:

 

Error: Call to a member function getOptionsData() on null in vendor/magento/module-catalog/view/frontend/templates/product/list.phtml:90

using

 

{{block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" category_id="3264"
 template="product/list.phtml"}}

Also 2.4.3

Re: Magento 2.4.3 issues - many of the shop by brand module

In your XML file, you have to add ViewModel for Layernavigation.

 

<block class="Prince\Custom\Block\Product\ProductList" name="custom.products.list" as="product_list" template="Magento_Catalog::product/list.phtml">
                <arguments>
                    <argument name="viewModel" xsi:type="object">Magento\Catalog\ViewModel\Product\OptionsData</argument>
                </arguments>
                <container name="category.product.list.additional" as="additional" />
                <block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
                    <block class="Magento\Framework\View\Element\Template" as="default"/>
                </block>
                <block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="category.product.addto" as="addto">
                    <block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
                           name="category.product.addto.compare" as="compare"
                           template="Magento_Catalog::product/list/addto/compare.phtml"/>
                </block>
                <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
                    <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>

                </block>
                <action method="setToolbarBlockName">
                    <argument name="name" xsi:type="string">product_list_toolbar</argument>
                </action>
            </block>