diff --git a/composer.json b/composer.json index 6d316d1..417f54a 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "require": { "magento/framework": "*", "hyva-themes/magento2-compat-module-fallback": "*", - "magmodules/magento2-googlereviews": "*" + "magmodules/magento2-googlereviews": "~3.0" }, "autoload": { "files": [ @@ -19,4 +19,4 @@ "Magmodules\\HyvaGoogleReviewsSR\\": "src/" } } - } \ No newline at end of file + } diff --git a/src/view/frontend/tailwind/tailwind.config.js b/src/view/frontend/tailwind/tailwind.config.js new file mode 100644 index 0000000..f44ed37 --- /dev/null +++ b/src/view/frontend/tailwind/tailwind.config.js @@ -0,0 +1,7 @@ +module.exports = { + purge: { + content: [ + '../templates/**/*.phtml', + ] + } +} diff --git a/src/view/frontend/templates/widget/helper/stars.phtml b/src/view/frontend/templates/widget/helper/stars.phtml new file mode 100644 index 0000000..267f53f --- /dev/null +++ b/src/view/frontend/templates/widget/helper/stars.phtml @@ -0,0 +1,58 @@ +hasData('svgSize') ? $block->getData('svgSize') : '20'; +$starColor = $block->hasData('starColor') ? $block->getData('starColor') : ''; + +$svgSizeStyle = 'width: ' . $svgSize . 'px; height: ' . $svgSize . 'px; '; +$starColorStyle = $starColor ? 'color: ' . $starColor : ''; + +$percent = $block->hasData('percent') ? $block->getData('percent') . '%' : '0%'; +?> + +
+
+ +
+ + + + + +
+
+ +
+ + + + + +
+
diff --git a/src/view/frontend/templates/widget/review/badge.phtml b/src/view/frontend/templates/widget/review/badge.phtml new file mode 100644 index 0000000..3526412 --- /dev/null +++ b/src/view/frontend/templates/widget/review/badge.phtml @@ -0,0 +1,173 @@ +getViewFileUrl('Magmodules_GoogleReviewsSR::images/logo-big.png'); +$logoSmall = $block->getViewFileUrl('Magmodules_GoogleReviewsSR::images/logo-small.png'); + +$reviewsCount = $block->getReviewsCount(); +$reviewsCurrentRating = $block->getReviewsCurrentRating(); +$reviewsMaxRating = $block->getReviewsMaxRating(); +?> + +
+
+ + showLogo() || $block->showStars()): ?> +
+ + showLogo()): ?> + <?= $block->escapeHtml(__('Google badge widget')); ?> + + + showStars()): ?> + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_HyvaGoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '20') + ->setData('percent', $reviewsCurrentRating / $reviewsMaxRating * 100) + ->toHtml(); + ?> + +
+ + +
+
+ escapeHtml($reviewsCurrentRating); ?> + escapeHtml(__('based on')); ?> + + escapeHtml($reviewsCount); ?> + 1 + ? $block->escapeHtml(__('reviews')) + : $block->escapeHtml(__('review')); ?> + +
+ + showReviewLink()): ?> + + + + + + +
+
+ + showReviewLink()): ?> + + + + +
+ + diff --git a/src/view/frontend/templates/widget/review/carousel.phtml b/src/view/frontend/templates/widget/review/carousel.phtml new file mode 100644 index 0000000..41e33fb --- /dev/null +++ b/src/view/frontend/templates/widget/review/carousel.phtml @@ -0,0 +1,222 @@ +getViewFileUrl('Magmodules_GoogleReviewsSR::images/logo-small.png'); + +$reviewsMaxRating = $block->getReviewsMaxRating(); + +if ($block->getTextLength() == 'small') $txtLen = 2; +if ($block->getTextLength() == 'medium') $txtLen = 4; +if ($block->getTextLength() == 'large') $txtLen = 6; +?> + +
+ +
+ +
+ +
+ + getReviews() as $review): ?> +
+
+ +
+ escapeHtml($review['name']) ?> + + showStars()): ?> + getSelectColor() ? $block->getSelectColor() : '#000000'; + ?> + + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '16') + ->setData('starColor', $starColor) + ->setData('percent', floatval($review['total']) / $reviewsMaxRating * 100) + ->toHtml(); + ?> + +
+ + +
+ escapeHtml($review['comment']) ?> +
+ + +
+ + showIcon()): ?> + <?= $block->escapeHtml(__('Google carousel widget')); ?> + + + + escapeHtml(__('A Google Review written')); ?> + escapeHtml($review['created']) ?> + +
+
+
+ + +
+
+ + +
+
+ + diff --git a/src/view/frontend/templates/widget/review/floating.phtml b/src/view/frontend/templates/widget/review/floating.phtml new file mode 100644 index 0000000..4ecc026 --- /dev/null +++ b/src/view/frontend/templates/widget/review/floating.phtml @@ -0,0 +1,176 @@ +getViewFileUrl('Magmodules_GoogleReviewsSR::images/logo-small.png'); + +$reviewsCount = $block->getReviewsCount(); +$reviewsCurrentRating = $block->getReviewsCurrentRating(); +$reviewsMaxRating = $block->getReviewsMaxRating(); + +if ($block->getWidgetPosition() == 'top_right') $floatingClass = 'top-4 right-4'; +if ($block->getWidgetPosition() == 'top_left') $floatingClass = 'top-4 left-4'; +if ($block->getWidgetPosition() == 'bottom_right') $floatingClass = 'bottom-4 right-4'; +if ($block->getWidgetPosition() == 'bottom_left') $floatingClass = 'bottom-4 left-4'; +?> + +
+
+ + showGoogleIcon()): ?> + <?= $block->escapeHtml(__('Google floating widget')); ?> + + + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '18') + ->setData('percent', $reviewsCurrentRating / $reviewsMaxRating * 100) + ->toHtml(); + ?> + +
+ + escapeHtml($reviewsCount); ?> + 1 + ? $block->escapeHtml(__('reviews')) + : $block->escapeHtml(__('review')); ?> + + + showReviewLink()): ?> + + + + + + +
+
+ + showReviewLink()): ?> + + + + +
+ + + + diff --git a/src/view/frontend/templates/widget/review/overview.phtml b/src/view/frontend/templates/widget/review/overview.phtml new file mode 100644 index 0000000..0ab3c0a --- /dev/null +++ b/src/view/frontend/templates/widget/review/overview.phtml @@ -0,0 +1,375 @@ +getViewFileUrl('Magmodules_GoogleReviewsSR::images/logo-big.png'); + +$reviewsCount = $block->getReviewsCount(); +$reviewsCurrentRating = $block->getReviewsCurrentRating(); +$reviewsMaxRating = $block->getReviewsMaxRating(); + +$extraClass = !$block->showSummaryBlock() && + !$block->showRatingFilter() && + !$block->showWriteReviewButton() ? '!grid-cols-1' : ''; + +$reviewsPerStars = $block->getReviewsPerStars(); +$starsItem = ['5', '4', '3', '2', '1']; +?> + +
+ + showSummaryBlock() || $block->showRatingFilter() || $block->showWriteReviewButton()): ?> +
+ showSummaryBlock()): ?> +
+ +
+ <?= $block->escapeHtml(__('Google overview widget')); ?> + +
+ / + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '24') + ->setData('percent', $reviewsCurrentRating / $reviewsMaxRating * 100) + ->toHtml(); + ?> +
+
+ +
+ escapeHtml(__('Rated with a')); ?> + escapeHtml($reviewsCurrentRating); ?> + escapeHtml(__('out of a')); ?> + escapeHtml($reviewsMaxRating); ?> + escapeHtml(__('based on')); ?> + + escapeHtml($reviewsCount); ?> + 1 + ? $block->escapeHtml(__('reviews')) + : $block->escapeHtml(__('review')); ?> + +
+ +
+ +
+ + +
+
+
+ + +
+ +
+ + showFirstAndLast()): ?> +
+ escapeHtml(__('First Review')); ?> + getFirstDate() ?> + + escapeHtml(__('and last Review')); ?> + getLastDate() ?> +
+ +
+ + + showRatingFilter()): ?> +
+ +

