i have 4 rating attributes (Admin->Shops->Attribut->Rating), like "Price", "Scent" and so on. It looks like this:
But it is impossible to find a way, how i can get a summary/data for all ratings, like:
Duft 3,5/5 stars (40 votes)
Wirksamkeit 4,3/5 stars (41 votes)
.... and so on.
$ratingCollectionFactory = $objectManager->get('Magento\Review\Model\ResourceModel\Rating\CollectionFactory'); $ratingCollection = $ratingCollectionFactory->create() ->addEntityFilter( 'product', $product->getId() ) ->setPositionOrder()->setStoreFilter( $storeId) ->addFieldToFilter('is_active',true) ->setPositionOrder('desc', true); echo "<pre>"; print_r($ratingCollection->getData()); This results in an array:
Array ( [0] => Array ( [rating_id] => 1 [entity_id] => 1 [rating_code] => Gesamtbewertung [position] => 4 [is_active] => 1 [entity_code] => product ) [1] => Array ( [rating_id] => 6 [entity_id] => 1 [rating_code] => Textur [position] => 3 [is_active] => 1 [entity_code] => product ) This only shows the attributs data, but i couldnt find a way to get a summary for the votes/ the votes data, like average count, count totals...
Can someone help?
