EmicoEcommerce / Magento2Tweakwise-archived

Magento 2 module for Tweakwise integration
Other
9 stars 25 forks source link

Featured Recommendations are loaded when the featured recommendations are not enabled #15

Closed joost-florijn-kega closed 6 years ago

joost-florijn-kega commented 6 years ago

Issue Brief

What is the purpose of this issue? Explain the background context.

Environment

Steps to reproduce

  1. Install Magento from develop branch.
  2. Disable Featured Recommendation
  3. Open a product list page.

Actual result

  1. You get a report page.

Message: Featured products without template ID was requested. Stack trace:

#0 vendor/emico/tweakwise/src/Model/Client.php(91): Emico\Tweakwise\Model\Client\Request\Recommendations\FeaturedRequest->getPathSuffix()
#1 vendor/emico/tweakwise/src/Model/Client.php(166): Emico\Tweakwise\Model\Client->doRequest(Object(Emico\Tweakwise\Model\Client\Request\Recommendations\FeaturedRequest))
#2 vendor/emico/tweakwise/src/Model/Catalog/Product/Recommendation/Context.php(97): Emico\Tweakwise\Model\Client->request(Object(Emico\Tweakwise\Model\Client\Request\Recommendations\FeaturedRequest))
#3 vendor/emico/tweakwise/src/Model/Catalog/Product/Recommendation/Context.php(108): Emico\Tweakwise\Model\Catalog\Product\Recommendation\Context->getResponse()
#4 vendor/emico/tweakwise/src/Block/Catalog/Product/ProductList/Featured.php(86): Emico\Tweakwise\Model\Catalog\Product\Recommendation\Context->getCollection()
#5 vendor/magento/module-catalog/Block/Product/ListProduct.php(321): Emico\Tweakwise\Block\Catalog\Product\ProductList\Featured->_getProductCollection()
#6 vendor/magento/module-page-cache/Model/Layout/LayoutPlugin.php(71): Magento\Catalog\Block\Product\ListProduct->getIdentities()
#7 vendor/magento/framework/Interception/Interceptor.php(152): Magento\PageCache\Model\Layout\LayoutPlugin->afterGetOutput(Object(Magento\Framework\View\Layout\Interceptor), '               ...')

Expected result

List the expected results as a bullet list of expectations

The check to show the featured recommendations on the product list page is done here: https://github.com/EmicoEcommerce/Magento2Tweakwise/blob/master/src/Block/Catalog/Product/ProductList/Featured.php#L126

But Magento also calls the function _getProductCollection directly for instance: https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Catalog/Block/Product/ListProduct.php#L268