ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/** @var Form $block */
|
||||
|
||||
use Magento\Review\Block\Form;
|
||||
|
||||
//phpcs:disable Generic.Files.LineLength
|
||||
?>
|
||||
<div class="block review-add">
|
||||
<div class="block-title"><strong><?= $block->escapeHtml(__('Write Your Own Review')) ?></strong></div>
|
||||
<div class="block-content">
|
||||
<?php if ($block->getAllowWriteReviewFlag()): ?>
|
||||
<form action="<?= $block->escapeUrl($block->getAction()) ?>" class="review-form" method="post" id="review-form" data-role="product-review-form" data-bind="scope: 'review-form'">
|
||||
<?= $block->getBlockHtml('formkey') ?>
|
||||
<?= $block->getChildHtml('form_fields_before') ?>
|
||||
<fieldset class="fieldset review-fieldset" data-hasrequired="<?= $block->escapeHtmlAttr(__('* Required Fields')) ?>">
|
||||
<legend class="legend review-legend"><span><?= $block->escapeHtml(__("Write a Review")) ?></span><strong><?= $block->escapeHtml($block->getProductInfo()->getName()) ?></strong></legend>
|
||||
<?php if ($block->getRatings() && $block->getRatings()->getSize()): ?>
|
||||
<span id="input-message-box"></span>
|
||||
<fieldset class="field required review-field-ratings">
|
||||
<div class="control">
|
||||
<div class="nested" id="product-review-table">
|
||||
<?php foreach ($block->getRatings() as $_rating): ?>
|
||||
<div class="field choice review-field-rating">
|
||||
<label class="label" id="<?= $block->escapeHtml($_rating->getRatingCode()) ?>_rating_label"><span><?= $block->escapeHtml($_rating->getRatingCode()) ?></span></label>
|
||||
<div class="control review-control-vote">
|
||||
<?php $options = $_rating->getOptions();?>
|
||||
<?php $iterator = 1; foreach ($options as $_option): ?>
|
||||
<input
|
||||
type="radio"
|
||||
name="ratings[<?= $block->escapeHtmlAttr($_rating->getId()) ?>]"
|
||||
id="<?= $block->escapeHtmlAttr(str_replace(' ', '_', $_rating->getRatingCode())) ?>_<?= $block->escapeHtmlAttr($_option->getValue()) ?>"
|
||||
value="<?= $block->escapeHtmlAttr($_option->getId()) ?>"
|
||||
class="radio"
|
||||
data-validate="{ 'rating-required':true}"
|
||||
aria-labelledby="<?= $block->escapeHtmlAttr(str_replace(' ', '_', $_rating->getRatingCode())) ?>_rating_label <?= $block->escapeHtmlAttr(str_replace(' ', '_', $_rating->getRatingCode())) ?>_<?= $block->escapeHtmlAttr($_option->getValue()) ?>_label" />
|
||||
<label
|
||||
class="rating-<?= $block->escapeHtmlAttr($iterator) ?>"
|
||||
for="<?= $block->escapeHtmlAttr(str_replace(' ', '_', $_rating->getRatingCode())) ?>_<?= $block->escapeHtmlAttr($_option->getValue()) ?>"
|
||||
title="<?= $block->escapeHtmlAttr(__('%1 %2', $iterator, $iterator > 1 ? __('stars') : __('star'))) ?>"
|
||||
id="<?= $block->escapeHtmlAttr(str_replace(' ', '_', $_rating->getRatingCode())) ?>_<?= $block->escapeHtmlAttr($_option->getValue()) ?>_label">
|
||||
<span><?= $block->escapeHtml(__('%1 %2', $iterator, $iterator > 1 ? __('stars') : __('star'))) ?></span>
|
||||
</label>
|
||||
<?php $iterator++; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<input type="hidden" name="validate_rating" class="validate-rating" value="" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php endif ?>
|
||||
<div class="review-fields-wrapper">
|
||||
<div class="field review-field-nickname required">
|
||||
<label for="nickname_field" class="label"><span><?= $block->escapeHtml(__('Nickname')) ?></span></label>
|
||||
<div class="control">
|
||||
<input type="text" name="nickname" id="nickname_field" class="input-text" data-validate="{required:true}" data-bind="value: nickname()" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field review-field-summary required">
|
||||
<label for="summary_field" class="label"><span><?= $block->escapeHtml(__('Summary')) ?></span></label>
|
||||
<div class="control">
|
||||
<input type="text" name="title" id="summary_field" class="input-text" data-validate="{required:true}" data-bind="value: review().title" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field review-field-text required">
|
||||
<label for="review_field" class="label"><span><?= $block->escapeHtml(__('Review')) ?></span></label>
|
||||
<div class="control">
|
||||
<textarea name="detail" id="review_field" cols="5" rows="3" data-validate="{required:true}" data-bind="value: review().detail"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ox-add-fields -->
|
||||
<div class="actions-toolbar review-form-actions">
|
||||
<div class="primary actions-primary">
|
||||
<button type="submit" class="action submit primary"><span><?= $block->escapeHtml(__('Submit Review')) ?></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"[data-role=product-review-form]": {
|
||||
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
|
||||
},
|
||||
"#review-form": {
|
||||
"Magento_Review/js/error-placement": {},
|
||||
"Magento_Review/js/validate-review": {},
|
||||
"Magento_Review/js/submit-review": {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php else: ?>
|
||||
<div class="message info notlogged" id="review-form">
|
||||
<div>
|
||||
<?= $block->escapeHtml(__('Only registered users can write reviews. Please <a href="%1">Sign in</a> or <a href="%2">create an account</a>', $block->getLoginLink(), $block->getRegisterUrl()), ['a']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Escaper;
|
||||
use Magento\Framework\View\Helper\SecureHtmlRenderer;
|
||||
use Magento\Review\Block\Product\View\ListView;
|
||||
|
||||
/**
|
||||
* @var ListView $block
|
||||
* @var SecureHtmlRenderer $secureRenderer
|
||||
* @var Escaper $escaper
|
||||
*/
|
||||
|
||||
$_items = $block->getReviewsCollection()->getItems();
|
||||
$format = $block->getDateFormat() ?: \IntlDateFormatter::SHORT;
|
||||
?>
|
||||
<?php if (count($_items)):?>
|
||||
<div class="block review-list" id="customer-reviews">
|
||||
<div class="block-title">
|
||||
<strong><?= $escaper->escapeHtml(__('Customer Reviews')) ?></strong>
|
||||
</div>
|
||||
<div class="block-content">
|
||||
<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-content-left">
|
||||
<div class="review-details">
|
||||
<p class="review-author">
|
||||
<span class="review-details-label"><?= $escaper->escapeHtml(__('Review by')) ?></span>
|
||||
<strong class="review-details-value" itemprop="author"><?= $escaper->escapeHtml($_review->getNickname()) ?></strong>
|
||||
</p>
|
||||
<p class="review-date">
|
||||
<span class="review-details-label"><?= $escaper->escapeHtml(__('Posted on')) ?></span>
|
||||
<time class="review-details-value" itemprop="datePublished" datetime="<?= $escaper->escapeHtmlAttr($block->formatDate($_review->getCreatedAt(), $format)) ?>"><?= $block->escapeHtml($block->formatDate($_review->getCreatedAt(), $format)) ?></time>
|
||||
</p>
|
||||
</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><?= $escaper->escapeHtml($_vote->getRatingCode()) ?></span>
|
||||
</span>
|
||||
<div class="rating-result"
|
||||
id="review_<?= /* @noEscape */ $_review->getReviewId()
|
||||
?>_vote_<?= /* @noEscape */ $_vote->getVoteId() ?>"
|
||||
title="<?= $escaper->escapeHtmlAttr($_vote->getPercent()) ?>%">
|
||||
<meta itemprop="worstRating" content = "1"/>
|
||||
<meta itemprop="bestRating" content = "100"/>
|
||||
<span>
|
||||
<span itemprop="ratingValue"><?= $escaper->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>
|
||||
<div class="review-content-right">
|
||||
<div class="review-title" itemprop="name"><?= $escaper->escapeHtml($_review->getTitle()) ?></div>
|
||||
<div class="review-content" itemprop="description">
|
||||
<?= nl2br($escaper->escapeHtml($_review->getDetail())) ?>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<div class="toolbar review-toolbar">
|
||||
<?= $block->getChildHtml('toolbar') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
Reference in New Issue
Block a user