magento 2 Infortis ultimo theme display category tree menu on the left of the search result page

I am using the Infortis ultimo theme, in the included feature, i was able to add the category tree menu on the left bar of each category page, but how can i add it to the search result page?

is this something i can find using template hint & add to the layout file in Magento_CatalogSearch/layout/catalogsearch_result_index.xml ?

the shortcode to add it to the CMS Page or Static Block is this, how do I use it to add to the search result page?

{{block class="Infortis\UltraMegamenu\Block\Navigation" template="categories.phtml" parent="X" depth="X" block_name="X"}} 

enter image description here

Most viewed products by category not working

I want to add some automated products to the related products and had this working great however suddenly it has become stuck showing the same products. I have used a category Id that I put in the registry from breadcrumbs here to filter the most viewed collection however no matter what this seems to be stuck on the same products. The category ID in the code below is changing fine on each product however the collection remains the same on each page.

public function __construct(     \Magento\Catalog\Block\Product\Context $  context,     \Magento\Checkout\Model\ResourceModel\Cart $  checkoutCart,     \Magento\Catalog\Model\Product\Visibility $  catalogProductVisibility,     \Magento\Checkout\Model\Session $  checkoutSession,     \Magento\Framework\Module\Manager $  moduleManager,     \Magento\Catalog\Model\CategoryFactory $  categoryFactory,     \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $  productCollectionFactory,     \Magento\Store\Model\Store $  _storeManager,     \Magento\Reports\Model\ResourceModel\Product\CollectionFactory $  mostViewedCollectionFactory,     Registry $  registry,     array $  data = [] ) {     $  this->_checkoutCart = $  checkoutCart;     $  this->_catalogProductVisibility = $  catalogProductVisibility;     $  this->_checkoutSession = $  checkoutSession;     $  this->moduleManager = $  moduleManager;     $  this->_categoryFactory = $  categoryFactory;     $  this->_productCollectionFactory = $  productCollectionFactory;     $  this->_storeManager = $  _storeManager;     $  this->mostViewedCollection = $  mostViewedCollectionFactory;     $  this->registry = $  registry;     parent::__construct(         $  context,         $  checkoutCart,         $  catalogProductVisibility,         $  checkoutSession,         $  moduleManager,         $  data     ); }  protected function _prepareData() {     $  storeId = $  this->_storeManager->getStore()->getId();     $  productreg = $  this->_coreRegistry->registry('product');     if($  categoryIds = $  this->registry->registry('cat_ids')) {         $  categoryId = $  categoryIds[1];     }     /* @var $  product \Magento\Catalog\Model\Product */      $  this->_itemCollection = $  productreg->getRelatedProductCollection()->addAttributeToSelect(         'required_options'     )->setPositionOrder()->addStoreFilter();      if ($  this->moduleManager->isEnabled('Magento_Checkout')) {         $  this->_addProductAttributesAndPrices($  this->_itemCollection);     }     $  this->_itemCollection->setVisibility($  this->_catalogProductVisibility->getVisibleInCatalogIds());      $  count = 8 - count($  this->_itemCollection);     $  this->_itemCollection->load();      if($  categoryId) {         $  collectionCat = clone $  this->mostViewedCollection->create();         $  collectionCat->clear();         $  collectionCat->addAttributeToSelect(             ['name','price','small_image']         )->addCategoriesFilter(['eq' => $  categoryId]         )->addViewsCount(         )->setStoreId(             $  storeId         )->addStoreFilter(             $  storeId         )->setPageSize(             $  count         );          foreach($  collectionCat as $  item)         {                if($  item->getSku() != $  productreg->getSku()) {                 try {                     $  this->_itemCollection->addItem($  item);                 } catch (\Exception $  e) {                 }             }         }         return $  this;     }  } 

I’ve tried clone and clear like seen in other collections to try and reset but really was just guessing there but it didn’t seem to change the results. I have also disabled all caches with same results on each page.

Magento 2: Get recently reviewed Products on Category Page

On the product view page the reviews get loaded via the following code:

$  _items = $  block->getReviewsCollection()->getItems(); 

This is what the getReviewsCollection function looks like:

public function getReviewsCollection() {     if (null === $  this->_reviewsCollection) {         $  this->_reviewsCollection = $  this->_reviewsColFactory->create()->addStoreFilter(             $  this->_storeManager->getStore()->getId()         )->addStatusFilter(             \Magento\Review\Model\Review::STATUS_APPROVED         )->addEntityFilter(             'product',             $  this->getProduct()->getId()         )->setDateOrder();     }     return $  this->_reviewsCollection; } 