+ escapeHtml(__('Filter on Rating')); ?> +

+
+ 0; $index--): ?> +
+ getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '20') + ->setData('percent', $index * 20) + ->toHtml(); + ?> +
+ + +
+ escapeHtml(__('Clear Filter')); ?> +
+
+
+ + + showWriteReviewButton()): ?> + + escapeHtml(__('Write a Review')); ?> + + +
+ + +
+ showSortingOption()): ?> +
+ + + + escapeHtml(__('Newest')); ?> + + + escapeHtml(__('Oldest')); ?> + + + escapeHtml(__('Lowest')); ?> + + + escapeHtml(__('Highest')); ?> + +
+ + +
+ +
+ +
+ Test test +
+ + 02 Nov 2023 + + + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '20') + ->setData('percent', 60) + ->toHtml(); + ?> +
+
+ +
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Reprehenderit, alias. Sed doloribus nulla + commodi animi voluptas, eum qui + dolorem exercitationem perspiciatis delectus eveniet provident officia accusamus. + Aut numquam repudiandae perferendis? +
+
+ + getReviews() as $index=>$review): ?> +
+ +
+ escapeHtml($review['name']) ?> +
+ + escapeHtml($review['created']) ?> + + + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '20') + ->setData('percent', floatval($review['total']) / $reviewsMaxRating * 100) + ->toHtml(); + ?> +
+
+ +
escapeHtml($review['comment']) ?>
+
+ + +
+ +
+ Test test 2 +
+ + 13 Jan 2018 + + + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '20') + ->setData('percent', 20) + ->toHtml(); + ?> +
+
+ +
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Reprehenderit, alias. Sed doloribus nulla + commodi animi voluptas, eum qui + dolorem exercitationem perspiciatis delectus eveniet provident officia accusamus. + Aut numquam repudiandae perferendis? +
+
+ + +

