Плагин Отзывы в теме Дизайн со вкусом 2
Открыть настройки плагина.
Возле последней настройки (шаблон) нажать редактировать и поменять код шаблона на такой:
{if !waRequest::isXMLHttpRequest() && waRequest::method() != 'post'}{literal} <style type="text/css"> .reviews hr {margin-top: 10px; margin-bottom: 0} .reviews > .reviews-branch { margin-top: 20px} .reviews ul.reviews-branch { list-style: none} .reviews > ul.reviews-branch > li {padding-top: 10px} .reviews > ul.reviews-branch > li:nth-child(odd) { background: #F3F3F6;} .reviews .review ul.menu-v { padding-left: 60px} .reviews .review ul.menu-v li a { display: inline; padding: 0;} .reviews .review ul.reviews-branch li {border-bottom: 0; background-color: #FFF7CC; border: 1px solid #F1E5CF; padding: 15px} .reviews .review img.userpic { margin-right: 10px} a.no-underline {text-decoration: none} </style> {/literal}{/if} <div class="reviews"> <a name="reviewheader"></a> <!-- add review form --> <h4 class="write-review"> <a href="#" class="inline-link">{_w('Write a review')}</a> </h4> <div class="review-form" id="review-form" style="float:left; width: 100%; max-width: 100%;{if $reviews_count > 0}display:none;{/if}"> <form id="review-add-form" method="post" enctype="multipart/form-data"> <div class="review-form-fields"> {if !$wa->user()->isAuth() && $require_authorization} <p class="review-field">{sprintf(_w('To add a review please sign up or login'), $wa->signupUrl(), $wa->loginUrl())}</p> {else} {if $wa->user()->isAuth()} <p class="review-field"> <strong><img src="{$wa->user()->getPhoto(20)}" class="userpic" alt=""> {$wa->user('name')}</strong> <a href="?logout">{_w('log out')}</a> </p> {else} <div class="provider-fields"> <p class="form-group review-field"> <label>{_w('Your name')}</label> <input class="form-control" {if !empty($errors.name)}class="error"{/if} type="text" name="name" id="review-name" value="{$wa->post('name', '')|escape}"> {if !empty($errors.name)}<em class="errormsg">{$errors.name}</em>{/if} </p> <p class="form-group review-field"> <label>[`Email`]</label> <input class="form-control" {if !empty($errors.email)}class="error"{/if} type="text" name="email" id="review-email" value="{$wa->post('email', '')|escape}"> {if !empty($errors.email)}<em class="errormsg">{$errors.email}</em>{/if} </p> {if !empty($reviews_settings.enable_photo_upload)} <p class="form-group review-field"> <label>[s`Photo`]</label> <input class="form-control" type="file" name="image" accept="image/gif,image/jpeg,image/png"> </p> {/if} </div> {/if} {if !empty($enable_rating)} <p class="review-field"> <label>Оценка</label> <a href="#" class="no-underline rate" data-rate="0" id="review-rate"> {$wa->shop->ratingHtml(0, 16, true)} </a> <a href="javascript:void(0);" class="inline-link rate-clear" id="clear-review-rate" style="display: none;">очистить</a> <input name="rating" type="hidden" value="0"> </p> {/if} <p class="form-group review-field"> <label for="review-text">{_w('Review')}</label> <textarea class="form-control" id="review-text" name="text" rows="10" cols="45"></textarea> </p> <div class="review-submit"> {if $require_captcha && !$wa->user()->isAuth()} {$wa->captcha([], ifset($errors.captcha))} {/if} <input type="submit" class="save btn-blue btn-simple" value="{_w('Add review')}"> <span class="review-add-form-status ajax-status" style="display: none;"> <i class="icon16 loading"><!--icon --></i> </span> </div> {/if} </div> </form> </div> <div class="clearfix"></div> <ul class="{if $wa->param('theme') != 'default'}menu-v{/if} with-icons reviews-branch list-unstyled"> {foreach $reviews as $review} <li> <div class="review" itemprop="review" itemscope itemtype="http://schema.org/Review"> {if $review.contact_id && $review.contact_photo} <img width="50" src="{waContact::getPhotoUrl($review.contact_id, $review.contact_photo, 50)}" class="userpic" alt="" align="left"> {elseif $review.image} <img width="50" src="{$wa_url}wa-data/public/shop/reviews/{$review.id}{$review.image}" class="userpic" alt="" align="left"> {elseif !empty($reviews_settings.empty_photo)} <img width="50" src="{$wa_url}wa-content/img/userpic50.jpg" class="userpic" alt="пропо" align="left"> {/if} <div class="summary"> <span class="username" itemprop="author"> <b>{$review.name}</b> </span> <meta itemprop="datePublished" content="{$review.datetime|date_format:'Y-m-d'}"> <span class="date" title="{$review.datetime|wa_datetime}">{$review.datetime|wa_datetime:"humandatetime"}</span> {if !empty($enable_rating) && !empty($review.rating)} <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> <meta itemprop="worstRating" content = "1"> <meta itemprop="ratingValue" content="{$review.rating}"> <meta itemprop="bestRating" content = "5"> {$wa->shop->ratingHtml($review.rating)} </span> {/if} </div> {if $review.text} <div itemprop="description">{$review.text}</div> {/if} {if $review.response} <br clear="left"> <ul class="{if $wa->param('theme') != 'default'}menu-v{/if} with-icons reviews-branch"> <li> <div class="review"> <div class="summary"> <span class="username"><b>[`Response`]:</b></span> </div> <div>{$review.response}</div> </div> </li> </ul> {/if} </div> <div class="clearfix"></div> {if !$review@last}<hr>{/if} </li> {/foreach} </ul> {wa_pagination total=$pages_count attrs=['class' => "menu-h"] url="{$wa->getUrl('/frontend/reviews')}"} </div> {if !waRequest::isXMLHttpRequest() && waRequest::method() != 'post'} <script type="text/javascript"> $(function () { $(".reviews").on('click', ".write-review a", function () { $("#review-form").show(); $("#review-form input:first").focus(); return false; }); $(".reviews").on('submit', "#review-add-form", function () { $(".review-add-form-status").show(); var f = function (response) { $(".review-add-form-status").hide(); if (response.status == 'ok') { var tmp = $('<div></div>').append(response.data); $(".reviews").html(tmp.find('.reviews').html()); {if !empty($enable_rating)} $('#review-rate').rateWidget({ onUpdate: function(rate) { $('#review-add-form input[name="rating"]').val(rate);}}); {/if} } else if (response.status == 'fail') { $(".reviews em.errormsg").remove(); $(".reviews .error").removeClass('error'); for (var k in response.errors) { if (k == 'captcha') { var el = $(".wa-captcha-input"); } else { var el = $("#review-" + k); } el.addClass('error'); if (!el.next().is('em.errormsg')) { $('<em class="errormsg"></em>').insertAfter(el); } el.next().html(response.errors[k]); } } } if ($(this).find('input:file').length) { if (!$('#reviews-add-iframe').length) { $('<iframe name="reviews-add-iframe" id="reviews-add-iframe" style="display: none"></iframe>').insertAfter($(this)); } $(this).attr('target', 'reviews-add-iframe'); $("#reviews-add-iframe").one('load', function () { try { var data = $(this).contents().find('body').text(); var response = $.parseJSON(data); } catch (e) { return; } f(response); }); return true; } else { $.post("?", $(this).serialize(), f, "json"); } return false; }); }); </script> {/if} {if !empty($enable_rating)} <script type="text/javascript"> $(function () { $.getScript("{$wa_app_static_url}js/rate.widget.js", function () { $('#review-rate').rateWidget({ onUpdate: function(rate) { $('#review-add-form input[name="rating"]').val(rate); } }); }); }); </script> {/if}
Чтобы добавить комментарий, зарегистрируйтесь или войдите
0 комментариев