1

What is the equivalent class for Magento2x for the below:

core\Mage\CatalogSearch\Block\Layer.php  (Mage_CatalogSearch_Block_Layer)

Cause in Magento2, we have only CatalogSearch/Result.php

Problem:

I want to convert these 2 classes in Magento 2

1.

class Vendor_Module_Block_CatalogSearch_Layer extends Mage_CatalogSearch_Block_Layer{

    public function canShowBlock() {


      if($service) {
        return true;
      } else {
        parent::canShowBlock();
      }

    }
}

2.

class Vendor_Module_Block_Catalog_Layer_View extends Mage_Catalog_Block_Layer_View 

    public function canShowBlock() {



      if($service) {
        return true;
      } else {
        parent::canShowBlock();
      }
    }
}
1

I think you are looking for Magento\LayeredNavigation\Block\Navigation.

To override canShowBlock, create an "around" plugin that returns your modified value.

Plugin documentation: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html

Your Answer

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

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