ltsecurityinc安防产品在线商城代码
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Olegnax
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_ProductReviewsSummary
|
||||
* @copyright Copyright (c) 2010-2021 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
-->
|
||||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
|
||||
<container name="root">
|
||||
<block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="Magento_Review::product/view/list.phtml" >
|
||||
<action method="setTemplate" ifconfig="olegnax_productreviewssummary/enable_all/enabled">
|
||||
<argument name='template' xsi:type='string'>Olegnax_ProductReviewsSummary::product/view/list.phtml</argument>
|
||||
</action>
|
||||
<block class="Olegnax\ProductReviewsSummary\Block\Html\ReviewSummary" name="product.review.summary" as="review_summary" template="Olegnax_ProductReviewsSummary::product/view/blocks/summary.phtml"/>
|
||||
<block class="Olegnax\ProductReviewsSummary\Block\Html\ReviewSummary" name="product.review.byrating" as="review_by_rating" template="Olegnax_ProductReviewsSummary::product/view/blocks/by-rating.phtml"/>
|
||||
<block class="Olegnax\ProductReviewsSummary\Block\Html\ReviewSummary" name="product.review.ratingsbreakdown" as="review_ratings_breakdown" template="Olegnax_ProductReviewsSummary::product/view/blocks/ratings-breakdown.phtml"/>
|
||||
<block class="Olegnax\ProductReviewsSummary\Block\Html\ReviewSummary" name="product.review.reviewbutton" as="review_review_button" template="Olegnax_ProductReviewsSummary::product/view/blocks/write-review-button.phtml"/>
|
||||
</block>
|
||||
</container>
|
||||
</layout>
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Olegnax ProductReviewsSummary
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_ProductReviewsSummary
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
|
||||
$settings = $this->helper('Olegnax\ProductReviewsSummary\Helper\Helper')->getConfig('olegnax_productreviewssummary/general');
|
||||
|
||||
$enabled = $settings['rating_bystar_rating'];
|
||||
$show_rating_percent = $settings['show_rating_percent'];
|
||||
$show_rating_count = $settings['show_rating_count'];
|
||||
$star_text = $settings['stars_text'] ?: '';
|
||||
if ($enabled):?>
|
||||
<?php if (count($block->getNumberOfRatings())): ?>
|
||||
<div class="number-of-ratings">
|
||||
<?php $countRatings = array_sum($block->getNumberOfRatings()); ?>
|
||||
<?php if (0 < $countRatings) {
|
||||
foreach ($block->getNumberOfRatings() as $_vote => $_count): ?>
|
||||
<?php $percent = round($_count * 100 / $countRatings, 1); ?>
|
||||
<div class="rating-item">
|
||||
<span class="rating-number"><span class="count"><?= $block->escapeHtml($_vote) ?></span> <span
|
||||
class="label"><?= $block->escapeHtml($star_text) ?></span></span>
|
||||
<div class="rating-result"><span style="width:<?= $block->escapeHtml($percent) ?>%"></span>
|
||||
</div>
|
||||
<div class="rating-percent"><?php if ($show_rating_percent) {
|
||||
echo $block->escapeHtml($percent) . '%';
|
||||
} ?><?php if ($show_rating_count) {
|
||||
echo '(' . $block->escapeHtml($_count) . ')';
|
||||
} ?></div>
|
||||
</div>
|
||||
<?php endforeach;
|
||||
} ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Olegnax ProductReviewsSummary
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_ProductReviewsSummary
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
$enabled = $this->helper('Olegnax\ProductReviewsSummary\Helper\Helper')->getConfig('olegnax_productreviewssummary/general/rating_breakdown');
|
||||
|
||||
if($enabled) {
|
||||
?>
|
||||
<?php if (count($block->getRatingVotes()) > 1 ): ?>
|
||||
<div class="review-ratings">
|
||||
<?php foreach ($block->getRatingVotes() as $_vote): ?>
|
||||
<div class="rating-summary item" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
|
||||
<span class="label rating-label"><span><?= $block->escapeHtml($_vote->getRatingCode()) ?></span></span>
|
||||
<div class="rating-result" title="<?= $block->escapeHtmlAttr($_vote->getPercent()) ?>%">
|
||||
<meta itemprop="worstRating" content = "1"/>
|
||||
<meta itemprop="bestRating" content = "100"/>
|
||||
<span style="width:<?= $block->escapeHtmlAttr($_vote->getPercent()) ?>%">
|
||||
<span itemprop="ratingValue"><?= $block->escapeHtml($_vote->getPercent()) ?>%</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php } ?>
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Olegnax ProductReviewsSummary
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_ProductReviewsSummary
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
|
||||
$settings = $this->helper('Olegnax\ProductReviewsSummary\Helper\Helper')->getConfig('olegnax_productreviewssummary/general');
|
||||
|
||||
$enabled = $settings['rating_overall'];
|
||||
$button = $settings['write_btn_overall'];
|
||||
if($enabled) {
|
||||
?>
|
||||
<div class="extended-review-summary">
|
||||
<div class="ratings-value"><?= number_format($block->getAverageRating(),1) ?></div>
|
||||
<div class="ratings-count">
|
||||
<span class="label"><?= $block->getReviewCount() ?> <?= $block->escapeHtml(__('Reviews')) ?></span>
|
||||
<?php $block->getRatingVotes(); ?>
|
||||
<div class="rating-result" title="<?= $block->escapeHtmlAttr($block->getPercent()) ?>%">
|
||||
<meta itemprop="worstRating" content="1">
|
||||
<meta itemprop="bestRating" content="100">
|
||||
<span style="width:<?= $block->escapeHtmlAttr($block->getPercent()) ?>%">
|
||||
<span itemprop="ratingValue"><?= $block->escapeHtmlAttr($block->getPercent()) ?>%</span>
|
||||
</span>
|
||||
</div>
|
||||
<?php if( $button ){ ?>
|
||||
<a href="#review-form" class="action write-review"><?= $block->escapeHtml(__('Write a Review')) ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Olegnax ProductReviewsSummary
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_ProductReviewsSummary
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
|
||||
$show_button = $this->helper('Olegnax\ProductReviewsSummary\Helper\Helper')->getConfig('olegnax_productreviewssummary/general/write_btn_after');
|
||||
if($show_button) :
|
||||
?>
|
||||
<div class="extended-review-button">
|
||||
<a href="#review-form" class="action primary"><span><?= $block->escapeHtml(__('Write a Review')) ?></span></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* Olegnax ProductReviewsSummary
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_ProductReviewsSummary
|
||||
* @copyright Copyright (c) 2023 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
|
||||
// @codingStandardsIgnoreFile
|
||||
|
||||
/** @var Magento\Review\Block\Product\View\ListView $block */
|
||||
/** @var SecureHtmlRenderer $secureRenderer */
|
||||
|
||||
use Magento\Framework\View\Helper\SecureHtmlRenderer;
|
||||
|
||||
$_items = $block->getReviewsCollection()->getItems();
|
||||
$format = $block->getDateFormat() ?: \IntlDateFormatter::SHORT;
|
||||
|
||||
$settings = $this->helper('Olegnax\ProductReviewsSummary\Helper\Helper')->getConfig('olegnax_productreviewssummary/general');
|
||||
$summaryBlocksCount = 0;
|
||||
$summaryBlocksCount += $settings['rating_bystar_rating'];
|
||||
$summaryBlocksCount += $settings['rating_overall'];
|
||||
$summaryBlocksCount += $settings['write_btn_after'];
|
||||
$summaryBlocksCount += $settings['rating_breakdown'];
|
||||
?>
|
||||
<?php if (count($_items)):?>
|
||||
<div class="block review-list" id="customer-reviews">
|
||||
<div class="block-title">
|
||||
<strong><?= $block->escapeHtml(__('Customer Reviews')) ?></strong>
|
||||
</div>
|
||||
<div class="block-content">
|
||||
<div class="extended-review-summary-wrapper columns-<?= $summaryBlocksCount ?>">
|
||||
<?= $block->getChildHtml('review_summary'); ?>
|
||||
<?= $block->getChildHtml('review_by_rating'); ?>
|
||||
<?= $block->getChildHtml('review_ratings_breakdown'); ?>
|
||||
<?= $block->getChildHtml('review_review_button'); ?>
|
||||
</div>
|
||||
<div class="toolbar review-toolbar">
|
||||
<?= $block->getChildHtml('toolbar') ?>
|
||||
</div>
|
||||
<ol class="items review-items">
|
||||
<?php foreach ($_items as $_review):?>
|
||||
<li class="item review-item" itemscope itemprop="review" itemtype="http://schema.org/Review">
|
||||
<div class="review-title" itemprop="name"><?= $block->escapeHtml($_review->getTitle()) ?></div>
|
||||
<?php if (count($_review->getRatingVotes())): ?>
|
||||
<div class="review-ratings">
|
||||
<?php foreach ($_review->getRatingVotes() as $_vote): ?>
|
||||
<div class="rating-summary item" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
|
||||
<span class="label rating-label"><span><?= $block->escapeHtml($_vote->getRatingCode()) ?></span></span>
|
||||
<div class="rating-result"
|
||||
id="review_<?= /* @noEscape */ $_review->getReviewId()
|
||||
?>_vote_<?= /* @noEscape */ $_vote->getVoteId() ?>"
|
||||
title="<?= $block->escapeHtmlAttr($_vote->getPercent()) ?>%">
|
||||
<meta itemprop="worstRating" content = "1"/>
|
||||
<meta itemprop="bestRating" content = "100"/>
|
||||
<span>
|
||||
<span itemprop="ratingValue"><?= $block->escapeHtml($_vote->getPercent()) ?>%</span>
|
||||
</span>
|
||||
</div>
|
||||
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
|
||||
'width:' . $_vote->getPercent() . '%',
|
||||
'div#review_' . $_review->getReviewId() . '_vote_' . $_vote->getVoteId() . ' span'
|
||||
) ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="review-content" itemprop="description">
|
||||
<?= nl2br($block->escapeHtml($_review->getDetail())) ?>
|
||||
</div>
|
||||
<div class="review-details">
|
||||
<p class="review-author">
|
||||
<span class="review-details-label"><?= $block->escapeHtml(__('Review by')) ?></span>
|
||||
<strong class="review-details-value" itemprop="author"><?= $block->escapeHtml($_review->getNickname()) ?></strong>
|
||||
</p>
|
||||
<p class="review-date">
|
||||
<span class="review-details-label"><?= $block->escapeHtml(__('Posted on')) ?></span>
|
||||
<time class="review-details-value" itemprop="datePublished" datetime="<?= $block->escapeHtmlAttr($block->formatDate($_review->getCreatedAt(), $format)) ?>"><?= $block->escapeHtml($block->formatDate($_review->getCreatedAt(), $format)) ?></time>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<div class="toolbar review-toolbar">
|
||||
<?= $block->getChildHtml('toolbar') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
& when (@media-common = true) {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user