The error message you’re encountering, “Missing required configuration option ‘host'”, suggests that the Algolia Magento 2 MySQL adapter is expecting a configuration option called ‘host’, but it is not provided. This typically indicates an issue with the configuration settings for the Algolia extension in your Magento 2 installation.
Algolia Magento 2 Common Error Message on Product Save and Shipment Save Error “Missing required configuration option ‘host'”
To fix this error message, you have to change on file vendor\algolia\algoliasearch-magento-2\Helper\Data.php
protected function getSalesData($storeId, Collection $collection)
Add below line
catch (\Exception $e) { $salesConnection = $this->resource->getConnection(); }
It will look like this.
/** * @param $storeId * @param Collection $collection * @return array */ protected function getSalesData($storeId, Collection $collection) { $additionalAttributes = $this->configHelper->getProductAdditionalAttributes($storeId); if ($this->productHelper->isAttributeEnabled($additionalAttributes, 'ordered_qty') === false && $this->productHelper->isAttributeEnabled($additionalAttributes, 'total_ordered') === false) { return []; } $salesData = []; $ids = $collection->getColumnValues('entity_id'); if (count($ids)) { $ordersTableName = $this->resource->getTableName('sales_order_item'); try { $salesConnection = $this->resource->getConnectionByName('sales'); } catch (\DomainException $e) { $salesConnection = $this->resource->getConnection(); } catch (\Exception $e) { $salesConnection = $this->resource->getConnection(); } $select = $salesConnection->select() ->from($ordersTableName, []) ->columns('product_id') ->columns(['ordered_qty' => new \Zend_Db_Expr('SUM(qty_ordered)')]) ->columns(['total_ordered' => new \Zend_Db_Expr('SUM(row_total)')]) ->where('product_id IN (?)', $ids) ->group('product_id'); $salesData = $salesConnection->fetchAll($select, [], \PDO::FETCH_GROUP | \PDO::FETCH_ASSOC | \PDO::FETCH_UNIQUE); } return $salesData; }