+ escapeHtml(__("Sorry, there's no reviews for this filter.")); ?> +

+
+
+
+ + + + diff --git a/src/view/frontend/templates/widget/review/sidebar.phtml b/src/view/frontend/templates/widget/review/sidebar.phtml new file mode 100644 index 0000000..48d8942 --- /dev/null +++ b/src/view/frontend/templates/widget/review/sidebar.phtml @@ -0,0 +1,223 @@ +getViewFileUrl('Magmodules_GoogleReviewsSR::images/logo-big.png'); + +$reviewsCount = $block->getReviewsCount(); +$reviewsCurrentRating = $block->getReviewsCurrentRating(); +$reviewsMaxRating = $block->getReviewsMaxRating(); + +if ($block->getTextLength() == 'small') $txtLen = 2; +if ($block->getTextLength() == 'medium') $txtLen = 4; +if ($block->getTextLength() == 'large') $txtLen = 6; +?> + +
+ +
+ showLogoInHeader() || $block->showStarsInHeader()): ?> +
+ + showLogoInHeader()): ?> + <?= $block->escapeHtml(__('Google sidebar widget')); ?> + + + showStarsInHeader()): ?> + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '20') + ->setData('percent', $reviewsCurrentRating / $reviewsMaxRating * 100) + ->toHtml(); + ?> + +
+ + +
+
+ escapeHtml($reviewsCurrentRating); ?> + escapeHtml(__('based on')); ?> + + escapeHtml($reviewsCount); ?> + 1 + ? $block->escapeHtml(__('reviews')) + : $block->escapeHtml(__('review')); ?> + +
+
+
+ +
+ +
+ +
+ + getReviews() as $review): ?> +
+
+
+ escapeHtml($review['name']) ?> + + showStarsPerReview()): ?> + getSelectColor() ? $block->getSelectColor() : '#000000'; + ?> + + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '16') + ->setData('starColor', $starColor) + ->setData('percent', $reviewsCurrentRating / $reviewsMaxRating * 100) + ->toHtml(); + ?> + +
+ + +
+ escapeHtml($review['comment']) ?> +
+ +
+
+ +
+
+ + +
+ +
+ + + +
+
+ + diff --git a/src/view/frontend/templates/widget/review/textual.phtml b/src/view/frontend/templates/widget/review/textual.phtml new file mode 100644 index 0000000..e48574b --- /dev/null +++ b/src/view/frontend/templates/widget/review/textual.phtml @@ -0,0 +1,44 @@ +getViewFileUrl('Magmodules_GoogleReviewsSR::images/logo-small.png'); + +$reviewsCount = $block->getReviewsCount(); +$reviewsCurrentRating = $block->getReviewsCurrentRating(); +$reviewsMaxRating = $block->getReviewsMaxRating(); +?> + +
+ showIcons()): ?> + <?= $block->escapeHtml(__('Google textual widget')); ?> + + + showStars()): ?> + getLayout() + ->createBlock('Magento\Framework\View\Element\Template') + ->setTemplate('Magmodules_GoogleReviewsSR::widget/helper/stars.phtml') + ->setData('svgSize', '20') + ->setData('percent', $reviewsCurrentRating / $reviewsMaxRating * 100) + ->toHtml(); + ?> + + +
+ escapeHtml(__('Our store is rated with a')); ?> + escapeHtml($reviewsCurrentRating); ?> + escapeHtml(__('based on')); ?> + + escapeHtml($reviewsCount); ?> + 1 + ? $block->escapeHtml(__('reviews')) + : $block->escapeHtml(__('review')); ?> + +
+