Плагин отзывы в теме Classic
В настройках плагина отредактируйте шаблон вывода на такой:
{if !waRequest::isXMLHttpRequest() && waRequest::method() != 'post'}{literal} <style type="text/css"> .reviews .review ul.menu-v li a { display: inline; padding: 0;} .reviews .review ul.reviews-branch li .reviews-branch li {border-bottom: 0} .reviews .review img.userpic { margin-right: 5px} .review-form label { width: 100px; display: block; clear: left; float: left; margin: 0 10px 0 0; color: #000; font-weight: bold; } .review-form i.icon16 { background-repeat:no-repeat; height:16px; width:16px; display:inline-block; text-indent:-9999px; text-decoration:none!important; background-image: url("/wa-apps/site/themes/default/img/icons.png"); background-size: 260px 160px /* 50% of the original size for auto @2x optimization */; } * .review-form i.icon16 { text-decoration:none!important; vertical-align:top; margin: 0.2em 0.25em 0 0; } .reviews i.icon10 { background-repeat:no-repeat; height:10px; width:10px; display:inline-block; text-indent:-9999px; text-decoration:none!important; background-image: url("/wa-apps/site/themes/default/img/icons.png"); background-size: 260px 160px; } * .reviews i.icon10 { text-decoration:none!important; vertical-align:top; margin: 0.3em 0.1em 0 0; } .review-form .icon16.star, .review-form .icon16.star-full { background-position:-16px -16px; } .review-form .icon16.star-half { background-position:-32px -16px; } .review-form .icon16.star-empty { background-position:-48px -16px; } .review-form .icon16.star-hover { background-position:-64px -16px; } .reviews .icon10.star, .reviews .icon10.star-full { background-position:0 -100px; } .reviews .icon10.star-half { background-position:-10px -100px; } .reviews .icon10.star-empty { background-position:-20px -100px; } .review .date {margin-left: 10px} </style> {/literal}{/if} <div class="reviews"> <a name="reviewheader"></a> <!-- add review form --> <h4 class="write-review"> <a href="#" class="inline-link"><b><i>{_w('Write a review')}</i></b></a> </h4> <div class="review-form" id="review-form" style="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"><label>{_w('Your name')}</label> <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="review-field"> <label>{_w('Your name')}</label> <input {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="review-field"> <label>[`Email`]</label> <input {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="review-field"> <label>[s`Photo`]</label> <input type="file" name="image" accept="image/gif,image/jpeg,image/png"> </p> {/if} </div> {/if} {if !empty($enable_rating)} <p class="review-field"> <label>[`Rating`]</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;"> {_w('clear')} </a> <input name="rating" type="hidden" value="0"> </p> {/if} <p class="review-field"> <label for="review-text">{_w('Review')}</label> <textarea 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" 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> <br> <ul class="{if $wa->param('theme') != 'default'}menu-v{/if} with-icons reviews-branch"> {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} <p itemprop="description">{$review.text}</p> {/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"> {if !empty($enable_response_info) && !empty($review.response_contact)} <b>{$review.response_contact.firstname}</b> {else} <b>[`Response`]</b> {/if} </span> {if !empty($enable_response_info) && !empty($review.response_datetime)} <span class="date" title="{$review.response_datetime|wa_datetime}">{$review.response_datetime|wa_datetime:"humandatetime"}</span> {/if} </div> <p>{$review.response}</p> </div> </li> </ul> {/if} </div> </li> {/foreach} </ul> {wa_pagination total=$pages_count attrs=['class' => "menu-h"] url="{$wa->getUrl('/frontend/reviews')}"} </div> {if !empty($enable_rating)} <script type="text/javascript"> jQuery(function () { jQuery.getScript("{$wa_app_static_url}js/rate.widget.js", function () { jQuery('#review-rate').rateWidget({ onUpdate: function(rate) { jQuery('#review-add-form input[name="rating"]').val(rate); } }); }); }); </script> {/if} {if !waRequest::isXMLHttpRequest() && waRequest::method() != 'post'} <script type="text/javascript"> jQuery(function () { jQuery(".reviews").on('click', ".write-review a", function () { jQuery("#review-form").show(); jQuery("#review-form input:first").focus(); return false; }); jQuery(".reviews").on('submit', "#review-add-form", function () { jQuery(".review-add-form-status").show(); var f = function (response) { jQuery(".review-add-form-status").hide(); if (response.status == 'ok') { var tmp = jQuery('<div></div>').append(response.data); jQuery(".reviews").html(tmp.find('.reviews').html()); {if !empty($enable_rating)}jQuery('#review-rate').rateWidget({ onUpdate: function(rate) { jQuery('#review-add-form input[name="rating"]').val(rate);}});{/if} } else if (response.status == 'fail') { jQuery(".reviews em.errormsg").remove(); jQuery(".reviews .error").removeClass('error'); for (var k in response.errors) { if (k == 'captcha') { var el = jQuery(".wa-captcha-input"); } else { var el = jQuery("#review-" + k); } el.addClass('error'); if (!el.next().is('em.errormsg')) { jQuery('<em class="errormsg"></em>').insertAfter(el); } el.next().html(response.errors[k]); } } }; if (jQuery(this).find('input:file').length) { if (!jQuery('#reviews-add-iframe').length) { jQuery('<iframe name="reviews-add-iframe" id="reviews-add-iframe" style="display: none"></iframe>').insertAfter(jQuery(this)); } jQuery(this).attr('target', 'reviews-add-iframe'); jQuery("#reviews-add-iframe").one('load', function () { try { var data = jQuery(this).contents().find('body').text(); var response = jQuery.parseJSON(data); } catch (e) { return; } f(response); }); return true; } else { jQuery.post("?", jQuery(this).serialize(), f, "json"); } return false; }); }); </script> {/if}
0 comments