diff --git a/modules/productcomments/js/jquery.rating.pack.js b/modules/productcomments/js/jquery.rating.pack.js deleted file mode 100644 index 4921db739..000000000 --- a/modules/productcomments/js/jquery.rating.pack.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - ### jQuery Star Rating Plugin v2.0 - 2008-03-12 ### - By Diego A, http://www.fyneworks.com, diego@fyneworks.com - - v2 by Keith Wood, kbwood@virginbroadband.com.au - - Project: http://plugins.jquery.com/project/MultipleFriendlyStarRating - Website: http://www.fyneworks.com/jquery/star-rating/ - - This is a modified version of the star rating plugin from: - http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/ -*/ -eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';4(w)(3($){$.Y.T=3(c){c=$.15({m:\'X U\',E:\'\',B:z,8:z},c||{});o d={};o e={t:3(n,a,b){2.6(n);$(a).D(\'.j\').A().l(b||\'x\')},6:3(n){$(d[n].7).O(\'.j\').u(\'9\').u(\'x\')},h:3(n){4(!$(d[n].5).Z(\'.m\')){$(d[n].5).D(\'.j\').A().l(\'9\')}},g:3(n,a){d[n].5=a;o b=$(a).L(\'a\').K();$(d[n].7).J(b);e.6(n);e.h(n);4(c.I)c.I.W(d[n].7,[b,a])}};2.V(3(i){o n=2.G;4(!d[n])d[n]={r:0};i=d[n].r;d[n].r++;4(i==0){c.8=$(2).S(\'p\')||c.8;d[n].7=$(\'\');$(2).C(d[n].7);4(c.8||c.B){}F{$(2).C($(\'\'+c.E+\'\').H(3(){e.6(n);$(2).l(\'9\')}).v(3(){e.h(n);$(2).u(\'9\')}).g(3(){e.g(n,2)}))}};f=$(\'\'+2.q+\'\');$(2).N(f);4(c.8){$(f).l(\'M\')}F{$(f).H(3(){e.6(n);e.t(n,2)}).v(3(){e.6(n);e.h(n)}).g(3(){e.g(n,2)})};4(2.14)d[n].5=f;$(2).13();4(i+1==2.12)e.h(n)});11(n 10 d)4(d[n].5){e.t(n,d[n].5,\'9\');$(d[n].7).J($(d[n].5).L(\'a\').K())}16 2}})(w);',62,69,'||this|function|if|currentElem|drain|valueElem|readOnly|star_on||||||eStar|click|reset||star|div|addClass|cancel||var|disabled|value|count|title|fill|removeClass|mouseout|jQuery|star_hover|class|false|andSelf|required|before|prevAll|cancelValue|else|name|mouseover|callback|val|text|children|star_readonly|after|siblings|hidden|type|input|attr|rating|Rating|each|apply|Cancel|fn|is|in|for|length|remove|checked|extend|return'.split('|'),0,{})); \ No newline at end of file diff --git a/modules/productcomments/js/productcomments.js b/modules/productcomments/js/productcomments.js index 0f81eeb0f..bf1712ce9 100644 --- a/modules/productcomments/js/productcomments.js +++ b/modules/productcomments/js/productcomments.js @@ -23,9 +23,17 @@ * International Registered Trademark & Property of PrestaShop SA */ $(document).ready(function(){ - $('input.star').rating(); - $('.auto-submit-star').rating(); - + $('.raty_star').raty({ + starType : 'i', + starOff: 'icon-star-o', + starOn: 'icon-star', + halfShow: false, + score: 3, + hints: null, + readOnly: function() { + return $(this).hasClass('readonly'); + } + }); $('#new_comment_tab_btn').on('click', function(e){ e.preventDefault(); $('.new_comment_form_outer').show(); diff --git a/modules/productcomments/lib/index.php b/modules/productcomments/lib/index.php new file mode 100644 index 000000000..051e0122d --- /dev/null +++ b/modules/productcomments/lib/index.php @@ -0,0 +1,29 @@ + +* @copyright 2010-2021 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; diff --git a/modules/productcomments/lib/jquery.raty.js b/modules/productcomments/lib/jquery.raty.js new file mode 100644 index 000000000..5b987772d --- /dev/null +++ b/modules/productcomments/lib/jquery.raty.js @@ -0,0 +1,770 @@ +/*! + * Raty - A Star Rating Plugin + * + * The MIT License + * + * author: Washington Botelho + * github: wbotelhos/raty + * version: 3.0.0 + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + module.exports = factory(require('jquery')); + } else { + factory(root.jQuery); + } +}(this, function($) { + 'use strict'; + + $.raty = { + cancelButton: false, + cancelClass: 'raty-cancel', + cancelHint: 'Cancel this rating!', + cancelOff: 'cancel-off.png', + cancelOn: 'cancel-on.png', + cancelPlace: 'left', + click: undefined, + half: false, + halfShow: true, + hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'], + iconRange: undefined, + mouseout: undefined, + mouseover: undefined, + noRatedMsg: 'Not rated yet!', + number: 5, + numberMax: 20, + path: undefined, + precision: false, + readOnly: false, + round: { down: 0.25, full: 0.6, up: 0.76 }, + score: undefined, + scoreName: 'score', + single: false, + space: true, + starHalf: 'star-half.png', + starOff: 'star-off.png', + starOn: 'star-on.png', + starType: 'img', + target: undefined, + targetFormat: '{score}', + targetKeep: false, + targetScore: undefined, + targetText: '', + targetType: 'hint' + }; + + $.fn.raty = function(options) { + return this.each(function() { + var instance = new $.raty.Raty(this, options); + + return instance._create(); + }); + }; + + $.raty.Raty = (function() { + var Raty = function(element, options) { + this.element = element; + this.self = $(element); + this.opt = $.extend(true, {}, $.raty, options, this.self.data()); + }; + + Raty.prototype = { + _create: function() { + this._executeCallbacks(); + this._adjustNumber(); + this._adjustHints(); + + this.opt.score = this._adjustedScore(this.opt.score); + + if (this.opt.starType !== 'img') { + this._adjustStarName(); + } + + this._setPath(); + this._createStars(); + + if (this.opt.cancelButton) { + this._createCancel(); + } + + if (this.opt.precision) { + this._adjustPrecision(); + } + + this._createScore(); + + this._apply(this.opt.score); + this._setTitle(this.opt.score); + this._target(this.opt.score); + + if (this.opt.readOnly) { + this._lock(); + } else { + this.element.style.cursor = 'pointer'; + + this._binds(); + } + + this.self.data('raty', this); + }, + + // TODO: model spec + _adjustedScore: function(score) { + if (score || score === 0) { + return this._between(score, 0, this.opt.number); + } + }, + + _adjustHints: function() { + if (!this.opt.hints) { + this.opt.hints = []; + } + + if (!this.opt.halfShow && !this.opt.half) { + return; + } + + var steps = this.opt.precision ? 10 : 2; + + for (var i = 0; i < this.opt.number; i++) { + var group = this.opt.hints[i]; + + if (Object.prototype.toString.call(group) !== '[object Array]') { + group = [group]; + } + + this.opt.hints[i] = []; + + for (var j = 0; j < steps; j++) { + var hint = group[j]; + var last = group[group.length - 1]; + + if (last === undefined) { + last = null; + } + + this.opt.hints[i][j] = hint === undefined ? last : hint; + } + } + }, + + _adjustNumber: function() { + this.opt.number = this._between(this.opt.number, 1, this.opt.numberMax); + }, + + _adjustPrecision: function() { + this.opt.half = true; + }, + + _adjustStarName: function() { + var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn']; + + this.opt.path = ''; + + for (var i = 0; i < replaces.length; i++) { + this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-'); + } + }, + + // TODO: model spec + _apply: function(score) { + this._fill(score); + + if (score) { + if (score > 0) { + this.scoreField.val(score); + } + + this._roundStars(score); + } + }, + + _attributesForIndex: function(i) { + var name = this._nameForIndex(i); + var attributes = { alt: i, src: this.opt.path + this.opt[name] }; + + if (this.opt.starType !== 'img') { + attributes = { 'data-alt': i, 'class': this.opt[name] }; + } + + attributes.title = this._getHint(i); + + return attributes; + }, + + _between: function(value, min, max) { + return Math.min(Math.max(parseFloat(value), min), max); + }, + + // TODO: model spec + _binds: function() { + if (this.cancelButton) { + this._bindOverCancel(); + this._bindClickCancel(); + this._bindOutCancel(); + } + + this._bindOver(); + this._bindClick(); + this._bindOut(); + }, + + // TODO: model spec + _bindClick: function() { + var that = this; + + this.stars.on('click.raty', function(evt) { + if (that.self.data('readonly')) { + return; + } + + var execute = true; + var score = (that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || $(this).data('alt')); + + if (that.opt.half && !that.opt.precision) { + score = that._roundHalfScore(score); + } + + if (that.opt.click) { + execute = that.opt.click.call(that.element, +score, evt); + } + + if (execute || execute === undefined) { + that._apply(+score); + } + }); + }, + + // TODO: model spec + _bindClickCancel: function() { + this.cancelButton.on('click.raty', function(evt) { + this.scoreField.removeAttr('value'); + + if (this.opt.click) { + this.opt.click.call(this.element, null, evt); + } + }.bind(this)); + }, + + // TODO: model spec + _bindOut: function() { + this.self.on('mouseleave.raty', function(evt) { + var score = +this.scoreField.val() || undefined; + + this._apply(score); + this._target(score, evt); + this._resetTitle(); + + if (this.opt.mouseout) { + this.opt.mouseout.call(this.element, score, evt); + } + }.bind(this)); + }, + + // TODO: model spec + _bindOutCancel: function() { + var that = this; + + this.cancelButton.on('mouseleave.raty', function(evt) { + var icon = that.opt.cancelOff; + + if (that.opt.starType !== 'img') { + icon = that.opt.cancelClass + ' ' + icon; + } + + that._setIcon(this, icon); + + if (that.opt.mouseout) { + var score = +that.scoreField.val() || undefined; + + that.opt.mouseout.call(that.element, score, evt); + } + }); + }, + + // TODO: model spec + _bindOver: function() { + var that = this; + var action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty'; + + this.stars.on(action, function(evt) { + var score = that._getScoreByPosition(evt, this); + + that._fill(score); + + if (that.opt.half) { + that._roundStars(score, evt); + that._setTitle(score, evt); + + that.self.data('score', score); + } + + that._target(score, evt); + + if (that.opt.mouseover) { + that.opt.mouseover.call(that.element, score, evt); + } + }); + }, + + // TODO: model spec + _bindOverCancel: function() { + var that = this; + + this.cancelButton.on('mouseover.raty', function(evt) { + if (that.self.data('readonly')) { + return; + } + + var starOff = that.opt.path + that.opt.starOff; + var icon = that.opt.cancelOn; + + if (that.opt.starType === 'img') { + that.stars.attr('src', starOff); + } else { + icon = that.opt.cancelClass + ' ' + icon; + + that.stars.attr('class', starOff); + } + + that._setIcon(this, icon); + that._target(null, evt); + + if (that.opt.mouseover) { + that.opt.mouseover.call(that.element, null); + } + }); + }, + + // TODO: model spec + _buildScoreField: function() { + return $('', { name: this.opt.scoreName, type: 'hidden' }).appendTo(this.self); + }, + + // TODO: model spec + _createCancel: function() { + var icon = this.opt.path + this.opt.cancelOff; + var button = $('<' + this.opt.starType + ' />', { title: this.opt.cancelHint, 'class': this.opt.cancelClass }); + + if (this.opt.starType === 'img') { + button.attr({ src: icon, alt: 'x' }); + } else { + // TODO: use $.data + button.attr('data-alt', 'x').addClass(icon); + } + + if (this.opt.cancelPlace === 'left') { + this.self.prepend(' ').prepend(button); + } else { + this.self.append(' ').append(button); + } + + this.cancelButton = button; + }, + + // TODO: model spec + _createScore: function() { + var score = $(this.opt.targetScore); + + this.scoreField = score.length ? score : this._buildScoreField(); + }, + + _createStars: function() { + for (var i = 1; i <= this.opt.number; i++) { + var attributes = this._attributesForIndex(i); + + $('<' + this.opt.starType + ' />', attributes).appendTo(this.element); + + if (this.opt.space && i < this.opt.number) { + this.self.append(' '); + } + } + + this.stars = this.self.children(this.opt.starType); + }, + + // TODO: model spec + _error: function(message) { + $(this).text(message); + + $.error(message); + }, + + _executeCallbacks: function() { + var options = ['number', 'readOnly', 'score', 'scoreName', 'target', 'path']; + + for (var i = 0; i < options.length; i++) { + if (typeof this.opt[options[i]] === 'function') { + var value = this.opt[options[i]].call(this.element); + + if (value) { + this.opt[options[i]] = value; + } else { + delete this.opt[options[i]]; + } + } + } + }, + + // TODO: model spec + _fill: function(score) { + var hash = 0; + + for (var i = 1; i <= this.stars.length; i++) { + var icon; + var star = this.stars[i - 1]; + var turnOn = this._turnOn(i, score); + + if (this.opt.iconRange && this.opt.iconRange.length > hash) { + var irange = this.opt.iconRange[hash]; + + icon = this._getRangeIcon(irange, turnOn); + + if (i <= irange.range) { + this._setIcon(star, icon); + } + + if (i === irange.range) { + hash++; + } + } else { + icon = this.opt[turnOn ? 'starOn' : 'starOff']; + + this._setIcon(star, icon); + } + } + }, + + _getDecimal: function(number, fractions) { + var decimal = number.toString().split('.')[1]; + var result = 0; + + if (decimal) { + result = parseInt(decimal.slice(0, fractions), 10); + + if (decimal.slice(1, 5) === '9999') { + result++; + } + } + + return result; + }, + + // TODO: model spec + _getRangeIcon: function(irange, turnOn) { + return turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff; + }, + + // TODO: model spec + _getScoreByPosition: function(evt, icon) { + var score = parseInt(icon.alt || icon.getAttribute('data-alt'), 10); + + if (this.opt.half) { + var size = this._getWidth(); + var percent = parseFloat((evt.pageX - $(icon).offset().left) / size); + + score = score - 1 + percent; + } + + return score; + }, + + // TODO: model spec + _getHint: function(score, evt) { + if (score !== 0 && !score) { + return this.opt.noRatedMsg; + } + + var decimal = this._getDecimal(score, 1); + var integer = Math.ceil(score); + var group = this.opt.hints[(integer || 1) - 1]; + var hint = group; + var set = !evt || this.isMove; + + if (this.opt.precision) { + if (set) { + decimal = decimal === 0 ? 9 : decimal - 1; + } + + hint = group[decimal]; + } else if (this.opt.halfShow || this.opt.half) { + decimal = set && decimal === 0 ? 1 : decimal > 5 ? 1 : 0; + + hint = group[decimal]; + } + + return hint === '' ? '' : hint || score; + }, + + // TODO: model spec + _getWidth: function() { + var width = this.stars[0].width || parseFloat(this.stars.eq(0).css('font-size')); + + if (!width) { + this._error('Could not get the icon width!'); + } + + return width; + }, + + // TODO: model spec + _lock: function() { + var hint = this._getHint(this.scoreField.val()); + + this.element.style.cursor = ''; + this.element.title = hint; + + this.scoreField.prop('readonly', true); + this.stars.prop('title', hint); + + if (this.cancelButton) { + this.cancelButton.hide(); + } + + this.self.data('readonly', true); + }, + + _nameForIndex: function(i) { + return this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff'; + }, + + // TODO: model spec + _resetTitle: function() { + for (var i = 0; i < this.opt.number; i++) { + this.stars[i].title = this._getHint(i + 1); + } + }, + + // TODO: model spec + _roundHalfScore: function(score) { + var integer = parseInt(score, 10); + var decimal = this._getDecimal(score, 1); + + if (decimal !== 0) { + decimal = decimal > 5 ? 1 : 0.5; + } + + return integer + decimal; + }, + + // TODO: model spec + _roundStars: function(score, evt) { + var name = this._starName(score, evt); + + if (name) { + var icon = this.opt[name]; + var star = this.stars[Math.ceil(score) - 1]; + + this._setIcon(star, icon); + } // Full down: [x.00 .. x.25] + }, + + // TODO: model spec + _setIcon: function(star, icon) { + star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon; + }, + + _setPath: function() { + this.opt.path = this.opt.path || ''; + + if (this.opt.path && this.opt.path.slice(-1)[0] !== '/') { + this.opt.path += '/'; + } + }, + + // TODO: model spec + _setTarget: function(target, score) { + if (score) { + score = this.opt.targetFormat.toString().replace('{score}', score); + } + + if (target.is(':input')) { + target.val(score); + } else { + target.html(score); + } + }, + + // TODO: model spec + _setTitle: function(score, evt) { + if (score) { + var integer = parseInt(Math.ceil(score), 10); + var star = this.stars[integer - 1]; + + star.title = this._getHint(score, evt); + } + }, + + _starName: function(score, evt) { + var decimal = +(score % 1).toFixed(2); + + if (evt || this.isMove) { + return decimal > 0.5 ? 'starOn' : 'starHalf'; + } + + if (decimal <= this.opt.round.down) { // Down: [x.00 ... x.25] + return; + } + + if (this.opt.halfShow && decimal < this.opt.round.up) { // Half: [x.26 ... x.75] + return 'starHalf'; + } + + if (decimal < this.opt.round.full) { // Off: [x.26 .. x.6] + return 'starOff'; + } + + return 'starOn'; // Up: [x.26 ...] || [x.6 ...] + }, + + // TODO: model spec + _target: function(score, evt) { + if (this.opt.target) { + var target = $(this.opt.target); + + if (!target.length) { + this._error('Target selector invalid or missing!'); + } + + var mouseover = evt && evt.type === 'mouseover'; + + if (score === undefined) { + score = this.opt.targetText; + } else if (score === null) { + score = mouseover ? this.opt.cancelHint : this.opt.targetText; + } else { + if (this.opt.targetType === 'hint') { + score = this._getHint(score, evt); + } else if (this.opt.precision) { + score = parseFloat(score).toFixed(1); + } + + var mousemove = evt && evt.type === 'mousemove'; + + if (!mouseover && !mousemove && !this.opt.targetKeep) { + score = this.opt.targetText; + } + } + + this._setTarget(target, score); + } + }, + + // TODO: model spec + _turnOn: function(i, score) { + return this.opt.single ? (i === score) : (i <= score); + }, + + // TODO: model spec + _unlock: function() { + this.element.style.cursor = 'pointer'; + this.element.removeAttribute('title'); + + this.scoreField.removeAttr('readonly'); + + this.self.data('readonly', false); + + this._resetTitle(); + + if (this.cancelButton) { + this.cancelButton.css('display', ''); + } + }, + + // TODO: model spec + cancel: function(click) { + if (this.self.data('readonly') !== true) { + this[click ? 'click' : 'score'].call(this, null); + + this.scoreField.removeAttr('value'); + } + }, + + // TODO: model spec + click: function(score) { + if (this.self.data('readonly') !== true) { + score = this._adjustedScore(score); + + this._apply(score); + + if (this.opt.click) { + this.opt.click.call(this.element, score, $.Event('click')); + } + + this._target(score); + } + }, + + // TODO: model spec + getScore: function() { + var score = []; + var value ; + + value = this.scoreField.val(); + + score.push(value ? +value : undefined); + + return (score.length > 1) ? score : score[0]; + }, + + // TODO: model spec + move: function(score) { + var integer = parseInt(score, 10); + var decimal = this._getDecimal(score, 1); + + if (integer >= this.opt.number) { + integer = this.opt.number - 1; + decimal = 10; + } + + var width = this._getWidth(); + var steps = width / 10; + var star = $(this.stars[integer]); + var percent = star.offset().left + steps * decimal; + var evt = $.Event('mousemove', { pageX: percent }); + + this.isMove = true; + + star.trigger(evt); + + this.isMove = false; + }, + + // TODO: model spec + readOnly: function(readonly) { + if (this.self.data('readonly') !== readonly) { + if (readonly) { + this.self.off('.raty').children(this.opt.starType).off('.raty'); + + this._lock(); + } else { + this._binds(); + this._unlock(); + } + + this.self.data('readonly', readonly); + } + }, + + // TODO: model spec + score: function() { + return arguments.length ? this.setScore.apply(this, arguments) : this.getScore(); + }, + + setScore: function(score) { + if (this.self.data('readonly') !== true) { + score = this._adjustedScore(score); + + this._apply(score); + this._target(score); + } + } + }; + + return Raty; + })(); +})); diff --git a/modules/productcomments/productcomments.css b/modules/productcomments/productcomments.css index 34f088823..dba2824d0 100644 --- a/modules/productcomments/productcomments.css +++ b/modules/productcomments/productcomments.css @@ -7,22 +7,15 @@ margin: 39px 0 22px; } #product_comments_block_extra .comments_note { margin-bottom: 5px; } - #product_comments_block_extra .comments_note span, - #product_comments_block_extra .star_content { + #product_comments_block_extra .comments_note span{ float: left; color: #333; } - #product_comments_block_extra .star_content { - margin-top: 1px; } - #product_comments_block_extra div.star:after { - content: "\f006"; - font-family: "FontAwesome"; - display: inline-block; - color: #777676; } - #product_comments_block_extra div.star_on:after { - content: "\f005"; - font-family: "FontAwesome"; - display: inline-block; - color: #e9ce18; } + .raty_star i[class^="icon-"] { + font-size: 22px; + color: #e9ce18; + } .raty_star i.icon-star-o { + color: #777777; + } #product_comments_block_extra .comments_advices { clear: both; } diff --git a/modules/productcomments/productcomments.php b/modules/productcomments/productcomments.php index 0ca003205..0358b060d 100644 --- a/modules/productcomments/productcomments.php +++ b/modules/productcomments/productcomments.php @@ -156,6 +156,7 @@ protected function _postProcess() $id_product_comment = (int)Tools::getValue('id_product_comment'); $comment = new ProductComment($id_product_comment); $comment->delete(); + $this->_html .= '
'.$this->l('Comment deleted').'
'; } elseif (Tools::isSubmit('submitEditCriterion')) { @@ -214,7 +215,8 @@ protected function _postProcess() elseif ($id_product_comment = (int)Tools::getValue('approveComment')) { $comment = new ProductComment($id_product_comment); - $comment->validate(); + if($comment->validate()) + $this->_html .= '
'.$this->l('Comment approved').'
'; } elseif ($id_product_comment = (int)Tools::getValue('noabuseComment')) { @@ -827,7 +829,6 @@ public function hookDisplayLeftColumnProduct($params) public function hookProductTabContent($params) { - $this->context->controller->addJS($this->_path.'js/jquery.rating.pack.js'); $this->context->controller->addJS($this->_path.'js/jquery.textareaCounter.plugin.js'); $this->context->controller->addJS($this->_path.'js/productcomments.js'); @@ -879,7 +880,7 @@ public function hookHeader() $this->page_name = Dispatcher::getInstance()->getController(); if (in_array($this->page_name, array('product', 'productscomparison'))) { - $this->context->controller->addJS($this->_path.'js/jquery.rating.pack.js'); + $this->context->controller->addJS($this->_path.'lib/jquery.raty.js'); if (in_array($this->page_name, array('productscomparison'))) { $this->context->controller->addjqueryPlugin('cluetip'); diff --git a/modules/productcomments/productcomments.tpl b/modules/productcomments/productcomments.tpl index e91211fa1..1a25f1eee 100644 --- a/modules/productcomments/productcomments.tpl +++ b/modules/productcomments/productcomments.tpl @@ -24,153 +24,16 @@ *}
- {if $comments} - {if (!$too_early AND ($is_logged OR $allow_guests))} -