This is later used in the following way:

foreach ($  _items as $  _review):     ...     ...     foreach ($  _review->getRatingVotes() as $  _vote):         ...         ... 

I’m trying to replicate this in order to display the recently reviewed products on the category pages. My code so far looks like this:

public function __construct(     \Magento\Catalog\Api\ProductRepositoryInterface $  productRepository,     \Magento\Framework\Registry $  registry,     \Magento\Review\Model\ResourceModel\Review\CollectionFactory $  reviewCollection,     \Magento\Store\Model\StoreManagerInterface $  storeManager,      \Magento\Framework\View\Element\Template\Context $  context,     array $  data = [] ) {     $  this->productRepository = $  productRepository;     $  this->registry = $  registry;     $  this->reviewCollection = $  reviewCollection;     $  this->storeManager = $  storeManager;     parent::__construct($  context, $  data); }  public function getCollection() {     $  category = $  this->registry->registry('current_category');     $  collection = $  category->getProductCollection();      foreach( $  collection as $  product ) {          $  prod = $  this->productRepository->getById($  product->getId());          $  urlKey = $  prod->getData("url_key");         $  url = $  this->getUrl($  urlKey);          // this is the method from the magento         // core function (getReviewsCollection()) mentioned above         $  reviewCollection = $  this->reviewCollection->create()             ->addStoreFilter(                 $  this->storeManager->getStore()->getId()             )->addStatusFilter(                 \Magento\Review\Model\Review::STATUS_APPROVED             )->addEntityFilter(                 'product',                 $  prod->getId()             )->setDateOrder();          $  reviews = $  reviewCollection->getItems();          if( !empty($  reviews) ){             foreach ($  reviews as $  review){                 // this is where the code breaks                 foreach( $  review->getRatingVotes() as $  rating ){                     // do stuff here                 }             }         }      } } 

Inside the getCollection function I use the same method to retrieve the review collection as in the getReviewsCollection method from the magento core. I can successfully retrieve an array of \Magento\Review\Model\Review objects.

But my code breaks as soon as I try to iterate over the reviews and use the $ review->getRatingVotes() method inside the inner most foreach loop. getRatingVotes() returns null and I get an Invalid argument supplied for foreach() exception.

I decided to investigate the getRatingVotes() method but I cannot find where it is defined. I did a search of the whole codebase inside VSCode as well as via grep. The only place where it occurs is inside the .phtml template file of the reviews list.

Magento 2 : search into category name

When a user is making a search on my website I would like to search into categories name, for example if the user is searching for “house” I would like to display all products containing “house” in their name (default behavior) but also all products of categories containing “house” in their name.

I wrote the code below, it’s working great I have all products but the toolbar is not working anymore (order, limit, pager…) is there any way to “reload” the toolbar with my new collection ?

Thanks !

File: di.xml <!-- Set plugin --> <type name="Magento\Catalog\Model\Layer\Search\CollectionFilter">     <plugin name="CategoryName_Search" type="My\Module\Model\Layer\Search\Plugin\CollectionFilter" /> </type>   File: My\Module\Model\Layer\Search\Plugin\CollectionFilter  public function afterFilter( \Magento\Catalog\Model\Layer\Search\CollectionFilter $  subject, $  result, $  collection, Category $  category ) { $  query = $  this->queryFactory->get();  if (!$  query->isQueryTextShort()) {     //Get categories list by name     $  categoryCollection = $  this->collectionFactory       ->create()       ->addAttributeToFilter('name', array('like' => '%'.$  query->getQueryText().'%'));      //For each product in these categories add product to search collection     foreach($  categoryCollection as $  category) {       $  categoryProducts = $  category->getProductCollection()->addAttributeToSelect('*');        foreach($  categoryProducts as $  product) {         if (!$  collection->getItemById($  product->getId())) {           $  collection->addItem($  product);         }       }     } } 

Create new Magento Rest API to get category list in Magento 1.9

I am very confused about what kind of error I am doing to follow these steps provided here at the following link :

Create new Magento Rest API to get category list in Magento

After doing all these steps and even editing, after reading all the solution still getting the same error as getting before implementation of this link steps.

To Create new Magento Rest API to get category list in Magento 1.9,
Where I can get category tree?

Magento 2 – Get Categories by Custom Category Attribute

I’ve created a yes/no toggle category attribute named is_featured, its shown as “Homepage Category” in the screenshot below.

enter image description here

I’d like to be able to display (on the homepage cms page) all categories with this category attribute set to yes, I’d need to grab the category title, url, thumbnail etc, does anyone have any recommended steps on how to achieve this?