Skip to content
This repository was archived by the owner on Aug 4, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions app/code/community/Ovs/Magefaker/Model/Faker.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,20 @@ protected function _addProductReviews($productId)
$faker->addProvider(new Faker\Provider\Lorem($faker));

$reviewCount = mt_rand(0, 10);

$rating_options = [
1 => [1, 2, 3, 4, 5],
2 => [6, 7, 8, 9, 10],
3 => [11, 12, 13, 14, 15],
];

/**
* Get collection of reviews instead of hardcoding the default magento ones,
* this way we add ratings for custom added ones too.
*/

$ratings = Mage::getModel('rating/rating')->getCollection();
$rating_options = [];
foreach ($ratings as $rating) {
$options = $rating->getOptions();
foreach ($options as $option) {
$rating_options[$rating->getData('rating_id')][] = $option->getData('option_id');
}
}

for ($y = 0; $y < $reviewCount; $y++) {
$review = Mage::getModel('review/review');
Expand Down