- - {l s='Make a review' mod='productcomments'} - -

- - - - - {/if} -
- {foreach from=$comments item=comment} - {if $comment.content} -
-
- {$comment.customer_name|escape:'html':'UTF-8'} - {dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0} -
-
-
-

{$comment.title}

-
-
- {section name="i" start=0 loop=5 step=1} - {if $comment.grade le $smarty.section.i.index} -
- {else} -
- {/if} - {/section} - - - -
-
-

{$comment.content|escape:'html':'UTF-8'|nl2br}

-
    - {if $comment.total_advice > 0} -
  • - {l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'} -
  • - {/if} - {if $is_logged} - {if !$comment.customer_advice} -
  • - {l s='Was this comment useful to you?' mod='productcomments'} - - -
  • - {/if} - {if !$comment.customer_report} -
  • - - {l s='Report abuse' mod='productcomments'} - -
  • - {/if} - {/if} -
-

-
-
-
- {/if} - {/foreach} - {else} - {if (!$too_early AND ($is_logged OR $allow_guests))} -

+ {if (!$too_early AND ($is_logged OR $allow_guests))} +

- {l s='Be the first to write your review' mod='productcomments'} + + {if $comments} + {l s='Make a review' mod='productcomments'} + {else} + {l s='Be the first to write your review' mod='productcomments'} + {/if} +

- {else} +
+ {/if} + {if $comments} + {foreach from=$comments item=comment} + {if $comment.content} +
+
+ {$comment.customer_name|escape:'html':'UTF-8'} + {dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0} +
+
+
+

{$comment.title}

+
+
+
+ + + +
+
+

{$comment.content|escape:'html':'UTF-8'|nl2br}

+
    + {if $comment.total_advice > 0} +
  • + {l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'} +
  • + {/if} + {if $is_logged} + {if !$comment.customer_advice} +
  • + {l s='Was this comment useful to you?' mod='productcomments'} + + +
  • + {/if} + {if !$comment.customer_report} +
  • + + {l s='Report abuse' mod='productcomments'} + +
  • + {/if} + {/if} +
+

+
+
+
+ {/if} + {/foreach} + {else}

{l s='No customer reviews for the moment.' mod='productcomments'}

- {/if} {/if}
diff --git a/themes/hotel-reservation-theme/css/modules/productcomments/productcomments.css b/themes/hotel-reservation-theme/css/modules/productcomments/productcomments.css index 34f088823..dba2824d0 100644 --- a/themes/hotel-reservation-theme/css/modules/productcomments/productcomments.css +++ b/themes/hotel-reservation-theme/css/modules/productcomments/productcomments.css @@ -7,22 +7,15 @@ margin: 39px 0 22px; } #product_comments_block_extra .comments_note { margin-bottom: 5px; } - #product_comments_block_extra .comments_note span, - #product_comments_block_extra .star_content { + #product_comments_block_extra .comments_note span{ float: left; color: #333; } - #product_comments_block_extra .star_content { - margin-top: 1px; } - #product_comments_block_extra div.star:after { - content: "\f006"; - font-family: "FontAwesome"; - display: inline-block; - color: #777676; } - #product_comments_block_extra div.star_on:after { - content: "\f005"; - font-family: "FontAwesome"; - display: inline-block; - color: #e9ce18; } + .raty_star i[class^="icon-"] { + font-size: 22px; + color: #e9ce18; + } .raty_star i.icon-star-o { + color: #777777; + } #product_comments_block_extra .comments_advices { clear: both; } diff --git a/themes/hotel-reservation-theme/js/modules/productcomments/js/productcomments.js b/themes/hotel-reservation-theme/js/modules/productcomments/js/productcomments.js index 0f81eeb0f..bf1712ce9 100644 --- a/themes/hotel-reservation-theme/js/modules/productcomments/js/productcomments.js +++ b/themes/hotel-reservation-theme/js/modules/productcomments/js/productcomments.js @@ -23,9 +23,17 @@ * International Registered Trademark & Property of PrestaShop SA */ $(document).ready(function(){ - $('input.star').rating(); - $('.auto-submit-star').rating(); - + $('.raty_star').raty({ + starType : 'i', + starOff: 'icon-star-o', + starOn: 'icon-star', + halfShow: false, + score: 3, + hints: null, + readOnly: function() { + return $(this).hasClass('readonly'); + } + }); $('#new_comment_tab_btn').on('click', function(e){ e.preventDefault(); $('.new_comment_form_outer').show(); diff --git a/themes/hotel-reservation-theme/modules/productcomments/productcomments.tpl b/themes/hotel-reservation-theme/modules/productcomments/productcomments.tpl index e91211fa1..1a25f1eee 100644 --- a/themes/hotel-reservation-theme/modules/productcomments/productcomments.tpl +++ b/themes/hotel-reservation-theme/modules/productcomments/productcomments.tpl @@ -24,153 +24,16 @@ *}
- {if $comments} - {if (!$too_early AND ($is_logged OR $allow_guests))} -

- - {l s='Make a review' mod='productcomments'} - -

- - - - - {/if} -
- {foreach from=$comments item=comment} - {if $comment.content} -
-
- {$comment.customer_name|escape:'html':'UTF-8'} - {dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0} -
-
-
-

{$comment.title}

-
-
- {section name="i" start=0 loop=5 step=1} - {if $comment.grade le $smarty.section.i.index} -
- {else} -
- {/if} - {/section} - - - -
-
-

{$comment.content|escape:'html':'UTF-8'|nl2br}

-
    - {if $comment.total_advice > 0} -
  • - {l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'} -
  • - {/if} - {if $is_logged} - {if !$comment.customer_advice} -
  • - {l s='Was this comment useful to you?' mod='productcomments'} - - -
  • - {/if} - {if !$comment.customer_report} -
  • - - {l s='Report abuse' mod='productcomments'} - -
  • - {/if} - {/if} -
-

-
-
-
- {/if} - {/foreach} - {else} - {if (!$too_early AND ($is_logged OR $allow_guests))} -

+ {if (!$too_early AND ($is_logged OR $allow_guests))} +

- {l s='Be the first to write your review' mod='productcomments'} + + {if $comments} + {l s='Make a review' mod='productcomments'} + {else} + {l s='Be the first to write your review' mod='productcomments'} + {/if} +

- {else} +
+ {/if} + {if $comments} + {foreach from=$comments item=comment} + {if $comment.content} +
+
+ {$comment.customer_name|escape:'html':'UTF-8'} + {dateFormat date=$comment.date_add|escape:'html':'UTF-8' full=0} +
+
+
+

{$comment.title}

+
+
+
+ + + +
+
+

{$comment.content|escape:'html':'UTF-8'|nl2br}

+
    + {if $comment.total_advice > 0} +
  • + {l s='%1$d out of %2$d people found this review useful.' sprintf=[$comment.total_useful,$comment.total_advice] mod='productcomments'} +
  • + {/if} + {if $is_logged} + {if !$comment.customer_advice} +
  • + {l s='Was this comment useful to you?' mod='productcomments'} + + +
  • + {/if} + {if !$comment.customer_report} +
  • + + {l s='Report abuse' mod='productcomments'} + +
  • + {/if} + {/if} +
+

+
+
+
+ {/if} + {/foreach} + {else}

{l s='No customer reviews for the moment.' mod='productcomments'}

- {/if} {/if}