0

I'm trying to change change the default "sorter by"

I can't override Magento\Catalog\Block\Product\ProductList\Toolbar

I created a custom module, set the di.xml with

<preference for="Magento\Catalog\Block\Product\ProductList\Toolbar" type="Custom\Catalog\Block\Product\ProductList\Toolbar" />

But I got this

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to 
Magento\\Catalog\\Block\\Product\\ListProduct::configureToolbar() must 
be an instance of 
Magento\\Catalog\\Block\\Product\\ProductList\\Toolbar, instance of 
Custom\\Catalog\\Block\\Product\\ProductList\\Toolbar given, called in 
/var/www/html/site/vendor/magento/module- 
catalog/Block/Product/ListProduct.php on line 206 and defined in 
/var/www/html/site/vendor/magento/module- 
catalog/Block/Product/ListProduct.php:488\nStack trace:\n#0 
/var/www/html/site/vendor/magento/module- 
catalog/Block/Product/ListProduct.php(206): 
Magento\\Catalog\\Block\\Product\\ListProduct- >configureToolbar(Object(Custom\\Catalog\\Block\\Product\\ProductList\\Toolbar), Object(WeltPixel\\LayeredNavigation\\Model\\ResourceModel\\Fulltext\\Collection\\Interceptor))\n#1 /var/www/html/site/vendor/magento/module-catalog/Block/Product/ListProduct.php(467): Magento\\Catalog\\Block\\Product\\ListProduct->addToolbarBlock(Object(WeltPixel\\LayeredNavigation\\Model\\ResourceModel\\Fulltext\\Collection\\Interceptor))\n#2 /var/www/html/site/vendor/ma in /var/www/html/site/vendor/magento/module-catalog/Block/Product/ListProduct.php on line 488,

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.