/**
  * @param string[] $eans
  * @param array    $fields
  *
  * @return $this
  */
 public function fetchProductsByEans(array $eans, array $fields = array())
 {
     parent::fetchProductsByEans($eans, $fields);
     if (ProductFields::requiresCategories($fields)) {
         $this->requireCategoryTree();
     }
     if (ProductFields::requiresFacets($fields)) {
         $this->requireFacets();
     }
     return $this;
 }
 public function requiresCategories()
 {
     $productCategories = isset($this->result['fields']) && ProductFields::requiresCategories($this->result['fields']);
     $categoryFacets = isset($this->result['categories']) && $this->result['categories'];
     return $productCategories || $categoryFacets;
 }