[-] MO : Add ModuleController in ProductComments

// refacto ProductComments
This commit is contained in:
aFolletete
2012-05-18 10:09:02 +00:00
parent 3c8965780c
commit 155f2cbeee
10 changed files with 519 additions and 455 deletions
+9 -13
View File
@@ -41,7 +41,6 @@ class ProductComment extends ObjectModel
/** @var integer Guest's id */
public $id_guest;
/** @var integer Customer name */
public $customer_name;
@@ -118,22 +117,19 @@ class ProductComment extends ObjectModel
*
* @return arrayComments
*/
public static function getByCustomer($id_product, $id_customer, $last = false, $id_guest = false)
public static function getByCustomer($id_product, $id_customer, $get_last = false, $id_guest = false)
{
$results = Db::getInstance()->executeS('
SELECT *
FROM `'._DB_PREFIX_.'product_comment` pc
WHERE pc.`id_product` = '.(int)$id_product.'
AND '.(!$id_guest ? 'pc.`id_customer` = '.(int)$id_customer : 'pc.`id_guest` = '.(int)$id_guest).'
ORDER BY pc.`date_add` DESC '
.($last ? 'LIMIT 1' : '')
SELECT *
FROM `'._DB_PREFIX_.'product_comment` pc
WHERE pc.`id_product` = '.(int)$id_product.'
AND '.(!$id_guest ? 'pc.`id_customer` = '.(int)$id_customer : 'pc.`id_guest` = '.(int)$id_guest).'
ORDER BY pc.`date_add` DESC '
.($get_last ? 'LIMIT 1' : '')
);
if (!$results)
return false;
elseif ($last)
return array_shift($results);
else
if ($get_last)
$results = array_shift($results);
return $results;
}
@@ -43,7 +43,6 @@ class ProductCommentCriterion extends ObjectModel
'fields' => array(
'id_product_comment_criterion_type' => array('type' => self::TYPE_INT),
'active' => array('type' => self::TYPE_BOOL),
// Lang fields
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
)
@@ -54,16 +53,23 @@ class ProductCommentCriterion extends ObjectModel
if (!parent::delete())
return false;
if ($this->id_product_comment_criterion_type == 2)
if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_comment_criterion_category
WHERE id_product_comment_criterion='.(int)$this->id))
{
if (!Db::getInstance()->execute('
DELETE FROM '._DB_PREFIX_.'product_comment_criterion_category
WHERE id_product_comment_criterion='.(int)$this->id))
return false;
}
elseif ($this->id_product_comment_criterion_type == 3)
if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_comment_criterion_product
WHERE id_product_comment_criterion='.(int)$this->id))
{
if (!Db::getInstance()->execute('
DELETE FROM '._DB_PREFIX_.'product_comment_criterion_product
WHERE id_product_comment_criterion='.(int)$this->id))
return false;
}
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_comment_grade`
WHERE `id_product_comment_criterion` = '.(int)$this->id);
return Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'product_comment_grade`
WHERE `id_product_comment_criterion` = '.(int)$this->id);
}
public function update($nullValues = false)
@@ -74,11 +80,13 @@ class ProductCommentCriterion extends ObjectModel
if ($previousUpdate->id_product_comment_criterion_type != $this->id_product_comment_criterion_type)
{
if ($previousUpdate->id_product_comment_criterion_type == 2)
return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_comment_criterion_category
WHERE id_product_comment_criterion='.(int)$previousUpdate->id);
return Db::getInstance()->execute('
DELETE FROM '._DB_PREFIX_.'product_comment_criterion_category
WHERE id_product_comment_criterion = '.(int)$previousUpdate->id);
elseif ($previousUpdate->id_product_comment_criterion_type == 3)
return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'product_comment_criterion_product
WHERE id_product_comment_criterion='.(int)$previousUpdate->id);
return Db::getInstance()->execute('
DELETE FROM '._DB_PREFIX_.'product_comment_criterion_product
WHERE id_product_comment_criterion = '.(int)$previousUpdate->id);
}
return true;
}
@@ -92,8 +100,10 @@ class ProductCommentCriterion extends ObjectModel
{
if (!Validate::isUnsignedId($id_product))
die(Tools::displayError());
return (Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_product` (`id_product_comment_criterion`, `id_product`)
VALUES('.(int)$this->id.','.(int)$id_product.')'));
return Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_product` (`id_product_comment_criterion`, `id_product`)
VALUES('.(int)$this->id.','.(int)$id_product.')
');
}
/**
@@ -105,8 +115,10 @@ class ProductCommentCriterion extends ObjectModel
{
if (!Validate::isUnsignedId($id_category))
die(Tools::displayError());
return (Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_category` (`id_product_comment_criterion`, `id_category`)
VALUES('.(int)$this->id.','.(int)$id_category.')'));
return Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_category` (`id_product_comment_criterion`, `id_category`)
VALUES('.(int)$this->id.','.(int)$id_category.')
');
}
/**
@@ -120,7 +132,7 @@ class ProductCommentCriterion extends ObjectModel
die(Tools::displayError());
if ($grade < 0)
$grade = 0;
else if ($grade > 10)
elseif ($grade > 10)
$grade = 10;
return (Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'product_comment_grade`
@@ -149,14 +161,25 @@ class ProductCommentCriterion extends ObjectModel
$alias = 'ps';
}
return Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pccl.`name`
FROM `'._DB_PREFIX_.'product_comment_criterion` pcc
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion)
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_product` pccp ON (pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion` AND pccp.`id_product` = '.(int)$id_product.')
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_category` pccc ON (pcc.`id_product_comment_criterion` = pccc.`id_product_comment_criterion`)
LEFT JOIN `'._DB_PREFIX_.'product'.$table.'` '.$alias.' ON ('.$alias.'.id_category_default = pccc.id_category AND '.$alias.'.id_product = '.(int)$id_product.')
WHERE pccl.`id_lang` = '.(int)($id_lang).' AND (pccp.id_product IS NOT NULL OR ps.id_product IS NOT NULL OR pcc.id_product_comment_criterion_type = 1) AND pcc.active = 1
GROUP BY pcc.id_product_comment_criterion');
SELECT pcc.`id_product_comment_criterion`, pccl.`name`
FROM `'._DB_PREFIX_.'product_comment_criterion` pcc
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl
ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion)
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_product` pccp
ON (pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion` AND pccp.`id_product` = '.(int)$id_product.')
LEFT JOIN `'._DB_PREFIX_.'product_comment_criterion_category` pccc
ON (pcc.`id_product_comment_criterion` = pccc.`id_product_comment_criterion`)
LEFT JOIN `'._DB_PREFIX_.'product'.$table.'` '.$alias.'
ON ('.$alias.'.id_category_default = pccc.id_category AND '.$alias.'.id_product = '.(int)$id_product.')
WHERE pccl.`id_lang` = '.(int)($id_lang).'
AND (
pccp.id_product IS NOT NULL
OR ps.id_product IS NOT NULL
OR pcc.id_product_comment_criterion_type = 1
)
AND pcc.active = 1
GROUP BY pcc.id_product_comment_criterion
');
}
/**
@@ -168,20 +191,21 @@ class ProductCommentCriterion extends ObjectModel
{
if (!Validate::isUnsignedId($id_lang))
die(Tools::displayError());
return (Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pcc.id_product_comment_criterion_type, pccl.`name`, pcc.active
FROM `'._DB_PREFIX_.'product_comment_criterion` pcc
JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion)
WHERE pccl.`id_lang` = '.(int)$id_lang.($active ? ' AND active = 1' : '').($type ? ' AND id_product_comment_criterion_type = '.(int)$type : '').'
ORDER BY pccl.`name` ASC'));
return Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pcc.id_product_comment_criterion_type, pccl.`name`, pcc.active
FROM `'._DB_PREFIX_.'product_comment_criterion` pcc
JOIN `'._DB_PREFIX_.'product_comment_criterion_lang` pccl ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion)
WHERE pccl.`id_lang` = '.(int)$id_lang.($active ? ' AND active = 1' : '').($type ? ' AND id_product_comment_criterion_type = '.(int)$type : '').'
ORDER BY pccl.`name` ASC
');
}
public function getProducts()
{
$res = Db::getInstance()->executeS('
SELECT pccp.id_product, pccp.id_product_comment_criterion
FROM `'._DB_PREFIX_.'product_comment_criterion_product` pccp
WHERE pccp.id_product_comment_criterion = '.(int)$this->id);
SELECT pccp.id_product, pccp.id_product_comment_criterion
FROM `'._DB_PREFIX_.'product_comment_criterion_product` pccp
WHERE pccp.id_product_comment_criterion = '.(int)$this->id);
$products = array();
if ($res)
foreach ($res AS $row)
@@ -192,9 +216,9 @@ class ProductCommentCriterion extends ObjectModel
public function getCategories()
{
$res = Db::getInstance()->executeS('
SELECT pccc.id_category, pccc.id_product_comment_criterion
FROM `'._DB_PREFIX_.'product_comment_criterion_category` pccc
WHERE pccc.id_product_comment_criterion = '.(int)$this->id);
SELECT pccc.id_category, pccc.id_product_comment_criterion
FROM `'._DB_PREFIX_.'product_comment_criterion_category` pccc
WHERE pccc.id_product_comment_criterion = '.(int)$this->id);
$criterions = array();
if ($res)
foreach ($res AS $row)
@@ -204,19 +228,27 @@ class ProductCommentCriterion extends ObjectModel
public function deleteCategories()
{
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_comment_criterion_category` WHERE `id_product_comment_criterion` = '.(int)$this->id);
return Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'product_comment_criterion_category`
WHERE `id_product_comment_criterion` = '.(int)$this->id);
}
public function deleteProducts()
{
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_comment_criterion_product` WHERE `id_product_comment_criterion` = '.(int)$this->id);
return Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'product_comment_criterion_product`
WHERE `id_product_comment_criterion` = '.(int)$this->id);
}
public static function getTypes()
{
// Instance of module class for translations
$module = new MailAlerts();
$module = new ProductComments();
return array(1 => $module->l('Valid for the entire catalog', 'ProductCommentCriterion'), 2 => $module->l('Restricted to some categories', 'ProductCommentCriterion'), 3 => $module->l('Restricted to some products', 'ProductCommentCriterion'));
return array(
1 => $module->l('Valid for the entire catalog', 'ProductCommentCriterion'),
2 => $module->l('Restricted to some categories', 'ProductCommentCriterion'),
3 => $module->l('Restricted to some products', 'ProductCommentCriterion')
);
}
}
}
@@ -0,0 +1,171 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 15094 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
// Include Module
include_once(dirname(__FILE__).'/../../productcomments.php');
// Include Models
include_once(dirname(__FILE__).'/../../ProductComment.php');
include_once(dirname(__FILE__).'/../../ProductCommentCriterion.php');
class ProductCommentsDefaultModuleFrontController extends ModuleFrontController
{
public function __construct()
{
parent::__construct();
$this->context = Context::getContext();
}
public function initContent()
{
parent::initContent();
if (Tools::isSubmit('action'))
{
switch(Tools::getValue('action'))
{
case 'add_comment':
$this->ajaxProcessAddComment();
break;
case 'report_abuse':
$this->ajaxProcessReportAbuse();
break;
case 'comment_is_usefull':
$this->ajaxProcessCommentIsUsefull();
break;
}
}
}
protected function ajaxProcessAddComment()
{
$module_instance = new ProductComments();
$result = true;
$id_guest = 0;
$id_customer = $this->context->customer->id;
if ($id_customer)
$id_guest = $this->context->cookie->id_guest;
$errors = array();
// Validation
if (!Validate::isInt(Tools::getValue('id_product')))
$errors[] = $module_instance->l('ID product is incorrect');
if (!Tools::getValue('title') || !Validate::isGenericName(Tools::getValue('title')))
$errors[] = $module_instance->l('Title is incorrect');
if (!Tools::getValue('content') || !Validate::isMessage(Tools::getValue('content')))
$errors[] = $module_instance->l('Comment is incorrect');
if (!$id_customer && (!Tools::isSubmit('customer_name') || !Tools::getValue('customer_name') || !Validate::isGenericName(Tools::getValue('customer_name'))))
$errors[] = $module_instance->l('Customer name is incorrect');
if (!$this->context->customer->id && !Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'))
$errors[] = $module_instance->l('You must be logged in order to send a comment');
if (!count(Tools::getValue('criterion')))
$errors[] = $module_instance->l('You must give a rating');
$product = new Product(Tools::getValue('id_product'));
if (!$product->id)
$errors[] = $module_instance->l('Product not found');
if (!count($errors))
{
$customer_comment = ProductComment::getByCustomer(Tools::getValue('id_product'), $id_customer, true, $id_guest);
if (!$customer_comment || ($customer_comment && (strtotime($customer_comment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) < time()))
{
$comment = new ProductComment();
$comment->content = strip_tags(Tools::getValue('content'));
$comment->id_product = (int)Tools::getValue('id_product');
$comment->id_customer = $id_customer;
$comment->id_guest = $id_guest;
$comment->customer_name = Tools::getValue('customer_name');
if (!$comment->id_customer)
$comment->customer_name = pSQL($this->context->customer->firstname.' '.$this->context->customer->lastname);
$comment->title = Tools::getValue('title');
$comment->grade = 0;
$comment->validate = 0;
$comment->save();
$grade_sum = 0;
foreach(Tools::getValue('criterion') as $id_product_comment_criterion => $grade)
{
$grade_sum += $grade;
$product_comment_criterion = new ProductCommentCriterion($id_product_comment_criterion);
if ($product_comment_criterion->id)
$product_comment_criterion->addGrade($comment->id, $grade);
}
if (count(Tools::getValue('criterion')) > 1)
{
$comment->grade = $grade_sum / count(Tools::getValue('criterion'));
// Update Grade average of comment
$comment->save();
}
$result = true;
}
else
{
$result = false;
$errors[] = $module_instance->l('You should wait').' '.Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME').' '.$module_instance->l('seconds before posting a new comment');
}
}
else
$result = false;
die(Tools::jsonEncode(array(
'result' => $result,
'errors' => $errors
)));
}
protected function ajaxProcessReportAbuse()
{
if (!Tools::isSubmit('id_product_comment'))
die('0');
if (ProductComment::isAlreadyReport(Tools::getValue('id_product_comment'), $this->context->cookie->id_customer))
die('0');
if (ProductComment::reportComment((int)Tools::getValue('id_product_comment'), $this->context->cookie->id_customer))
die('1');
die('0');
}
protected function ajaxProcessCommentIsUsefull()
{
if (!Tools::isSubmit('id_product_comment') || !Tools::isSubmit('value'))
die('0');
if (ProductComment::isAlreadyUsefulness(Tools::getValue('id_product_comment'), $this->context->cookie->id_customer))
die('0');
if (ProductComment::setCommentUsefulness((int)Tools::getValue('id_product_comment'), (bool)Tools::getValue('value'), $this->context->cookie->id_customer))
die('1');
die('0');
}
}
@@ -0,0 +1,80 @@
$(function() {
$('input[@type=radio].star').rating();
$('.auto-submit-star').rating();
$('.open-comment-form').fancybox({
'hideOnContentClick': false
});
$('button.usefulness_btn').click(function() {
var id_product_comment = $(this).data('id-product-comment');
var is_usefull = $(this).data('is-usefull');
var parent = $(this).parent();
$.ajax({
url: productcomments_controller_url,
data: {
id_product_comment: id_product_comment,
action: 'comment_is_usefull',
value: is_usefull
},
type: 'POST',
success: function(result){
parent.fadeOut('slow', function() {
parent.remove();
});
}
});
});
$('span.report_btn').click(function() {
if (confirm(confirm_report_message))
{
var idProductComment = $(this).data('id-product-comment');
var parent = $(this).parent();
$.ajax({
url: productcomments_controller_url,
data: {
id_product_comment: idProductComment,
action: 'report_abuse'
},
type: 'POST',
success: function(result){
parent.fadeOut('slow', function() {
parent.remove();
});
}
});
}
});
$('#submitNewMessage').click(function(e) {
// Kill default behaviour
e.preventDefault();
// Form element
$.ajax({
url: productcomments_controller_url+'&action=add_comment&secure_key='+secure_key,
data: $('#fancybox-content form').serialize(),
type: 'POST',
dataType: "json",
success: function(data){
if (data.result)
{
$.fancybox.close();
document.location.href = document.location.href;
}
else
{
$('#new_comment_form_error ul').html('');
$.each(data.errors, function(index, value) {
$('#new_comment_form_error ul').append('<li>'+value+'</li>');
});
$('#new_comment_form_error').slideDown('slow');
}
}
});
return false;
});
});
@@ -25,6 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
// The usage of this file is deprecated !!!
require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
@@ -23,105 +23,17 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{literal}
<script type="text/javascript">
/*$(function(){ $('input[@type=radio].star').rating(); });
$(function(){
$('.auto-submit-star').rating({
callback: function(value, link){
}
});
});*/
$(function(){
$('a[href=#idTab5]').click(function(){
$('*[id^="idTab"]').addClass('block_hidden_only_for_screen');
$('div#idTab5').removeClass('block_hidden_only_for_screen');
$(function(){
$('input[@type=radio].star').rating();
$('.auto-submit-star').rating({
callback: function(value, link) {}
});
});
//close comment form
function closeCommentForm(){
$('#sendComment').slideUp('fast');
$('input#addCommentButton').fadeIn('slow');
}
$('document').ready(function(){
var limitInputText = {
'maxCharacterSize': 200,
'originalStyle': 'originalDisplayInfo',
'warningStyle': 'warningDisplayInfo',
'warningNumber': 40,
'displayFormat': '#left'
};
$('#commentContent').textareaCount(limitInputText);
$('#new_comment_btn').fancybox({
'hideOnContentClick': false,
'onClosed': function(){
},
});
$('a[href=#idTab5]').click(function(){
$('*[id^="idTab"]').addClass('block_hidden_only_for_screen');
$('div#idTab5').removeClass('block_hidden_only_for_screen');
$('ul#more_info_tabs a[href^="#idTab"]').removeClass('selected');
$('a[href="#idTab5"]').addClass('selected');
});
$('#submitMessage').click(function(){
var datas = [];
$('#fancybox-content').find('input, textarea, select').each(function(index){
var o = {}
o.key = $(this).attr('name');
o.value = $(this).val();
datas.push(o);
});
$.ajax({
url: "{/literal}{$module_dir}{literal}productcomments-ajax.php",
post: "POST",
data: {action: 'sendComment', secure_key: '{/literal}{$secure_key}{literal}', review: JSON.stringify(datas)},
dataType: "json",
success: function(result){
if (result == 0) {
alert('{/literal}{l s='Your comment can not be posted. Please fill in all required fields.' mod='productcomments'}{literal}');
} else {
location.reload( true );
$.fancybox.close();
}
}
});
});
$('#submitNewMessage').click(function(){
var datas = [];
$('#fancybox-content').find('input, textarea, select').each(function(index){
var o = {}
o.key = $(this).attr('name');
o.value = $(this).val();
datas.push(o);
});
$.ajax({
url: "{/literal}{$module_dir}{literal}productcomments-ajax.php",
post: "POST",
data: {action: 'sendComment', secure_key: '{/literal}{$secure_key}{literal}', review: JSON.stringify(datas)},
dataType: "json",
success: function(result){
if (result == 0) {
alert('{/literal}{l s='Your comment can not be posted. Please fill in all required fields.' mod='productcomments'}{literal}');
} else {
location.reload( true );
$.fancybox.close();
}
}
});
});
$('ul#more_info_tabs a[href^="#idTab"]').removeClass('selected');
$('a[href="#idTab5"]').addClass('selected');
});
});
</script>
{/literal}
<div id="product_comments_block_extra">
{if $nbComments != 0}
@@ -144,65 +56,8 @@
<a href="#idTab5">{l s='Read user reviews' mod='productcomments'} ({$nbComments})</a><br/>
{/if}
{if ($too_early == false AND ($logged OR $allow_guests))}
<a id="new_comment_btn" href="#new_comment_form">{l s='Write your review' mod='productcomments'}</a>
<a class="open-comment-form" href="#new_comment_form">{l s='Write your review' mod='productcomments'}</a>
{/if}
</div>
<div style="display: none;">
<div id="new_comment_form">
<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>
<div class="product clearfix">
<img src="{$link->getImageLink($product->link_rewrite, $productcomment_cover, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product->name|escape:html:'UTF-8'}" />
<div class="product_desc">
<p class="product_name"><strong>{$product->name}</strong></p>
{$product->description_short}
</div>
</div>
<div class="new_comment_form_content">
<p class="intro_form">{l s='Write your review' mod='productcomments'}</p>
{if $criterions|@count > 0}
<ul class="grade_content clearfix">
{section loop=$criterions name=i start=0 step=1}
<li class="clearfix">
<span>
<input type="hidden" name="id_product_comment_criterion_{$smarty.section.i.iteration}" value="{$criterions[i].id_product_comment_criterion|intval}" />
{$criterions[i].name|escape:'html':'UTF-8'}:&nbsp;
</span>
<div class="star_content">
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" id="{$smarty.section.i.iteration}_grade" value="1" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="2" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="3" checked="checked" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="4" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="5" />
</div>
</li>
{/section}
</ul>
{/if}
<div class="form_contenair">
<p class="text">
<label for="comment_title">{l s='Title' mod='productcomments'} <sup>*</sup>:</label>
<input id="commentTitle" name="title" type="text" value=""/>
</p>
<p class="textarea">
<label for="content">{l s='Comment' mod='productcomments'} <sup>*</sup>:</label>
<textarea id="commentContent" name="content"></textarea>
</p>
{if $allow_guests == true && $logged == 0}
<p class="text">
<label>{l s='Your name' mod='productcomments'} <sup>*</sup>:</label>
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
</p>
{/if}
<p class="submit">
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}'></input>
<a href="#" onclick="$.fancybox.close();">{l s='Cancel' mod='productcomments'}</a>&nbsp;
{l s='or' mod='productcomments'}&nbsp;&nbsp;<button id="submitMessage" name="submitMessage" type="submit">{l s='Send' mod='productcomments'}</button>
</p>
<p class="txt_required">* {l s='Required fields' mod='productcomments'}</p>
</div>
</div><!-- /end new_comment_form_content -->
</div>
</div>
</div>
<!-- /Module ProductComments -->
<!-- /Module ProductComments -->
+62 -50
View File
@@ -27,7 +27,7 @@
#product_comments_block_extra .comments_advices {clear:both;}
/* pop-in add grade/advice ********************************************************************* */
#fancybox-wrap {width:585px !important}
#fancybox-wrap { width:585px !important }
#fancybox-content {
width:585px !important;
border-width:0 !important
@@ -68,7 +68,6 @@
#new_comment_form .grade_content {margin:0 0 20px 0}
#new_comment_form .grade_content span,
#new_comment_form .grade_content .star_content {float:left}
#new_comment_form .grade_content span {
display:inline-block;
padding:0 10px;
@@ -83,39 +82,29 @@
}
.new_comment_form_content .intro_form {
padding-bottom: 10px;
font-weight: bold;
font-size: 12px
font-weight: bold;
font-size: 12px
}
#new_comment_form .form_contenair {
clear:both;
margin-top:20px
}
#new_comment_form p.text
#new_comment_form p.textarea {
margin-bottom:0;
padding-bottom:0
}
#new_comment_form p.text label, #new_comment_form p.textarea label {
display: block;
#new_comment_form label {
display: block;
margin:12px 0 4px 0;
font-weight: bold;
font-size: 12px;
font-weight: bold;
font-size: 12px;
}
#new_comment_form p.text input {
padding: 0 5px;
height: 28px;
width: 540px;
border: 1px solid #ccc;
background: #fff;
}
#new_comment_form p.textarea textarea {
#new_comment_form input {
padding: 0 5px;
height: 80px;
width: 540px;
border: 1px solid #ccc;
background: #fff;
height: 28px;
width: 540px;
border: 1px solid #ccc;
background: #fff;
}
#new_comment_form textarea {
padding: 0 5px;
height: 80px;
width: 540px;
border: 1px solid #ccc;
background: #fff;
}
#new_comment_form .submit {
@@ -126,20 +115,40 @@
}
#new_comment_form button {
cursor: pointer;
cursor: pointer;
display: inline-block;
padding: 4px 7px 3px 7px;
border: 1px solid #CC9900;
border-radius: 3px 3px 3px 3px;
font-weight: bold;
color: #000;
cursor: pointer;
display: inline-block;
padding: 4px 7px 3px 7px;
border: 1px solid #CC9900;
border-radius: 3px 3px 3px 3px;
font-weight: bold;
color: #000;
background: url(img/bg_bt.gif) repeat-x scroll 0 0 #F4B61B
}
#new_comment_form .submit .txt_required {
float:left;
font-size:12px;
font-style:italic;
color:#666
#new_comment_form #criterions_list {
border-bottom: 1px solid #CCC;
padding-bottom: 15px;
list-style-type: none;
}
#new_comment_form #criterions_list li {
margin-bottom: 10px;
}
#new_comment_form #criterions_list label {
display: inline;
float: left;
margin: 0 0 0 60px;
}
#new_comment_form #criterions_list .star_content {
float: right;
margin-right: 180px;
}
#new_comment_form #new_comment_form_footer {
margin-top: 20px;
font-size: 12px;
}
/* TAB COMMENTS ******************************************************************************** */
@@ -195,18 +204,21 @@
#product_comments_block_tab a:hover {text-decoration: underline}
#product_comments_block_tab button.usefulness_btn {
cursor: pointer;
cursor: pointer;
margin:0 0 0 5px;
display: inline-block;
padding: 0 2px;
border: 1px solid #CC9900;
border-radius: 3px 3px 3px 3px;
color: #000;
font-weight: bold;
display: inline-block;
padding: 0 2px;
border: 1px solid #CC9900;
border-radius: 3px 3px 3px 3px;
color: #000;
font-weight: bold;
background: url("img/bg_bt.gif") repeat-x scroll 0 0 #F4B61B
}
#product_comments_block_tab button.usefulness_btn:hover {background-position: left -50px}
#product_comments_block_tab button.usefulness_btn:active {background-position: left -100px}
#product_comments_block_tab span.report_btn {cursor: pointer}
#product_comments_block_tab span.report_btn:hover {text-decoration:underline}
#product_comments_block_tab span.report_btn:hover {text-decoration:underline}
.fl { float: left; }
.fr { float: right; }
+43 -47
View File
@@ -42,7 +42,7 @@ class ProductComments extends Module
{
$this->name = 'productcomments';
$this->tab = 'front_office_features';
$this->version = '2.2';
$this->version = '2.3';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->secure_key = Tools::encrypt($this->name);
@@ -496,7 +496,7 @@ class ProductComments extends Module
</div>
</form>';
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
$criterions = ProductCommentCriterion::getCriterions(Context::getContext()->language->id);
$criterions = ProductCommentCriterion::getCriterions($this->context->language->id);
if (count($criterions))
{
$this->_html .= '<br />
@@ -529,7 +529,7 @@ class ProductComments extends Module
{
include_once(dirname(__FILE__).'/ProductCommentCriterion.php');
$criterions = ProductCommentCriterion::getCriterions(Context::getContext()->language->id, false, true);
$criterions = ProductCommentCriterion::getCriterions($this->context->language->id, false, true);
$id_criterion = (int)Tools::getValue('updateCriterion');
if ($id_criterion)
@@ -537,13 +537,13 @@ class ProductComments extends Module
$criterion = new ProductCommentCriterion((int)$id_criterion);
if ($criterion->id_product_comment_criterion_type == 2)
{
$categories = Category::getSimpleCategories(Context::getContext()->language->id);
$categories = Category::getSimpleCategories($this->context->language->id);
$criterion_categories = $criterion->getCategories();
}
else if ($criterion->id_product_comment_criterion_type == 3)
{
$criterion_products = $criterion->getProducts();
$products = Product::getSimpleProducts(Context::getContext()->language->id);
$products = Product::getSimpleProducts($this->context->language->id);
}
}
@@ -682,11 +682,12 @@ class ProductComments extends Module
require_once(dirname(__FILE__).'/ProductComment.php');
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
Context::getContext()->smarty->assign(array(
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
'comments' => ProductComment::getByProduct((int)(Tools::getValue('id_product'))),
'criterions' => ProductCommentCriterion::getByProduct((int)(Tools::getValue('id_product')), Context::getContext()->language->id),
'nbComments' => (int)(ProductComment::getCommentNumber((int)(Tools::getValue('id_product'))))));
$this->context->smarty->assign(array(
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
'comments' => ProductComment::getByProduct((int)(Tools::getValue('id_product'))),
'criterions' => ProductCommentCriterion::getByProduct((int)(Tools::getValue('id_product')), $this->context->language->id),
'nbComments' => (int)(ProductComment::getCommentNumber((int)(Tools::getValue('id_product'))))
));
return ($this->display(__FILE__, '/tab.tpl'));
}
@@ -696,22 +697,22 @@ class ProductComments extends Module
require_once(dirname(__FILE__).'/ProductComment.php');
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
$id_guest = (!$id_customer = (int)Context::getContext()->cookie->id_customer) ? (int)Context::getContext()->cookie->id_guest : false;
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)Context::getContext()->cookie->id_customer, true, (int)$id_guest);
$id_guest = (!$id_customer = (int)$this->context->cookie->id_customer) ? (int)$this->context->cookie->id_guest : false;
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)$this->context->cookie->id_customer, true, (int)$id_guest);
$average = ProductComment::getAverageGrade((int)Tools::getValue('id_product'));
$image = Product::getCover((int)Tools::getValue('id_product'));
Context::getContext()->smarty->assign(array(
$this->context->smarty->assign(array(
'id_product_comment_form' => (int)Tools::getValue('id_product'),
'product' => new Product((int)Tools::getValue('id_product'), false, Context::getContext()->language->id),
'product' => new Product((int)Tools::getValue('id_product'), false, $this->context->language->id),
'secure_key' => $this->secure_key,
'logged' => (int)Context::getContext()->customer->isLogged(true),
'logged' => (int)$this->context->customer->isLogged(true),
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
'productcomment_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'],
'mediumSize' => Image::getSize('medium'),
'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), Context::getContext()->language->id),
'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), $this->context->language->id),
'action_url' => '',
'averageTotal' => (int)$average['grade'],
'too_early' => ($customerComment && (strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) > time()),
@@ -721,55 +722,50 @@ class ProductComments extends Module
return ($this->display(__FILE__, '/productcomments-extra.tpl'));
}
private function _frontOfficePostProcess()
{
}
public function hookProductTabContent($params)
{
$id_guest = (!$id_customer = (int)Context::getContext()->cookie->id_customer) ? (int)Context::getContext()->cookie->id_guest : false;
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)Context::getContext()->cookie->id_customer, true, (int)$id_guest);
$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');
$averages = ProductComment::getAveragesByProduct((int)Tools::getValue('id_product'), Context::getContext()->language->id);
$id_guest = (!$id_customer = (int)$this->context->cookie->id_customer) ? (int)$this->context->cookie->id_guest : false;
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)$this->context->cookie->id_customer, true, (int)$id_guest);
$averages = ProductComment::getAveragesByProduct((int)Tools::getValue('id_product'), $this->context->language->id);
$averageTotal = 0;
foreach ($averages as $average)
$averageTotal += (float)($average);
$averageTotal = count($averages) ? ($averageTotal / count($averages)) : 0;
Context::getContext()->smarty->assign(array(
'logged' => (int)Context::getContext()->customer->isLogged(true),
'action_url' => '',
'comments' => ProductComment::getByProduct((int)Tools::getValue('id_product'), 1, null, Context::getContext()->cookie->id_customer),
'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), Context::getContext()->language->id),
'averages' => $averages,
'product_comment_path' => $this->_path,
'averageTotal' => $averageTotal,
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
'too_early' => ($customerComment && (strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) > time()),
'delay' => Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')));
$this->context->controller->pagination((int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')));
$image = Product::getCover((int)Tools::getValue('id_product'));
Context::getContext()->smarty->assign(array(
$this->context->smarty->assign(array(
'logged' => (int)$this->context->customer->isLogged(true),
'action_url' => '',
'comments' => ProductComment::getByProduct((int)Tools::getValue('id_product'), 1, null, $this->context->cookie->id_customer),
'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), $this->context->language->id),
'averages' => $averages,
'product_comment_path' => $this->_path,
'averageTotal' => $averageTotal,
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
'too_early' => ($customerComment && (strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) > time()),
'delay' => Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME'),
'id_product_comment_form' => (int)Tools::getValue('id_product'),
'secure_key' => $this->secure_key,
'productcomment_cover' => (int)Tools::getValue('id_product').'-'.(int)$image['id_image'],
'mediumSize' => Image::getSize('medium'),
'nbComments' => (int)ProductComment::getCommentNumber((int)Tools::getValue('id_product'))
'nbComments' => (int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')),
'productcomments_controller_url' => $this->context->link->getModuleLink('productcomments')
));
$this->context->controller->pagination((int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')));
return ($this->display(__FILE__, '/productcomments.tpl'));
}
public function hookHeader()
{
$this->context->controller->addCSS($this->_path.'productcomments.css', 'all');
$this->context->controller->addJS($this->_path.'js/jquery.rating.pack.js');
$this->context->controller->addJS($this->_path.'js/jquery.textareaCounter.plugin.js');
$this->_frontOfficePostProcess();
}
public function hookExtraProductComparison($params)
@@ -784,8 +780,8 @@ class ProductComments extends Module
foreach ($params['list_ids_product'] as $id_product)
{
$grades = ProductComment::getAveragesByProduct($id_product, Context::getContext()->language->id);
$criterions = ProductCommentCriterion::getByProduct($id_product, Context::getContext()->language->id);
$grades = ProductComment::getAveragesByProduct($id_product, $this->context->language->id);
$criterions = ProductCommentCriterion::getByProduct($id_product, $this->context->language->id);
$grade_total = 0;
if (count($grades) > 0)
{
@@ -811,9 +807,9 @@ class ProductComments extends Module
if (count($list_grades) < 1)
return false;
Context::getContext()->smarty->assign(array('grades' => $list_grades, 'product_grades' => $list_product_grades, 'list_ids_product' => $params['list_ids_product'],
$this->context->smarty->assign(array('grades' => $list_grades, 'product_grades' => $list_product_grades, 'list_ids_product' => $params['list_ids_product'],
'list_product_average' => $list_product_average, 'product_comments' => $list_product_comment));
return $this->display(__FILE__, '/products-comparison.tpl');
}
}
}
+59 -142
View File
@@ -23,98 +23,10 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<script type="text/javascript" src="{$module_dir}js/jquery.rating.pack.js"></script>
<script type="text/javascript">
$(function(){literal}{{/literal} $('input[@type=radio].star').rating(); {literal}}{/literal});
$(function(){literal}{{/literal}
$('.auto-submit-star').rating({literal}{{/literal}
callback: function(value, link){literal}{{/literal}
{literal}}{/literal}
{literal}}{/literal});
{literal}}{/literal});
{literal}
$('document').ready(function(){
$('#new_comment_tab_btn').fancybox({
'hideOnContentClick': false,
'onClosed': function(){
},
});
$('button[id^=comment_useful_yes_]').click(function(){
var idProductComment = $(this).attr('id').replace('comment_useful_yes_', '');
var parent = $(this).parent();
$.ajax({
{/literal}url: "{$module_dir}productcomments-ajax.php",{literal}
post: "POST",
data: "id_product_comment=" + idProductComment + "&action=usefulness&value=1",
success: function(result){
parent.fadeOut("normal", function() {
parent.remove();
});
}
});
});
$('button[id^=comment_useful_no_]').click(function(){
var idProductComment = $(this).attr('id').replace('comment_useful_no_', '');
var parent = $(this).parent();
$.ajax({
{/literal}url: "{$module_dir}productcomments-ajax.php",{literal}
post: "POST",
data: "id_product_comment=" + idProductComment + "&action=usefulness&value=0",
success: function(result){
parent.fadeOut("normal", function() {
parent.remove();
});
}
});
});
$('span[id^=comment_report_]').click(function(){
{/literal}if (confirm('{l s='Are you sure you want report this comment?' mod='productcomments'}')){literal}
{
var idProductComment = $(this).attr('id').replace('comment_report_', '');
var parent = $(this).parent();
$.ajax({
{/literal}url: "{$module_dir}productcomments-ajax.php",{literal}
post: "POST",
data: "id_product_comment=" + idProductComment + "&action=report",
success: function(result){
parent.fadeOut("normal", function() {
parent.remove();
});
}
});
}
});
$('#submitNewMessage').click(function(){
var datas = [];
$('#fancybox-content').find('input, textarea, select').each(function(index){
var o = {}
o.key = $(this).attr('name');
o.value = $(this).val();
datas.push(o);
});
$.ajax({
{/literal}url: "{$module_dir}productcomments-ajax.php",{literal}
post: "POST",
data: {action: 'sendComment', secure_key: '{/literal}{$secure_key}{literal}', review: JSON.stringify(datas)},
dataType: "json",
success: function(result){
$.fancybox.close();
}
});
});
});
{/literal}
var productcomments_controller_url = '{$productcomments_controller_url}';
var confirm_report_message = "{l s='Are you sure you want report this comment?' mod='productcomments'}";
var secure_key = "{$secure_key}";
</script>
<div id="idTab5">
@@ -148,10 +60,10 @@
{/if}
{if $logged == 1}
{if !$comment.customer_advice}
<li>{l s='Was this comment useful to you?' mod='productcomments'}<button class="usefulness_btn" id="comment_useful_yes_{$comment.id_product_comment}">{l s='yes' mod='productcomments'}</button><button class="usefulness_btn" id="comment_useful_no_{$comment.id_product_comment}">{l s='no' mod='productcomments'}</button></li>
<li>{l s='Was this comment useful to you?' mod='productcomments'}<button class="usefulness_btn" data-is-usefull="1" data-id-product-comment="{$comment.id_product_comment}">{l s='yes' mod='productcomments'}</button><button class="usefulness_btn" data-is-usefull="0" data-id-product-comment="{$comment.id_product_comment}">{l s='no' mod='productcomments'}</button></li>
{/if}
{if !$comment.customer_report}
<li><span class="report_btn" id="comment_report_{$comment.id_product_comment}">{l s='Report abuse' mod='productcomments'}</span></li>
<li><span class="report_btn" data-id-product-comment="{$comment.id_product_comment}">{l s='Report abuse' mod='productcomments'}</span></li>
{/if}
{/if}
</ul>
@@ -161,69 +73,74 @@
{/foreach}
{else}
{if ($too_early == false AND ($logged OR $allow_guests))}
<div style="display: none;">
<div id="new_comment_form">
<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>
<div class="product clearfix">
<img src="{$link->getImageLink($product->link_rewrite, $productcomment_cover, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product->name|escape:html:'UTF-8'}" />
<div class="product_desc">
<p class="product_name"><strong>{$product->name}</strong></p>
{$product->description_short}
</div>
</div>
<div class="new_comment_form_content">
<p class="intro_form">{l s='Write your review' mod='productcomments'}</p>
{if $criterions|@count > 0}
<div class="grade_content clearfix">
{section loop=$criterions name=i start=0 step=1}
<span>
<input type="hidden" name="id_product_comment_criterion_{$smarty.section.i.iteration}" value="{$criterions[i].id_product_comment_criterion|intval}" />
{$criterions[i].name|escape:'html':'UTF-8'}:&nbsp;
</span>
<div class="star_content">
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" id="{$smarty.section.i.iteration}_grade" value="1" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="2" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="3" checked="checked" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="4" />
<input class="star" type="radio" name="{$smarty.section.i.iteration}_grade" value="5" />
<form action="#">
<h2 class="title">{l s='Write your review' mod='productcomments'}</h2>
<div class="product clearfix">
<img src="{$link->getImageLink($product->link_rewrite, $productcomment_cover, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product->name|escape:html:'UTF-8'}" />
<div class="product_desc">
<p class="product_name"><strong>{$product->name}</strong></p>
{$product->description_short}
</div>
{/section}
</div>
{/if}
<div class="form_contenair">
<p class="text">
<label for="comment_title">{l s='Title' mod='productcomments'} <sup>*</sup>:</label>
<input id="commentTitle" name="title" type="text" value=""/>
</p>
<p class="textarea">
<label for="content">{l s='Comment' mod='productcomments'} <sup>*</sup>:</label>
<textarea id="commentContent" name="content"></textarea>
</p>
{if $allow_guests == true && $logged == 0}
<p class="text">
<label>{l s='Your name' mod='productcomments'} <sup>*</sup>:</label>
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
</p>
<div class="new_comment_form_content">
<h2>{l s='Write your review' mod='productcomments'}</h2>
<div id="new_comment_form_error" class="error" style="display: none;">
<ul></ul>
</div>
{if $criterions|@count > 0}
<ul id="criterions_list">
{foreach from=$criterions item='criterion'}
<li>
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
<div class="star_content">
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|intval}]" value="1" />
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|intval}]" value="2" />
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|intval}]" value="3" checked="checked" />
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|intval}]" value="4" />
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|intval}]" value="5" />
</div>
<div class="clearfix"></div>
</li>
{/foreach}
</ul>
{/if}
<p class="submit">
<span class="txt_required">* {l s='Required fields' mod='productcomments'}</span>
<label for="comment_title">{l s='Title' mod='productcomments'}: <sup class="required">*</sup></label>
<input id="comment_title" name="title" type="text" value=""/>
<label for="content">{l s='Comment' mod='productcomments'}: <sup class="required">*</sup></label>
<textarea id="content" name="content"></textarea>
{if $allow_guests == true && $logged == 0}
<label>{l s='Your name' mod='productcomments'}: <sup class="required">*</sup></label>
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
{/if}
<div id="new_comment_form_footer">
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}'></input>
<button id="submitNewMessage" name="submitMessage" type="submit">{l s='Send' mod='productcomments'}</button>&nbsp;
{l s='or' mod='productcomments'}&nbsp;<a href="#" onclick="$.fancybox.close();">{l s='Cancel' mod='productcomments'}</a>
</p>
<p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p>
<p class="fr">
<button id="submitNewMessage" name="submitMessage" type="submit">{l s='Send' mod='productcomments'}</button>&nbsp;
{l s='or' mod='productcomments'}&nbsp;<a href="#" onclick="$.fancybox.close();">{l s='Cancel' mod='productcomments'}</a>
</p>
<div class="clearfix"></div>
</div>
</div>
</div><!-- /end new_comment_form_content -->
</form><!-- /end new_comment_form_content -->
</div>
</div>
<p class="align_center">
<a id="new_comment_tab_btn" href="#new_comment_form">{l s='Be the first to write your review' mod='productcomments'} !</a>
<a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Be the first to write your review' mod='productcomments'} !</a>
</p>
{else}
<p class="align_center">{l s='No customer comments for the moment.' mod='productcomments'}</p>
{/if}
{/if}
</div>
</div>
</div>
+12 -8
View File
@@ -2,23 +2,18 @@
global $_MODULE;
$_MODULE = array();
$_MODULE['<{productcomments}prestashop>productcommentcriterion_a09ed6c60eb3213939cecb4c580813cd'] = 'Disponible pour le catalogue entier';
$_MODULE['<{productcomments}prestashop>productcommentcriterion_467366059d7d7c743a4d0971363a8d66'] = 'Restreint à certaines catégories';
$_MODULE['<{productcomments}prestashop>productcommentcriterion_772911becd336c843ab09a1d4b4f66c0'] = 'Restreint à certains produits';
$_MODULE['<{productcomments}prestashop>productcomments-ajax_fd4b5401d4d3c7d32d158bfc1e552f3b'] = 'Veuillez donner votre nom';
$_MODULE['<{productcomments}prestashop>productcomments-ajax_f88dc17737f7fdd4464b2eb922a8f133'] = 'Une erreur s\'est produite lors de l\'enregistrement de votre commentaire.';
$_MODULE['<{productcomments}prestashop>productcomments-ajax_7fa4a3510dafd0eac6435c19861b2bb7'] = 'Commentaire publié.';
$_MODULE['<{productcomments}prestashop>productcomments-ajax_f8694a9aae2eb045920f613cfa7f1235'] = 'En attente de la validation de la modération.';
$_MODULE['<{productcomments}prestashop>productcomments-ajax_6bf852d9850445291f5e9d4740ac7b50'] = 'Un texte de commentaire est nécessaire.';
$_MODULE['<{productcomments}prestashop>productcomments-ajax_8aafe254c3e8dceb6425591b322044f2'] = 'Vous devriez attendre %d secondes avant de publier un nouveau commentaire.';
$_MODULE['<{productcomments}prestashop>productcomments-extra_3f3c57ad486f74745aef0a3bb5f3ad6c'] = 'Votre commentaire ne peut pas être publié. Veuillez remplir tous les champs requis.';
$_MODULE['<{productcomments}prestashop>productcomments-extra_7c3b0e9898b88deee7ea75aafd2e37e2'] = 'Note moyenne';
$_MODULE['<{productcomments}prestashop>productcomments-extra_a71a0229e164fecdcde3c4e0f40473fa'] = 'Lire les avis utilisateurs';
$_MODULE['<{productcomments}prestashop>productcomments-extra_7966126831926ad29c528b239d69f855'] = 'Donnez votre avis';
$_MODULE['<{productcomments}prestashop>productcomments-extra_b78a3223503896721cca1303f776159b'] = 'Titre';
$_MODULE['<{productcomments}prestashop>productcomments-extra_0be8406951cdfda82f00f79328cf4efc'] = 'Commentaire';
$_MODULE['<{productcomments}prestashop>productcomments-extra_221e705c06e231636fdbccfdd14f4d5c'] = 'Votre nom';
$_MODULE['<{productcomments}prestashop>productcomments-extra_ea4788705e6873b424c65e91c2846b19'] = 'Annuler';
$_MODULE['<{productcomments}prestashop>productcomments-extra_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'ou';
$_MODULE['<{productcomments}prestashop>productcomments-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Envoyer';
$_MODULE['<{productcomments}prestashop>productcomments-extra_70397c4b252a5168c5ec003931cea215'] = 'Champs requis';
$_MODULE['<{productcomments}prestashop>productcomments_b91c4e8b229a399a3bc911d352524a9b'] = 'Commentaires produits';
$_MODULE['<{productcomments}prestashop>productcomments_9918811c511f3481c085e46c07ab5da8'] = 'Permet aux client de commenter les produits.';
$_MODULE['<{productcomments}prestashop>productcomments_c888438d14855d7d96a2724ee9c306bd'] = 'Configuration mise à jour';
@@ -88,3 +83,12 @@ $_MODULE['<{productcomments}prestashop>products-comparison_8413c683b4b27cc3f4dbd
$_MODULE['<{productcomments}prestashop>products-comparison_b1897515d548a960afe49ecf66a29021'] = 'Moyenne';
$_MODULE['<{productcomments}prestashop>products-comparison_bc976f6c3405523cde61f63a7cbe224b'] = 'Voir les avis';
$_MODULE['<{productcomments}prestashop>tab_8413c683b4b27cc3f4dbd4c90329d8ba'] = 'Commentaires';
$_MODULE['<{productcomments}prestashop>default_607d7adc590bb9a615b6fa5bc8a4f2f6'] = 'ID produit est incorrect';
$_MODULE['<{productcomments}prestashop>default_7b0bf23ae4079e07a3a4cb4d07e2caef'] = 'Le titre est incorrect';
$_MODULE['<{productcomments}prestashop>default_ddbd56de5feb78ef1aaf60401f8c472b'] = 'Le commentaire est incorrect';
$_MODULE['<{productcomments}prestashop>default_1b1030b6294e9096a7d7c40d83d61872'] = 'Le nom est incorrect';
$_MODULE['<{productcomments}prestashop>default_a95dff703b20b1e705210c39b3865bf0'] = 'Vous devez être connecter afin de poster un commentaire';
$_MODULE['<{productcomments}prestashop>default_a201fbadca94d310a1b62407cdc775d5'] = 'Vous devez donner une note';
$_MODULE['<{productcomments}prestashop>default_dfbe69c6d9568ecb0e65e7b32ed92a3a'] = 'Le produit n\'a pas été trouvé';
$_MODULE['<{productcomments}prestashop>default_6d28f2900adb9e500868166f6d04da92'] = 'Vous devez patienter';
$_MODULE['<{productcomments}prestashop>default_ba8d7ae5dcadfba739f28a777378f208'] = 'secondes avant de poster un nouveau commentaire';