first commit

This commit is contained in:
2024-11-05 12:22:50 +01:00
commit e5682a3912
19641 changed files with 2948548 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
2014-04-17 11:40:33 +0200 Bug fix (PS 1.5): ps_version_compliancy removed
2014-04-15 18:54:08 +0200 [*] hookDisplayLeftColumnProduct() added
2014-04-09 18:28:59 +0200 Fix #PSCSX-1684, display correct date format
2014-03-21 10:55:15 +0100 Initial commit

View File

@@ -0,0 +1,22 @@
GitHub contributors:
--------------------------------
- AlexEven
- Damien Metzger
- Francois Gaillard
- Gregory Roussac
- Jerome Nadaud
- Jérôme Nadaud
- Maxime Biloé
- Oksydan
- PierreRambaud
- aleeks
- clarkdave
- eternoendless
- gRoussac
- gaillafr
- indesign47
- jolelievre
- julienbourdeau
- maximebiloe
- sfroment
- xBorderie

View File

@@ -0,0 +1,47 @@
Academic Free License ("AFL") v. 3.0
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
Licensed under the Academic Free License version 3.0
1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
a) to reproduce the Original Work in copies, either alone or as part of a collective work;
b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.

View File

@@ -0,0 +1,487 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class ProductComment extends ObjectModel
{
/** @var int */
public $id;
/** @var int */
public $id_product;
/** @var int */
public $id_customer;
/** @var int */
public $id_guest;
/** @var int */
public $customer_name;
/** @var string */
public $title;
/** @var string */
public $content;
/** @var int */
public $grade;
/** @var bool */
public $validate = false;
/** @var bool */
public $deleted = false;
/** @var string Object creation date */
public $date_add;
/**
* @see ObjectModel::$definition
*/
public static $definition = [
'table' => 'product_comment',
'primary' => 'id_product_comment',
'fields' => [
'id_product' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true],
'id_customer' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true],
'id_guest' => ['type' => self::TYPE_INT],
'customer_name' => ['type' => self::TYPE_STRING],
'title' => ['type' => self::TYPE_STRING],
'content' => ['type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 65535, 'required' => true],
'grade' => ['type' => self::TYPE_FLOAT, 'validate' => 'isFloat'],
'validate' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'],
'deleted' => ['type' => self::TYPE_BOOL],
'date_add' => ['type' => self::TYPE_DATE],
],
];
/**
* Get comments by IdProduct
*
* @return array|bool
*/
public static function getByProduct($id_product, $p = 1, $n = null, $id_customer = null)
{
if (!Validate::isUnsignedId($id_product)) {
return false;
}
$validate = (bool) Configuration::get('PRODUCT_COMMENTS_MODERATE');
$p = (int) $p;
$n = (int) $n;
if ($p <= 1) {
$p = 1;
}
if ($n != null && $n <= 0) {
$n = 5;
}
$cache_id = 'ProductComment::getByProduct_' . (int) $id_product . '-' . (int) $p . '-' . (int) $n . '-' . (int) $id_customer . '-' . (bool) $validate;
if (!Cache::isStored($cache_id)) {
$result = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS('
SELECT pc.`id_product_comment`,
(SELECT count(*) FROM `' . _DB_PREFIX_ . 'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment` AND pcu.`usefulness` = 1) as total_useful,
(SELECT count(*) FROM `' . _DB_PREFIX_ . 'product_comment_usefulness` pcu WHERE pcu.`id_product_comment` = pc.`id_product_comment`) as total_advice, ' .
((int) $id_customer ? '(SELECT count(*) FROM `' . _DB_PREFIX_ . 'product_comment_usefulness` pcuc WHERE pcuc.`id_product_comment` = pc.`id_product_comment` AND pcuc.id_customer = ' . (int) $id_customer . ') as customer_advice, ' : '') .
((int) $id_customer ? '(SELECT count(*) FROM `' . _DB_PREFIX_ . 'product_comment_report` pcrc WHERE pcrc.`id_product_comment` = pc.`id_product_comment` AND pcrc.id_customer = ' . (int) $id_customer . ') as customer_report, ' : '') . '
IF(c.id_customer, CONCAT(c.`firstname`, \' \', LEFT(c.`lastname`, 1)), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pc.title
FROM `' . _DB_PREFIX_ . 'product_comment` pc
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON c.`id_customer` = pc.`id_customer`
WHERE pc.`id_product` = ' . (int) ($id_product) . ($validate ? ' AND pc.`validate` = 1' : '') . '
ORDER BY pc.`date_add` DESC
' . ($n ? 'LIMIT ' . (int) (($p - 1) * $n) . ', ' . (int) ($n) : ''));
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
}
/**
* Return customer's comment
*
* @return array Comments
*/
public static function getByCustomer($id_product, $id_customer, $get_last = false, $id_guest = false)
{
$cache_id = 'ProductComment::getByCustomer_' . (int) $id_product . '-' . (int) $id_customer . '-' . (bool) $get_last . '-' . (int) $id_guest;
if (!Cache::isStored($cache_id)) {
$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 '
. ($get_last ? 'LIMIT 1' : '')
);
if ($get_last && count($results)) {
$results = array_shift($results);
}
Cache::store($cache_id, $results);
}
return Cache::retrieve($cache_id);
}
/**
* Get Grade By product
*
* @return array|bool
*/
public static function getGradeByProduct($id_product, $id_lang)
{
if (!Validate::isUnsignedId($id_product) ||
!Validate::isUnsignedId($id_lang)) {
return false;
}
$validate = (bool) Configuration::get('PRODUCT_COMMENTS_MODERATE');
return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS('
SELECT pc.`id_product_comment`, pcg.`grade`, pccl.`name`, pcc.`id_product_comment_criterion`
FROM `' . _DB_PREFIX_ . 'product_comment` pc
LEFT JOIN `' . _DB_PREFIX_ . 'product_comment_grade` pcg ON (pcg.`id_product_comment` = pc.`id_product_comment`)
LEFT JOIN `' . _DB_PREFIX_ . 'product_comment_criterion` pcc ON (pcc.`id_product_comment_criterion` = pcg.`id_product_comment_criterion`)
LEFT JOIN `' . _DB_PREFIX_ . 'product_comment_criterion_lang` pccl ON (pccl.`id_product_comment_criterion` = pcg.`id_product_comment_criterion`)
WHERE pc.`id_product` = ' . (int) $id_product . '
AND pccl.`id_lang` = ' . (int) $id_lang .
($validate ? ' AND pc.`validate` = 1' : ''));
}
public static function getRatings($id_product)
{
$validate = Configuration::get('PRODUCT_COMMENTS_MODERATE');
$sql = 'SELECT (SUM(pc.`grade`) / COUNT(pc.`grade`)) AS avg,
MIN(pc.`grade`) AS min,
MAX(pc.`grade`) AS max
FROM `' . _DB_PREFIX_ . 'product_comment` pc
WHERE pc.`id_product` = ' . (int) $id_product . '
AND pc.`deleted` = 0' .
($validate == '1' ? ' AND pc.`validate` = 1' : '');
return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getRow($sql);
}
public static function getAverageGrade($id_product)
{
$validate = Configuration::get('PRODUCT_COMMENTS_MODERATE');
return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getRow('
SELECT (SUM(pc.`grade`) / COUNT(pc.`grade`)) AS grade
FROM `' . _DB_PREFIX_ . 'product_comment` pc
WHERE pc.`id_product` = ' . (int) $id_product . '
AND pc.`deleted` = 0' .
($validate == '1' ? ' AND pc.`validate` = 1' : ''));
}
public static function getAveragesByProduct($id_product, $id_lang)
{
/* Get all grades */
$grades = ProductComment::getGradeByProduct((int) $id_product, (int) $id_lang);
$total = ProductComment::getGradedCommentNumber((int) $id_product);
if (!count($grades) || !$total) {
return [];
}
/* Addition grades for each criterion */
$criterionsGradeTotal = [];
$count_grades = count($grades);
for ($i = 0; $i < $count_grades; ++$i) {
if (array_key_exists($grades[$i]['id_product_comment_criterion'], $criterionsGradeTotal) === false) {
$criterionsGradeTotal[$grades[$i]['id_product_comment_criterion']] = (int) ($grades[$i]['grade']);
} else {
$criterionsGradeTotal[$grades[$i]['id_product_comment_criterion']] += (int) ($grades[$i]['grade']);
}
}
/* Finally compute the averages */
$averages = [];
foreach ($criterionsGradeTotal as $key => $criterionGradeTotal) {
$averages[(int) $key] = $criterionGradeTotal / $total;
}
return $averages;
}
/**
* Return number of comments and average grade by products
*
* @return int|false
*/
public static function getCommentNumber($id_product)
{
if (!Validate::isUnsignedId($id_product)) {
return false;
}
$validate = (bool) Configuration::get('PRODUCT_COMMENTS_MODERATE');
$cache_id = 'ProductComment::getCommentNumber_' . (int) $id_product . '-' . $validate;
if (!Cache::isStored($cache_id)) {
$result = (int) Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(`id_product_comment`) AS "nbr"
FROM `' . _DB_PREFIX_ . 'product_comment` pc
WHERE `id_product` = ' . (int) ($id_product) . ($validate ? ' AND `validate` = 1' : ''));
Cache::store($cache_id, (string) $result);
}
return (int) Cache::retrieve($cache_id);
}
/**
* Return number of comments and average grade by products
*
* @return int|bool
*/
public static function getGradedCommentNumber($id_product)
{
if (!Validate::isUnsignedId($id_product)) {
return false;
}
$validate = (int) Configuration::get('PRODUCT_COMMENTS_MODERATE');
$result = Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getRow('
SELECT COUNT(pc.`id_product`) AS nbr
FROM `' . _DB_PREFIX_ . 'product_comment` pc
WHERE `id_product` = ' . (int) ($id_product) . ($validate == '1' ? ' AND `validate` = 1' : '') . '
AND `grade` > 0');
return (int) ($result['nbr']);
}
/**
* Get comments by Validation
*
* @return array Comments
*/
public static function getByValidate($validate = '0', $deleted = false, $p = null, $limit = null, $skip_validate = false)
{
$sql = '
SELECT pc.`id_product_comment`, pc.`id_product`, c.id_customer AS customer_id, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`title`, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
FROM `' . _DB_PREFIX_ . 'product_comment` pc
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = pc.`id_customer`)
LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = ' . (int) Context::getContext()->language->id . Shop::addSqlRestrictionOnLang('pl') . ')';
if (!$skip_validate) {
$sql .= ' WHERE pc.`validate` = ' . (int) $validate;
}
$sql .= ' ORDER BY pc.`date_add` DESC';
if ($p && $limit) {
$offset = ($p - 1) * $limit;
$sql .= ' LIMIT ' . (int) $offset . ',' . (int) $limit;
}
return Db::getInstance()->executeS($sql);
}
/**
* Get numbers of comments by Validation
*
* @return int Count of comments
*/
public static function getCountByValidate($validate = '0', $skip_validate = false)
{
$sql = '
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'product_comment`';
if (!$skip_validate) {
$sql .= ' WHERE `validate` = ' . (int) $validate;
}
return (int) Db::getInstance()->getValue($sql);
}
/**
* Get all comments
*
* @return array Comments
*/
public static function getAll()
{
return Db::getInstance()->executeS('
SELECT pc.`id_product_comment`, pc.`id_product`, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
FROM `' . _DB_PREFIX_ . 'product_comment` pc
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = pc.`id_customer`)
LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = ' . (int) Context::getContext()->language->id . Shop::addSqlRestrictionOnLang('pl') . ')
ORDER BY pc.`date_add` DESC');
}
/**
* Validate a comment
*
* @return bool succeed
*/
public function validate($validate = '1')
{
if (!Validate::isUnsignedId($this->id)) {
return false;
}
$success = (Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'product_comment` SET
`validate` = ' . (int) $validate . '
WHERE `id_product_comment` = ' . (int) $this->id));
Hook::exec('actionObjectProductCommentValidateAfter', ['object' => $this]);
return $success;
}
/**
* Delete a comment, grade and report data
*
* @return bool succeed
*/
public function delete()
{
return parent::delete()
&& ProductComment::deleteGrades($this->id)
&& ProductComment::deleteReports($this->id)
&& ProductComment::deleteUsefulness($this->id);
}
/**
* Delete Grades
*
* @return bool succeed
*/
public static function deleteGrades($id_product_comment)
{
if (!Validate::isUnsignedId($id_product_comment)) {
return false;
}
return Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_grade`
WHERE `id_product_comment` = ' . (int) $id_product_comment);
}
/**
* Delete Reports
*
* @return bool succeed
*/
public static function deleteReports($id_product_comment)
{
if (!Validate::isUnsignedId($id_product_comment)) {
return false;
}
return Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_report`
WHERE `id_product_comment` = ' . (int) $id_product_comment);
}
/**
* Delete usefulness
*
* @return bool succeed
*/
public static function deleteUsefulness($id_product_comment)
{
if (!Validate::isUnsignedId($id_product_comment)) {
return false;
}
return Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_usefulness`
WHERE `id_product_comment` = ' . (int) $id_product_comment);
}
/**
* Report comment
*
* @return bool
*/
public static function reportComment($id_product_comment, $id_customer)
{
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_report` (`id_product_comment`, `id_customer`)
VALUES (' . (int) $id_product_comment . ', ' . (int) $id_customer . ')');
}
/**
* Comment already report
*
* @return bool
*/
public static function isAlreadyReport($id_product_comment, $id_customer)
{
return (bool) Db::getInstance()->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'product_comment_report`
WHERE `id_customer` = ' . (int) $id_customer . '
AND `id_product_comment` = ' . (int) $id_product_comment);
}
/**
* Set comment usefulness
*
* @return bool
*/
public static function setCommentUsefulness($id_product_comment, $usefulness, $id_customer)
{
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_usefulness` (`id_product_comment`, `usefulness`, `id_customer`)
VALUES (' . (int) $id_product_comment . ', ' . (int) $usefulness . ', ' . (int) $id_customer . ')');
}
/**
* Usefulness already set
*
* @return bool
*/
public static function isAlreadyUsefulness($id_product_comment, $id_customer)
{
return (bool) Db::getInstance()->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'product_comment_usefulness`
WHERE `id_customer` = ' . (int) $id_customer . '
AND `id_product_comment` = ' . (int) $id_product_comment);
}
/**
* Get reported comments
*
* @return array Comments
*/
public static function getReportedComments()
{
return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS('
SELECT DISTINCT(pc.`id_product_comment`), pc.`id_product`, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`, pc.`title`
FROM `' . _DB_PREFIX_ . 'product_comment_report` pcr
LEFT JOIN `' . _DB_PREFIX_ . 'product_comment` pc
ON pcr.id_product_comment = pc.id_product_comment
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = pc.`id_customer`)
LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = ' . (int) Context::getContext()->language->id . ' AND pl.`id_lang` = ' . (int) Context::getContext()->language->id . Shop::addSqlRestrictionOnLang('pl') . ')
ORDER BY pc.`date_add` DESC');
}
}

View File

@@ -0,0 +1,284 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
class ProductCommentCriterion extends ObjectModel
{
const NAME_MAX_LENGTH = 64;
public $id;
public $id_product_comment_criterion_type;
public $name;
public $active = true;
/**
* @see ObjectModel::$definition
*/
public static $definition = [
'table' => 'product_comment_criterion',
'primary' => 'id_product_comment_criterion',
'multilang' => true,
'fields' => [
'id_product_comment_criterion_type' => ['type' => self::TYPE_INT],
'active' => ['type' => self::TYPE_BOOL],
// Lang fields
'name' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => self::NAME_MAX_LENGTH],
],
];
public function delete()
{
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)) {
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)) {
return false;
}
}
return Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_grade`
WHERE `id_product_comment_criterion` = ' . (int) $this->id);
}
public function update($nullValues = false)
{
$previousUpdate = new self((int) $this->id);
if (!parent::update($nullValues)) {
return false;
}
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);
} 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 true;
}
/**
* Link a Comment Criterion to a product
*
* @return bool succeed
*/
public function addProduct($id_product)
{
if (!Validate::isUnsignedId($id_product)) {
exit(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 . ')
');
}
/**
* Link a Comment Criterion to a category
*
* @return bool succeed
*/
public function addCategory($id_category)
{
if (!Validate::isUnsignedId($id_category)) {
exit(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 . ')
');
}
/**
* Add grade to a criterion
*
* @return bool succeed
*/
public function addGrade($id_product_comment, $grade)
{
if (!Validate::isUnsignedId($id_product_comment)) {
exit(Tools::displayError());
}
if ($grade < 0) {
$grade = 0;
} elseif ($grade > 10) {
$grade = 10;
}
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_grade`
(`id_product_comment`, `id_product_comment_criterion`, `grade`) VALUES(
' . (int) ($id_product_comment) . ',
' . (int) $this->id . ',
' . (int) ($grade) . ')');
}
/**
* Get criterion by Product
*
* @return array Criterion
*/
public static function getByProduct($id_product, $id_lang)
{
if (!Validate::isUnsignedId($id_product) ||
!Validate::isUnsignedId($id_lang)) {
exit(Tools::displayError());
}
$alias = 'p';
$table = '';
// check if version > 1.5 to add shop association
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$table = '_shop';
$alias = 'ps';
}
$cache_id = 'ProductCommentCriterion::getByProduct_' . (int) $id_product . '-' . (int) $id_lang;
if (!Cache::isStored($cache_id)) {
$result = 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
');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
}
/**
* Get Criterions
*
* @return array Criterions
*/
public static function getCriterions($id_lang, $type = false, $active = false)
{
if (!Validate::isUnsignedId($id_lang)) {
exit(Tools::displayError());
}
$sql = '
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';
$criterions = Db::getInstance()->executeS($sql);
$types = self::getTypes();
foreach ($criterions as $key => $data) {
$criterions[$key]['type_name'] = $types[$data['id_product_comment_criterion_type']];
}
return $criterions;
}
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);
$products = [];
if ($res) {
foreach ($res as $row) {
$products[] = (int) $row['id_product'];
}
}
return $products;
}
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);
$criterions = [];
if ($res) {
foreach ($res as $row) {
$criterions[] = (int) $row['id_category'];
}
}
return $criterions;
}
public function deleteCategories()
{
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);
}
public static function getTypes()
{
// Instance of module class for translations
$module = new ProductComments();
return [
1 => $module->getTranslator()->trans('Valid for the entire catalog', [], 'Modules.Productcomments.Admin'),
2 => $module->getTranslator()->trans('Restricted to some categories', [], 'Modules.Productcomments.Admin'),
3 => $module->getTranslator()->trans('Restricted to some products', [], 'Modules.Productcomments.Admin'),
];
}
}

View File

@@ -0,0 +1,192 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
class ProductCommentCriterion
{
/**
* Add a Comment Criterion
*
* @return bool succeed
*/
public static function add($id_lang, $name)
{
if (!Validate::isUnsignedId($id_lang) ||
!Validate::isMessage($name)) {
exit(Tools::displayError());
}
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_criterion`
(`id_lang`, `name`) VALUES(
' . (int) ($id_lang) . ',
\'' . pSQL($name) . '\')');
}
/**
* Link a Comment Criterion to a product
*
* @return bool succeed
*/
public static function addToProduct($id_product_comment_criterion, $id_product)
{
if (!Validate::isUnsignedId($id_product_comment_criterion) ||
!Validate::isUnsignedId($id_product)) {
exit(Tools::displayError());
}
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_criterion_product`
(`id_product_comment_criterion`, `id_product`) VALUES(
' . (int) ($id_product_comment_criterion) . ',
' . (int) ($id_product) . ')');
}
/**
* Add grade to a criterion
*
* @return bool succeed
*/
public static function addGrade($id_product_comment, $id_product_comment_criterion, $grade)
{
if (!Validate::isUnsignedId($id_product_comment) ||
!Validate::isUnsignedId($id_product_comment_criterion)) {
exit(Tools::displayError());
}
if ($grade < 0) {
$grade = 0;
} elseif ($grade > 10) {
$grade = 10;
}
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_grade`
(`id_product_comment`, `id_product_comment_criterion`, `grade`) VALUES(
' . (int) ($id_product_comment) . ',
' . (int) ($id_product_comment_criterion) . ',
' . (int) ($grade) . ')');
}
/**
* Update criterion
*
* @return bool succeed
*/
public static function update($id_product_comment_criterion, $id_lang, $name)
{
if (!Validate::isUnsignedId($id_product_comment_criterion) ||
!Validate::isUnsignedId($id_lang) ||
!Validate::isMessage($name)) {
exit(Tools::displayError());
}
return Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'product_comment_criterion` SET
`name` = \'' . pSQL($name) . '\'
WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion) . ' AND
`id_lang` = ' . (int) ($id_lang));
}
/**
* Get criterion by Product
*
* @return array Criterion
*/
public static function getByProduct($id_product, $id_lang)
{
if (!Validate::isUnsignedId($id_product) ||
!Validate::isUnsignedId($id_lang)) {
exit(Tools::displayError());
}
return Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pcc.`name`
FROM `' . _DB_PREFIX_ . 'product_comment_criterion` pcc
INNER JOIN `' . _DB_PREFIX_ . 'product_comment_criterion_product` pccp ON pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion`
WHERE pccp.`id_product` = ' . (int) ($id_product) . ' AND
pcc.`id_lang` = ' . (int) ($id_lang));
}
/**
* Get Criterions
*
* @return array Criterions
*/
public static function get($id_lang)
{
if (!Validate::isUnsignedId($id_lang)) {
exit(Tools::displayError());
}
return Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pcc.`name`
FROM `' . _DB_PREFIX_ . 'product_comment_criterion` pcc
WHERE pcc.`id_lang` = ' . (int) ($id_lang) . '
ORDER BY pcc.`name` ASC');
}
/**
* Delete product criterion by product
*
* @return bool succeed
*/
public static function deleteByProduct($id_product)
{
if (!Validate::isUnsignedId($id_product)) {
exit(Tools::displayError());
}
return Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_criterion_product`
WHERE `id_product` = ' . (int) ($id_product));
}
/**
* Delete all reference of a criterion
*
* @return bool succeed
*/
public static function delete($id_product_comment_criterion)
{
if (!Validate::isUnsignedId($id_product_comment_criterion)) {
exit(Tools::displayError());
}
$result = Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_grade`
WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion));
if ($result === false) {
return $result;
}
$result = Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_criterion_product`
WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion));
if ($result === false) {
return $result;
}
return Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'product_comment_criterion`
WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion));
}
}

View File

@@ -0,0 +1,42 @@
# Product Comments
## About
Allow users to post reviews on your products and/or rate them based on specific criteria.
## Multistore compatibility
This module is partially compatible with the multistore feature. Some of its options might not be available.
### Update dependency
The only dependency for this module (for now) is https://github.com/flaviusmatis/simplePagination.js.git
You can install/update it by launching the command
```
# yarn install
```
(We use yarn because this library is not served as a package for npm).
This will install the library js in views/js folder.
## Reporting issues
You can report issues with this module in the main PrestaShop repository. [Click here to report an issue][report-issue].
## Contributing
PrestaShop modules are open source extensions to the [PrestaShop e-commerce platform][prestashop]. Everyone is welcome and even encouraged to contribute with their own improvements!
Just make sure to follow our [contribution guidelines][contribution-guidelines].
## License
This module is released under the [Academic Free License 3.0][AFL-3.0]
[report-issue]: https://github.com/PrestaShop/PrestaShop/issues/new/choose
[prestashop]: https://www.prestashop.com/
[contribution-guidelines]: https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/project-modules/
[AFL-3.0]: https://opensource.org/licenses/AFL-3.0

View File

@@ -0,0 +1,35 @@
{
"name": "prestashop/productcomments",
"description": "PrestaShop module productcomments",
"homepage": "https://github.com/PrestaShop/productcomments",
"license": "AFL-3.0",
"authors": [
{
"name": "PrestaShop SA",
"email": "contact@prestashop.com"
}
],
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"prestashop/php-dev-tools": "^3.4"
},
"config": {
"preferred-install": "dist",
"classmap-authoritative": true,
"optimize-autoloader": true,
"prepend-autoloader": false,
"platform": {
"php": "5.6"
}
},
"autoload": {
"psr-4": {
"PrestaShop\\Module\\ProductComment\\": "src/"
},
"classmap": ["productcomments.php"],
"exclude-from-classmap": []
},
"type": "prestashop-module"
}

1680
modules/productcomments/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>productcomments</name>
<displayName><![CDATA[Product Comments]]></displayName>
<version><![CDATA[5.0.2]]></version>
<description><![CDATA[Allows users to post reviews and rate products on specific criteria.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,2 @@
imports:
- { resource: ../common.yml }

View File

@@ -0,0 +1,17 @@
services:
_defaults:
public: true
product_comment_criterion_repository:
class: PrestaShop\Module\ProductComment\Repository\ProductCommentCriterionRepository
arguments:
- '@doctrine.dbal.default_connection'
- '%database_prefix%'
product_comment_repository:
class: PrestaShop\Module\ProductComment\Repository\ProductCommentRepository
arguments:
- '@doctrine.dbal.default_connection'
- '%database_prefix%'
- '@=service("prestashop.adapter.legacy.configuration").get("PRODUCT_COMMENTS_ALLOW_GUESTS")'
- '@=service("prestashop.adapter.legacy.configuration").get("PRODUCT_COMMENTS_MINIMAL_TIME")'

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,2 @@
imports:
- { resource: ../common.yml }

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>productcomments</name>
<displayName><![CDATA[Komentarze produktu]]></displayName>
<version><![CDATA[5.0.2]]></version>
<description><![CDATA[Pozw&oacute;l użytkownikom publikować recenzje Twoich produkt&oacute;w i/lub oceniać je na podstawie określonych kryteri&oacute;w.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,66 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
use PrestaShop\Module\ProductComment\Repository\ProductCommentRepository;
class ProductCommentsCommentGradeModuleFrontController extends ModuleFrontController
{
public function display()
{
$idProducts = Tools::getValue('id_products');
/* @var ProductCommentRepository $productCommentRepository */
header('Content-Type: application/json');
if (!is_array($idProducts)) {
return $this->ajaxRender(null);
}
$idProducts = array_unique(array_map('intval', $idProducts));
$productCommentRepository = $this->context->controller->getContainer()->get('product_comment_repository');
$productsCommentsNb = $productCommentRepository->getCommentsNumberForProducts($idProducts, Configuration::get('PRODUCT_COMMENTS_MODERATE'));
$averageGrade = $productCommentRepository->getAverageGrades($idProducts, Configuration::get('PRODUCT_COMMENTS_MODERATE'));
$resultFormated = [];
foreach ($idProducts as $i => $id) {
$resultFormated[] = [
'id_product' => $id,
'comments_nb' => $productsCommentsNb[$id],
'average_grade' => $averageGrade[$id],
];
}
$this->ajaxRender(
json_encode(
[
'products' => $resultFormated,
]
)
);
}
}

View File

@@ -0,0 +1,94 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
use PrestaShop\Module\ProductComment\Repository\ProductCommentRepository;
class ProductCommentsListCommentsModuleFrontController extends ModuleFrontController
{
public function display()
{
$idProduct = (int) Tools::getValue('id_product');
$page = (int) Tools::getValue('page', 1);
$isLastNameAnonymous = Configuration::get('PRODUCT_COMMENTS_ANONYMISATION');
/** @var ProductCommentRepository $productCommentRepository */
$productCommentRepository = $this->context->controller->getContainer()->get('product_comment_repository');
$productComments = $productCommentRepository->paginate(
$idProduct,
$page,
(int) Configuration::get('PRODUCT_COMMENTS_COMMENTS_PER_PAGE'),
(bool) Configuration::get('PRODUCT_COMMENTS_MODERATE')
);
$productCommentsNb = $productCommentRepository->getCommentsNumber(
$idProduct,
(bool) Configuration::get('PRODUCT_COMMENTS_MODERATE')
);
$responseArray = [
'comments_nb' => $productCommentsNb,
'comments_per_page' => Configuration::get('PRODUCT_COMMENTS_COMMENTS_PER_PAGE'),
'comments' => [],
];
foreach ($productComments as $productComment) {
$dateAdd = new \DateTime($productComment['date_add'], new \DateTimeZone('UTC'));
$dateAdd->setTimezone(new \DateTimeZone(date_default_timezone_get()));
$dateFormatter = new \IntlDateFormatter(
$this->context->language->locale,
\IntlDateFormatter::SHORT,
\IntlDateFormatter::SHORT
);
$productComment['title'] = htmlentities($productComment['title']);
$productComment['content'] = htmlentities($productComment['content']);
$productComment['date_add'] = $dateFormatter->format($dateAdd);
if ($isLastNameAnonymous && isset($productComment['lastname'])) {
$productComment['lastname'] = substr($productComment['lastname'], 0, 1) . '.';
}
// if registered customer : return customer first and last name instead of using customer_name
if (!empty($productComment['lastname'])) {
$productComment['customer_name'] = htmlentities($productComment['firstname'] . ' ' . $productComment['lastname']);
} else {
$productComment['customer_name'] = htmlentities($productComment['customer_name']);
}
$usefulness = $productCommentRepository->getProductCommentUsefulness($productComment['id_product_comment']);
$productComment = array_merge($productComment, $usefulness);
if (empty($productComment['customer_name']) && !isset($productComment['firstname']) && !isset($productComment['lastname'])) {
$productComment['customer_name'] = $this->trans('Deleted account', [], 'Modules.Productcomments.Shop');
}
$responseArray['comments'][] = $productComment;
}
header('Content-Type: application/json');
$this->ajaxRender(
json_encode(
$responseArray
)
);
}
}

View File

@@ -0,0 +1,213 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
use Doctrine\ORM\EntityManagerInterface;
use PrestaShop\Module\ProductComment\Entity\ProductComment;
use PrestaShop\Module\ProductComment\Entity\ProductCommentCriterion;
use PrestaShop\Module\ProductComment\Entity\ProductCommentGrade;
use PrestaShop\Module\ProductComment\Repository\ProductCommentRepository;
class ProductCommentsPostCommentModuleFrontController extends ModuleFrontController
{
public function display()
{
header('Content-Type: application/json');
if (!(int) $this->context->cookie->id_customer && !Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS')) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans(
'You need to be [1]logged in[/1] or [2]create an account[/2] to post your review.',
[
'[1]' => '<a href="' . $this->context->link->getPageLink('my-account') . '">',
'[/1]' => '</a>',
'[2]' => '<a href="' . $this->context->link->getPageLink('authentication&create_account=1') . '">',
'[/2]' => '</a>',
],
'Modules.Productcomments.Shop'
),
]
)
);
return false;
}
$id_product = (int) Tools::getValue('id_product');
$comment_title = Tools::getValue('comment_title');
$comment_content = Tools::getValue('comment_content');
$customer_name = Tools::getValue('customer_name');
$criterions = (array) Tools::getValue('criterion');
/** @var ProductCommentRepository $productCommentRepository */
$productCommentRepository = $this->context->controller->getContainer()->get('product_comment_repository');
$isPostAllowed = $productCommentRepository->isPostAllowed(
$id_product,
(int) $this->context->cookie->id_customer,
(int) $this->context->cookie->id_guest
);
if (!$isPostAllowed) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans('You are not allowed to post a review at the moment, please try again later.', [], 'Modules.Productcomments.Shop'),
]
)
);
return false;
}
/** @var EntityManagerInterface $entityManager */
$entityManager = $this->container->get('doctrine.orm.entity_manager');
//Create product comment
$productComment = new ProductComment();
$productComment
->setProductId($id_product)
->setTitle($comment_title)
->setContent($comment_content)
->setCustomerName($customer_name)
->setCustomerId($this->context->cookie->id_customer)
->setGuestId($this->context->cookie->id_guest)
->setDateAdd(new \DateTime('now', new \DateTimeZone('UTC')))
;
//Validate comment
$errors = array_merge($this->validateComment($productComment), $this->validateCriterions($criterions));
if (!empty($errors)) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'errors' => $errors,
]
)
);
return false;
}
$entityManager->persist($productComment);
$this->addCommentGrades($productComment, $criterions);
$entityManager->flush();
$this->ajaxRender(
json_encode(
[
'success' => true,
'product_comment' => $productComment->toArray(),
]
)
);
}
/**
* @param ProductComment $productComment
* @param array $criterions
*
* @throws Exception
*/
private function addCommentGrades(ProductComment $productComment, array $criterions)
{
/** @var EntityManagerInterface $entityManager */
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$criterionRepository = $entityManager->getRepository(ProductCommentCriterion::class);
$averageGrade = 0;
foreach ($criterions as $criterionId => $grade) {
$criterion = $criterionRepository->findOneBy(['id' => $criterionId]);
$criterionGrade = new ProductCommentGrade(
$productComment,
$criterion,
$grade
);
$entityManager->persist($criterionGrade);
$averageGrade += $grade;
}
$averageGrade /= count($criterions);
$productComment->setGrade($averageGrade);
}
/**
* Manual validation for now, this would be nice to use Symfony validator with the annotation
*
* @param ProductComment $productComment
*
* @return array
*/
private function validateComment(ProductComment $productComment)
{
$errors = [];
if (empty($productComment->getTitle())) {
$errors[] = $this->trans('Title cannot be empty', [], 'Modules.Productcomments.Shop');
} elseif (strlen($productComment->getTitle()) > ProductComment::TITLE_MAX_LENGTH) {
$errors[] = $this->trans('Title cannot be more than %s characters', [ProductComment::TITLE_MAX_LENGTH], 'Modules.Productcomments.Shop');
}
if (!$productComment->getCustomerId()) {
if (empty($productComment->getCustomerName())) {
$errors[] = $this->trans('Customer name cannot be empty', [], 'Modules.Productcomments.Shop');
} elseif (strlen($productComment->getCustomerName()) > ProductComment::CUSTOMER_NAME_MAX_LENGTH) {
$errors[] = $this->trans('Customer name cannot be more than %s characters', [ProductComment::CUSTOMER_NAME_MAX_LENGTH], 'Modules.Productcomments.Shop');
}
}
return $errors;
}
/**
* Valdiate criterions values
*
* @todo manage validation for criterion restricted on categories or products
*
* @param array $criterions
*
* @return array
*/
private function validateCriterions(array $criterions)
{
$errors = [];
/** @var EntityManagerInterface $entityManager */
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$criterionRepository = $entityManager->getRepository(ProductCommentCriterion::class);
foreach ($criterions as $criterionId => $grade) {
// @todo manage validation for criterion restricted on categories or products
$criterion = $criterionRepository->findOneBy(['id' => $criterionId]);
if (empty($criterion)) {
$errors[] = $this->trans('Criterions not available', [], 'Modules.Productcomments.Shop');
}
}
return $errors;
}
}

View File

@@ -0,0 +1,107 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
use Doctrine\ORM\EntityManagerInterface;
use PrestaShop\Module\ProductComment\Entity\ProductComment;
use PrestaShop\Module\ProductComment\Entity\ProductCommentReport;
class ProductCommentsReportCommentModuleFrontController extends ModuleFrontController
{
public function display()
{
header('Content-Type: application/json');
$customerId = (int) $this->context->cookie->id_customer;
if (!$customerId) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans('You need to be logged in to report a review.', [], 'Modules.Productcomments.Shop'),
]
)
);
return false;
}
$id_product_comment = (int) Tools::getValue('id_product_comment');
/** @var EntityManagerInterface $entityManager */
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$productCommentEntityRepository = $entityManager->getRepository(ProductComment::class);
/** @var ProductComment|null $productComment */
$productComment = $productCommentEntityRepository->findOneBy(['id' => $id_product_comment]);
if (!$productComment) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans('Cannot find the requested product review.', [], 'Modules.Productcomments.Shop'),
]
)
);
return false;
}
$productCommentAbuseRepository = $entityManager->getRepository(ProductCommentReport::class);
/** @var ProductCommentReport|null $productCommentAbuse */
$productCommentAbuse = $productCommentAbuseRepository->findOneBy([
'comment' => $id_product_comment,
'customerId' => $customerId,
]);
if ($productCommentAbuse) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans('You already reported this review as abusive.', [], 'Modules.Productcomments.Shop'),
]
)
);
return false;
}
$productCommentAbuse = new ProductCommentReport(
$productComment,
$customerId
);
$entityManager->persist($productCommentAbuse);
$entityManager->flush();
$this->ajaxRender(
json_encode(
[
'success' => true,
'id_product_comment' => $id_product_comment,
]
)
);
}
}

View File

@@ -0,0 +1,130 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
use Doctrine\ORM\EntityManagerInterface;
use PrestaShop\Module\ProductComment\Entity\ProductComment;
use PrestaShop\Module\ProductComment\Entity\ProductCommentUsefulness;
use PrestaShop\Module\ProductComment\Repository\ProductCommentRepository;
class ProductCommentsUpdateCommentUsefulnessModuleFrontController extends ModuleFrontController
{
public function display()
{
header('Content-Type: application/json');
if (!Configuration::get('PRODUCT_COMMENTS_USEFULNESS')) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans('This feature is not enabled.', [], 'Modules.Productcomments.Shop'),
]
)
);
return false;
}
$customerId = (int) $this->context->cookie->id_customer;
if (!$customerId) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans(
'You need to be [1]logged in[/1] or [2]create an account[/2] to give your appreciation of a review.',
[
'[1]' => '<a href="' . $this->context->link->getPageLink('my-account') . '">',
'[/1]' => '</a>',
'[2]' => '<a href="' . $this->context->link->getPageLink('authentication&create_account=1') . '">',
'[/2]' => '</a>',
],
'Modules.Productcomments.Shop'
),
]
)
);
return false;
}
$id_product_comment = (int) Tools::getValue('id_product_comment');
$usefulness = (bool) Tools::getValue('usefulness');
/** @var EntityManagerInterface $entityManager */
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$productCommentEntityRepository = $entityManager->getRepository(ProductComment::class);
/** @var ProductComment|null $productComment */
$productComment = $productCommentEntityRepository->findOneBy(['id' => $id_product_comment]);
if (!$productComment) {
$this->ajaxRender(
json_encode(
[
'success' => false,
'error' => $this->trans('Cannot find the requested product review.', [], 'Modules.Productcomments.Shop'),
]
)
);
return false;
}
$productCommentUsefulnesRepository = $entityManager->getRepository(ProductCommentUsefulness::class);
/** @var ProductCommentUsefulness|null $productCommentUsefulness */
$productCommentUsefulness = $productCommentUsefulnesRepository->findOneBy([
'comment' => $id_product_comment,
'customerId' => $customerId,
]);
if ($productCommentUsefulness) {
$productCommentUsefulness->setUsefulness($usefulness);
} else {
$productCommentUsefulness = new ProductCommentUsefulness(
$productComment,
$customerId,
$usefulness
);
$entityManager->persist($productCommentUsefulness);
}
$entityManager->flush();
/** @var ProductCommentRepository $productCommentRepository */
$productCommentRepository = $this->context->controller->getContainer()->get('product_comment_repository');
$commentUsefulness = $productCommentRepository->getProductCommentUsefulness($id_product_comment);
$this->ajaxRender(
json_encode(
array_merge(
[
'success' => true,
'id_product_comment' => $id_product_comment,
],
$commentUsefulness
)
)
);
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,75 @@
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment` (
`id_product_comment` int(10) unsigned NOT NULL auto_increment,
`id_product` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
`id_guest` int(10) unsigned NULL,
`title` varchar(64) NULL,
`content` text NOT NULL,
`customer_name` varchar(64) NULL,
`grade` float unsigned NOT NULL,
`validate` tinyint(1) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`date_add` datetime NOT NULL,
PRIMARY KEY (`id_product_comment`),
KEY `id_product` (`id_product`),
KEY `id_customer` (`id_customer`),
KEY `id_guest` (`id_guest`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion` (
`id_product_comment_criterion` int(10) unsigned NOT NULL auto_increment,
`id_product_comment_criterion_type` tinyint(1) NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_product` (
`id_product` int(10) unsigned NOT NULL,
`id_product_comment_criterion` int(10) unsigned NOT NULL,
PRIMARY KEY(`id_product`, `id_product_comment_criterion`),
KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_lang` (
`id_product_comment_criterion` INT(11) UNSIGNED NOT NULL ,
`id_lang` INT(11) UNSIGNED NOT NULL ,
`name` VARCHAR(64) NOT NULL ,
PRIMARY KEY ( `id_product_comment_criterion` , `id_lang` )
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_category` (
`id_product_comment_criterion` int(10) unsigned NOT NULL,
`id_category` int(10) unsigned NOT NULL,
PRIMARY KEY(`id_product_comment_criterion`, `id_category`),
KEY `id_category` (`id_category`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_grade` (
`id_product_comment` int(10) unsigned NOT NULL,
`id_product_comment_criterion` int(10) unsigned NOT NULL,
`grade` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`),
KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_usefulness` (
`id_product_comment` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
`usefulness` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_report` (
`id_product_comment` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `PREFIX_product_comment_criterion` VALUES ('1', '1', '1');
INSERT IGNORE INTO `PREFIX_product_comment_criterion_lang` (`id_product_comment_criterion`, `id_lang`, `name`)
(
SELECT '1', l.`id_lang`, 'Quality'
FROM `PREFIX_lang` l
);

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,127 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
function getCommentForm()
{
if (document.forms)
return (document.forms['comment_form']);
else
return (document.comment_form);
}
function getCommentDeleteForm()
{
if (document.forms)
return (document.forms['delete_comment_form']);
else
return (document.delete_comment_form);
}
function acceptComment(id)
{
var form = getCommentForm();
if (id)
form.elements['id_product_comment'].value = id;
form.elements['action'].value = 'accept';
form.submit();
}
function deleteComment(id)
{
var form = getCommentForm();
if (id)
form.elements['id_product_comment'].value = id;
form.elements['action'].value = 'delete';
form.submit();
}
function delComment(id, confirmation)
{
var answer = confirm(confirmation);
if (answer)
{
var form = getCommentDeleteForm();
if (id)
form.elements['delete_id_product_comment'].value = id;
form.elements['delete_action'].value = 'delete';
form.submit();
}
}
function getCriterionForm()
{
if (document.forms)
return (document.forms['criterion_form']);
else
return (document.criterion_form);
}
function editCriterion(id)
{
var form = getCriterionForm();
form.elements['id_product_comment_criterion'].value = id;
form.elements['criterion_name'].value = document.getElementById('criterion_name_' + id).value;
form.elements['criterion_action'].value = 'edit';
form.submit();
}
function deleteCriterion(id)
{
var form = getCriterionForm();
form.elements['id_product_comment_criterion'].value = id;
form.elements['criterion_action'].value = 'delete';
form.submit();
}
$( document ).ready(function() {
$('select#id_product_comment_criterion_type').change(function() {
// PS 1.6
$('#categoryBox').closest('div.form-group').hide();
$('#ids_product').closest('div.form-group').hide();
// PS 1.5
$('#categories-treeview').closest('div.margin-form').hide();
$('#categories-treeview').closest('div.margin-form').prev().hide();
$('#ids_product').closest('div.margin-form').hide();
$('#ids_product').closest('div.margin-form').prev().hide();
if (this.value == 2)
{
$('#categoryBox').closest('div.form-group').show();
// PS 1.5
$('#categories-treeview').closest('div.margin-form').show();
$('#categories-treeview').closest('div.margin-form').prev().show();
}
else if (this.value == 3)
{
$('#ids_product').closest('div.form-group').show();
// PS 1.5
$('#ids_product').closest('div.margin-form').show();
$('#ids_product').closest('div.margin-form').prev().show();
}
});
$('select#id_product_comment_criterion_type').trigger( "change" );
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,29 @@
{
"name": "productcomments",
"description": "Allows users to post reviews and rate products on specific criteria.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"install": "cp node_modules/simplePagination.js/jquery.simplePagination.js views/js/jquery.simplePagination.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/PrestaShop/productcomments.git"
},
"keywords": [
"product",
"comments",
"reviews",
"rate",
"grade"
],
"author": "PrestaShop",
"license": "AFL-3.0",
"bugs": {
"url": "https://github.com/PrestaShop/productcomments/issues"
},
"homepage": "https://github.com/PrestaShop/productcomments#readme",
"dependencies": {
"simplePagination.js": "https://github.com/flaviusmatis/simplePagination.js.git"
}
}

View File

@@ -0,0 +1,249 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
#product_comments_block_extra {
padding:10px 0 0 0;
border-top:1px solid #ccc;
font-weight: bold;
font-size:12px;
line-height:18px
}
#product_comments_block_extra a {
padding-left: 10px;
text-decoration: none;
background: url(img/bg_li.png) no-repeat scroll 1px 45% #fff;
}
#product_comments_block_extra a:hover {text-decoration: underline}
#product_comments_block_extra .comments-note {margin-bottom:5px}
#product_comments_block_extra .comments-note span,
#product_comments_block_extra .star-content {float:left}
#product_comments_block_extra .star-content {margin-top:2px}
#product_comments_block_extra div.star {background: url(img/star.gif) no-repeat scroll 0 0 transparent}
#product_comments_block_extra div.star_on {background: url(img/star.gif) no-repeat scroll 0 -12px transparent}
#product_comments_block_extra .comments_advices {clear:both;}
/* pop-in add grade/advice ********************************************************************* */
#fancybox-wrap { width:585px }
#fancybox-content {
width:585px;
border-width:0
}
#new_comment_form {
width:585px;
color: #333;
text-align: left;
background-color: #fff
}
#new_comment_form .title {
padding:10px;
font-size: 13px;
color: #fff;
text-transform: uppercase;
background: #333
}
#new_comment_form ul.grade_content {list-style-type:none}
#new_comment_form .grade_content li {width:50%}
#new_comment_form .product {padding:15px}
#new_comment_form .product img {
float:left;
border: 1px solid #ccc;
}
#new_comment_form .product .product_desc {
float:left;
margin-left:15px;
width:300px;
line-height:18px;
color:#666
}
#new_comment_form .product .product_desc .product_name {
padding-bottom:5px;
font-size:13px;
color:#000
}
#new_comment_form .grade_content {margin:0 0 20px 0}
#new_comment_form .grade_content span,
#new_comment_form .grade_content span {
display:inline-block;
padding:0 10px;
width:150px;/* 160 */
font-weight:bold
}
#new_comment_form .grade_content .cancel {margin-right:5px}
.new_comment_form_content {
padding:15px;
background:#f8f8f8
}
.new_comment_form_content .intro_form {
padding-bottom: 10px;
font-weight: bold;
font-size: 12px
}
#new_comment_form label {
display: block;
margin:12px 0 4px 0;
font-weight: bold;
font-size: 12px;
}
#new_comment_form input {
padding: 0 5px;
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 {
margin-top:20px;
padding:0;
font-size:13px;
text-align:right
}
#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;
background: url(img/bg_bt.gif) repeat-x scroll 0 0 #F4B61B
}
#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 ******************************************************************************** */
#product_comments_block_tab {margin:0 0 20px 0}
#product_comments_block_tab div.comment {
margin:0 0 10px 0;
padding: 5px;
border-bottom: 1px dotted #ccc
}
#product_comments_block_tab div.comment div.comment_author {
float: left;
padding-right:25px;
width: 140px;/* 165 */
line-height:18px
}
#product_comments_block_tab div.comment div.comment_author span {font-weight:bold;}
#product_comments_block_tab div.comment div.comment_author span,
#product_comments_block_tab div.comment .star-content {
float:left;
}
#product_comments_block_tab div.comment .star-content {margin: 0 0 0 5px}
#product_comments_block_tab div.star,
#product_comments_block_tab div.star_on {
background: url(img/star.gif) no-repeat 0 0 transparent
}
#product_comments_block_tab div.star_on {background-position: 0 -12px}
#product_comments_block_tab .comment_author_infos {clear:both}
#product_comments_block_tab .comment_author_infos em {color:#999}
#product_comments_block_tab div.comment div.comment_details {
float: left;
overflow:hidden;
width: 360px
}
#product_comments_block_tab div.comment_details .title_block, #product_comments_block_tab div.comment_details h4 {padding-bottom:10px}
#product_comments_block_tab div.comment_details p {padding-bottom:10px}
#product_comments_block_tab div.comment_details ul {
list-style-type:none;
margin:0
}
#product_comments_block_tab div.comment_details li {
padding:2px 0 2px 12px;
background:url(img/bg_li.png) no-repeat 1px 45% #fff
}
#product_comments_block_tab a {
text-decoration: none;
font-weight: bold
}
#product_comments_block_tab a:hover {text-decoration: underline}
#product_comments_block_tab button.usefulness_btn {
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;
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}
.fl { float: left; }
.fr { float: right; }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,346 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
namespace PrestaShop\Module\ProductComment\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table()
* @ORM\Entity()
*/
class ProductComment
{
const TITLE_MAX_LENGTH = 64;
const CUSTOMER_NAME_MAX_LENGTH = 64;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id_product_comment", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var int
*
* @ORM\Column(name="id_product", type="integer")
*/
private $productId;
/**
* @var int
*
* @ORM\Column(name="id_customer", type="integer")
*/
private $customerId;
/**
* @var int
*
* @ORM\Column(name="id_guest", type="integer")
*/
private $guestId;
/**
* @var string
*
* @ORM\Column(name="customer_name", type="string", length=64)
*/
private $customerName;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=64)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="content", type="text")
*/
private $content;
/**
* @var int
*
* @ORM\Column(name="grade", type="integer")
*/
private $grade;
/**
* @var bool
*
* @ORM\Column(name="validate", type="boolean")
*/
private $validate = false;
/**
* @var bool
*
* @ORM\Column(name="deleted", type="boolean")
*/
private $deleted = false;
/**
* @var \DateTime
*
* @ORM\Column(name="date_add", type="datetime")
*/
private $dateAdd;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return int
*/
public function getProductId()
{
return $this->productId;
}
/**
* @param int $productId
*
* @return ProductComment
*/
public function setProductId($productId)
{
$this->productId = $productId;
return $this;
}
/**
* @return int
*/
public function getCustomerId()
{
return $this->customerId;
}
/**
* @param int $customerId
*
* @return ProductComment
*/
public function setCustomerId($customerId)
{
$this->customerId = $customerId;
return $this;
}
/**
* @return int
*/
public function getGuestId()
{
return $this->guestId;
}
/**
* @param int $guestId
*
* @return ProductComment
*/
public function setGuestId($guestId)
{
$this->guestId = $guestId;
return $this;
}
/**
* @return string
*/
public function getCustomerName()
{
return $this->customerName;
}
/**
* @param string $customerName
*
* @return ProductComment
*/
public function setCustomerName($customerName)
{
$this->customerName = $customerName;
return $this;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*
* @return ProductComment
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* @param string $content
*
* @return ProductComment
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* @return int
*/
public function getGrade()
{
return $this->grade;
}
/**
* @param int $grade
*
* @return ProductComment
*/
public function setGrade($grade)
{
$this->grade = $grade;
return $this;
}
/**
* @return bool
*/
public function isValidate()
{
return $this->validate;
}
/**
* @param bool $validate
*
* @return ProductComment
*/
public function setValidate($validate)
{
$this->validate = $validate;
return $this;
}
/**
* @return bool
*/
public function isDeleted()
{
return $this->deleted;
}
/**
* @param bool $deleted
*
* @return ProductComment
*/
public function setDeleted($deleted)
{
$this->deleted = $deleted;
return $this;
}
/**
* @return \DateTime
*/
public function getDateAdd()
{
return $this->dateAdd;
}
/**
* Date is stored in UTC timezone
*
* @param \DateTime $dateAdd
*
* @return ProductComment
*/
public function setDateAdd($dateAdd)
{
$this->dateAdd = $dateAdd;
return $this;
}
/**
* @return array
*/
public function toArray()
{
return [
'id_product' => $this->getProductId(),
'id_product_comment' => $this->getId(),
'title' => $this->getTitle(),
'content' => $this->getContent(),
'customer_name' => $this->getCustomerName(),
'date_add' => $this->dateAdd->format(\DateTime::ATOM),
'grade' => $this->grade,
'usefulness' => 3,
'total_usefulness' => 5,
];
}
}

View File

@@ -0,0 +1,111 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
namespace PrestaShop\Module\ProductComment\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table()
* @ORM\Entity()
*/
class ProductCommentCriterion
{
const ENTIRE_CATALOG_TYPE = 1;
const CATEGORIES_TYPE = 2;
const PRODUCTS_TYPE = 3;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id_product_comment_criterion", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var int
*
* @ORM\Column(name="id_product_comment_criterion_type", type="integer")
*/
private $type;
/**
* @var bool
*
* @ORM\Column(name="active", type="boolean")
*/
private $active = false;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return int
*/
public function getType()
{
return $this->type;
}
/**
* @param int $type
*
* @return ProductCommentCriterion
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* @return bool
*/
public function isActive()
{
return $this->active;
}
/**
* @param bool $active
*
* @return ProductCommentCriterion
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
}

View File

@@ -0,0 +1,88 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
namespace PrestaShop\Module\ProductComment\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table()
* @ORM\Entity()
*/
class ProductCommentGrade
{
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="ProductComment")
* @ORM\JoinColumn(name="id_product_comment", referencedColumnName="id_product_comment")
*/
private $comment;
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="ProductCommentCriterion")
* @ORM\JoinColumn(name="id_product_comment_criterion", referencedColumnName="id_product_comment_criterion")
*/
private $criterion;
/**
* @var int
*
* @ORM\Column(name="grade", type="integer")
*/
private $grade;
/**
* @param ProductComment $comment
* @param ProductCommentCriterion $criterion
* @param int $grade
*/
public function __construct(
ProductComment $comment,
ProductCommentCriterion $criterion,
$grade
) {
$this->comment = $comment;
$this->criterion = $criterion;
$this->grade = $grade;
}
/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}
/**
* @return mixed
*/
public function getCriterion()
{
return $this->criterion;
}
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
namespace PrestaShop\Module\ProductComment\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table()
* @ORM\Entity()
*/
class ProductCommentReport
{
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="ProductComment")
* @ORM\JoinColumn(name="id_product_comment", referencedColumnName="id_product_comment")
*
* @var ProductComment
*/
private $comment;
/**
* @ORM\Id
* @ORM\Column(name="id_customer", type="integer")
*
* @var int
*/
private $customerId;
/**
* @param ProductComment $comment
* @param int $customerId
*/
public function __construct(
ProductComment $comment,
$customerId
) {
$this->comment = $comment;
$this->customerId = $customerId;
}
/**
* @return ProductComment
*/
public function getComment()
{
return $this->comment;
}
/**
* @return int
*/
public function getCustomerId()
{
return $this->customerId;
}
}

View File

@@ -0,0 +1,109 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
namespace PrestaShop\Module\ProductComment\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table()
* @ORM\Entity()
*/
class ProductCommentUsefulness
{
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="ProductComment")
* @ORM\JoinColumn(name="id_product_comment", referencedColumnName="id_product_comment")
*/
private $comment;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id_customer", type="integer")
*/
private $customerId;
/**
* @var bool
*
* @ORM\Column(name="usefulness", type="boolean")
*/
private $usefulness;
/**
* @param ProductComment $comment
* @param int $customerId
* @param bool $usefulness
*/
public function __construct(
ProductComment $comment,
$customerId,
$usefulness
) {
$this->comment = $comment;
$this->customerId = $customerId;
$this->usefulness = $usefulness;
}
/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}
/**
* @return int
*/
public function getCustomerId()
{
return $this->customerId;
}
/**
* @return bool
*/
public function isUsefulness()
{
return $this->usefulness;
}
/**
* @param bool $usefulness
*
* @return ProductCommentUsefulness
*/
public function setUsefulness($usefulness)
{
$this->usefulness = $usefulness;
return $this;
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,91 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
namespace PrestaShop\Module\ProductComment\Repository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Query\QueryBuilder;
use PrestaShop\Module\ProductComment\Entity\ProductCommentCriterion;
class ProductCommentCriterionRepository
{
/**
* @var Connection the Database connection
*/
private $connection;
/**
* @var string the Database prefix
*/
private $databasePrefix;
/**
* @param Connection $connection
* @param string $databasePrefix
*/
public function __construct(Connection $connection, $databasePrefix)
{
$this->connection = $connection;
$this->databasePrefix = $databasePrefix;
}
/**
* @param int $idProduct
* @param int $idLang
*
* @return array
*
* @throws \PrestaShopException
*/
public function getByProduct($idProduct, $idLang)
{
/** @var QueryBuilder $qb */
$qb = $this->connection->createQueryBuilder();
$qb
->select('pcc.id_product_comment_criterion, pccl.name')
->from($this->databasePrefix . 'product_comment_criterion', 'pcc')
->leftJoin('pcc', $this->databasePrefix . 'product_comment_criterion_lang', 'pccl', 'pcc.id_product_comment_criterion = pccl.id_product_comment_criterion')
->leftJoin('pcc', $this->databasePrefix . 'product_comment_criterion_product', 'pccp', 'pcc.id_product_comment_criterion = pccp.id_product_comment_criterion')
->leftJoin('pcc', $this->databasePrefix . 'product_comment_criterion_category', 'pccc', 'pcc.id_product_comment_criterion = pccc.id_product_comment_criterion')
->leftJoin('pccc', $this->databasePrefix . 'category', 'c', 'pccc.id_category = c.id_category')
->leftJoin('c', $this->databasePrefix . 'category_product', 'cp', 'c.id_category = cp.id_category')
->andWhere($qb->expr()->orX(
$qb->expr()->eq('pcc.id_product_comment_criterion_type', ':catalog_type'),
$qb->expr()->eq('pccp.id_product', ':id_product'),
$qb->expr()->eq('cp.id_product', ':id_product')
))
->andWhere('pccl.id_lang = :id_lang')
->andWhere('pcc.active = :active')
->setParameter('catalog_type', ProductCommentCriterion::ENTIRE_CATALOG_TYPE)
->setParameter('active', 1)
->setParameter('id_product', $idProduct)
->setParameter('id_lang', $idLang)
->addGroupBy('pcc.id_product_comment_criterion')
;
return $qb->execute()->fetchAll();
}
}

View File

@@ -0,0 +1,419 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
namespace PrestaShop\Module\ProductComment\Repository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Query\QueryBuilder;
class ProductCommentRepository
{
/**
* @var Connection the Database connection
*/
private $connection;
/**
* @var string the Database prefix
*/
private $databasePrefix;
/**
* @var bool
*/
private $guestCommentsAllowed;
/**
* @var int
*/
private $commentsMinimalTime;
const DEFAULT_COMMENTS_PER_PAGE = 5;
/**
* @param Connection $connection
* @param string $databasePrefix
* @param bool $guestCommentsAllowed
* @param int $commentsMinimalTime
*/
public function __construct(
Connection $connection,
$databasePrefix,
$guestCommentsAllowed,
$commentsMinimalTime
) {
$this->connection = $connection;
$this->databasePrefix = $databasePrefix;
$this->guestCommentsAllowed = (bool) $guestCommentsAllowed;
$this->commentsMinimalTime = (int) $commentsMinimalTime;
}
/**
* @param int $productId
* @param int $page
* @param int $commentsPerPage
* @param bool $validatedOnly
*
* @return array
*/
public function paginate($productId, $page, $commentsPerPage, $validatedOnly)
{
if (empty($commentsPerPage)) {
$commentsPerPage = self::DEFAULT_COMMENTS_PER_PAGE;
}
/** @var QueryBuilder $qb */
$qb = $this->connection->createQueryBuilder();
$qb
->addSelect('pc.id_product, pc.id_product_comment, pc.title, pc.content, pc.customer_name, pc.date_add, pc.grade')
->addSelect('c.firstname, c.lastname')
->from($this->databasePrefix . 'product_comment', 'pc')
->leftJoin('pc', $this->databasePrefix . 'customer', 'c', 'pc.id_customer = c.id_customer AND c.deleted = :not_deleted')
->andWhere('pc.id_product = :id_product')
->andWhere('pc.deleted = :not_deleted')
->setParameter('not_deleted', 0)
->setParameter('id_product', $productId)
->setMaxResults($commentsPerPage)
->setFirstResult(($page - 1) * $commentsPerPage)
->addGroupBy('pc.id_product_comment')
->addOrderBy('pc.date_add', 'DESC')
;
if ($validatedOnly) {
$qb
->andWhere('pc.validate = :validate')
->setParameter('validate', 1)
;
}
return $qb->execute()->fetchAll();
}
/**
* @param int $productCommentId
*
* @return array
*/
public function getProductCommentUsefulness($productCommentId)
{
/** @var QueryBuilder $qb */
$qb = $this->connection->createQueryBuilder();
$qb
->addSelect('pcu.usefulness')
->from($this->databasePrefix . 'product_comment_usefulness', 'pcu')
->andWhere('pcu.id_product_comment = :id_product_comment')
->setParameter('id_product_comment', $productCommentId)
;
$usefulnessInfos = [
'usefulness' => 0,
'total_usefulness' => 0,
];
$customerAppreciations = $qb->execute()->fetchAll();
foreach ($customerAppreciations as $customerAppreciation) {
if ((int) $customerAppreciation['usefulness']) {
++$usefulnessInfos['usefulness'];
}
++$usefulnessInfos['total_usefulness'];
}
return $usefulnessInfos;
}
/**
* @param int $productId
* @param bool $validatedOnly
*
* @return float
*/
public function getAverageGrade($productId, $validatedOnly)
{
/** @var QueryBuilder $qb */
$qb = $this->connection->createQueryBuilder();
$qb
->select('SUM(pc.grade) / COUNT(pc.grade) AS averageGrade')
->from($this->databasePrefix . 'product_comment', 'pc')
->andWhere('pc.id_product = :id_product')
->andWhere('pc.deleted = :deleted')
->setParameter('deleted', 0)
->setParameter('id_product', $productId)
;
if ($validatedOnly) {
$qb
->andWhere('pc.validate = :validate')
->setParameter('validate', 1)
;
}
return (float) $qb->execute()->fetchColumn();
}
/**
* @param array $productIds
* @param bool $validatedOnly
*
* @return array
*/
public function getAverageGrades(array $productIds, $validatedOnly)
{
$sql = 'SELECT';
$count = count($productIds);
foreach ($productIds as $index => $id) {
$esqID = (int) $id;
$sql .= ' SUM(IF(id_product = ' . $esqID . ' AND deleted = 0';
if ($validatedOnly) {
$sql .= ' AND validate = 1';
}
$sql .= ',grade, 0))';
$sql .= ' / SUM(IF(id_product = ' . $esqID . ' AND deleted = 0';
if ($validatedOnly) {
$sql .= ' AND validate = 1';
}
$sql .= ',1, 0)) AS "' . $esqID . '"';
if ($count - 1 > $index) {
$sql .= ',';
}
}
$sql .= ' FROM ' . $this->databasePrefix . 'product_comment';
$query = $this->connection->prepare($sql);
$query->execute();
return (array) $query->fetch();
}
/**
* @param int $productId
* @param bool $validatedOnly
*
* @return int
*/
public function getCommentsNumber($productId, $validatedOnly)
{
/** @var QueryBuilder $qb */
$qb = $this->connection->createQueryBuilder();
$qb
->select('COUNT(pc.id_product_comment) AS commentNb')
->from($this->databasePrefix . 'product_comment', 'pc')
->andWhere('pc.id_product = :id_product')
->andWhere('pc.deleted = :deleted')
->setParameter('deleted', 0)
->setParameter('id_product', $productId)
;
if ($validatedOnly) {
$qb
->andWhere('pc.validate = :validate')
->setParameter('validate', 1)
;
}
return (int) $qb->execute()->fetchColumn();
}
/**
* @param array $productIds
* @param bool $validatedOnly
*
* @return array
*/
public function getCommentsNumberForProducts(array $productIds, $validatedOnly)
{
$sql = 'SELECT';
$count = count($productIds);
foreach ($productIds as $index => $id) {
$esqID = (int) $id;
$sql .= ' SUM(IF(id_product = ' . $esqID . ' AND deleted = 0';
if ($validatedOnly) {
$sql .= ' AND validate = 1';
}
$sql .= ' ,1, 0)) AS "' . $esqID . '"';
if ($count - 1 > $index) {
$sql .= ',';
}
}
$sql .= ' FROM ' . $this->databasePrefix . 'product_comment';
// return $sql;
$query = $this->connection->prepare($sql);
$query->execute();
return (array) $query->fetch();
}
/**
* @param int $productId
* @param int $idCustomer
* @param int $idGuest
*
* @return bool
*/
public function isPostAllowed($productId, $idCustomer, $idGuest)
{
if (!$idCustomer && !$this->guestCommentsAllowed) {
$postAllowed = false;
} else {
$lastCustomerComment = null;
if ($idCustomer) {
$lastCustomerComment = $this->getLastCustomerComment($productId, $idCustomer);
} elseif ($idGuest) {
$lastCustomerComment = $this->getLastGuestComment($productId, $idGuest);
}
$postAllowed = true;
if (null !== $lastCustomerComment && isset($lastCustomerComment['date_add'])) {
$postDate = new \DateTime($lastCustomerComment['date_add'], new \DateTimeZone('UTC'));
if (time() - $postDate->getTimestamp() < $this->commentsMinimalTime) {
$postAllowed = false;
}
}
}
return $postAllowed;
}
/**
* @param int $productId
* @param int $idCustomer
*
* @return array
*/
public function getLastCustomerComment($productId, $idCustomer)
{
return $this->getLastComment(['id_product' => $productId, 'id_customer' => $idCustomer]);
}
/**
* @param int $productId
* @param int $idGuest
*
* @return array
*/
public function getLastGuestComment($productId, $idGuest)
{
return $this->getLastComment(['id_product' => $productId, 'id_guest' => $idGuest]);
}
/**
* @param int $customerId
*/
public function cleanCustomerData($customerId)
{
//We anonymize the customer comment by unlinking them (the name won't be visible any more but the grade and comment are still visible)
$qb = $this->connection->createQueryBuilder();
$qb
->update($this->databasePrefix . 'product_comment', 'pc')
->set('id_customer', (string) 0)
->andWhere('pc.id_customer = :id_customer')
->setParameter('id_customer', $customerId)
;
$qb->execute();
//But we remove every report and votes for comments
$qb = $this->connection->createQueryBuilder();
$qb
->delete($this->databasePrefix . 'product_comment_report')
->andWhere('id_customer = :id_customer')
->setParameter('id_customer', $customerId)
;
$qb->execute();
$qb = $this->connection->createQueryBuilder();
$qb
->delete($this->databasePrefix . 'product_comment_usefulness')
->andWhere('id_customer = :id_customer')
->setParameter('id_customer', $customerId)
;
$qb->execute();
}
/**
* @param int $customerId
* @param int $langId
*
* @return array
*/
public function getCustomerData($customerId, $langId)
{
$qb = $this->connection->createQueryBuilder();
$qb
->select('pl.name, pc.id_product, pc.id_product_comment, pc.title, pc.content, pc.grade, pc.validate, pc.deleted, pcu.usefulness, pc.date_add')
->from($this->databasePrefix . 'product_comment', 'pc')
->leftJoin('pc', $this->databasePrefix . 'product_comment_usefulness', 'pcu', 'pc.id_product_comment = pcu.id_product_comment')
->leftJoin('pc', $this->databasePrefix . 'product', 'p', 'pc.id_product = p.id_product')
->leftJoin('p', $this->databasePrefix . 'product_lang', 'pl', 'p.id_product = pl.id_product')
->leftJoin('pl', $this->databasePrefix . 'lang', 'l', 'pl.id_lang = l.id_lang')
->andWhere('pc.id_customer = :id_customer')
->andWhere('l.id_lang = :id_lang')
->setParameter('id_customer', $customerId)
->setParameter('id_lang', $langId)
->addGroupBy('pc.id_product_comment')
->addOrderBy('pc.date_add', 'ASC')
;
return $qb->execute()->fetchAll();
}
/**
* @param array $criteria
*
* @return array
*/
private function getLastComment(array $criteria)
{
/** @var QueryBuilder $qb */
$qb = $this->connection->createQueryBuilder();
$qb
->select('pc.*')
->from($this->databasePrefix . 'product_comment', 'pc')
->andWhere('pc.deleted = :deleted')
->setParameter('deleted', 0)
->addOrderBy('pc.date_add', 'DESC')
->setMaxResults(1)
;
foreach ($criteria as $field => $value) {
$qb
->andWhere(sprintf('pc.%s = :%s', $field, $field))
->setParameter($field, $value)
;
}
$comments = $qb->execute()->fetchAll();
return empty($comments) ? [] : $comments[0];
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,28 @@
#!/bin/bash
PS_VERSION=$1
set -e
# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
echo "Pull PrestaShop files (Tag ${PS_VERSION})"
docker rm -f temp-ps || true
docker volume rm -f ps-volume || true
docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION
# Clear previous instance of the module in the PrestaShop volume
echo "Clear previous module"
docker exec -t temp-ps rm -rf /var/www/html/modules/productcomments
# Run a container for PHPStan, having access to the module content and PrestaShop sources.
# This tool is outside the composer.json because of the compatibility with PHP 5.6
echo "Run PHPStan using phpstan-${PS_VERSION}.neon file"
docker run --rm --volumes-from temp-ps \
-v $PWD:/var/www/html/modules/productcomments \
-e _PS_ROOT_DIR_=/var/www/html \
--workdir=/var/www/html/modules/productcomments phpstan/phpstan:0.12 \
analyse \
--configuration=/var/www/html/modules/productcomments/tests/phpstan/phpstan-$PS_VERSION.neon

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,12 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Access to an undefined property Cookie::\$id_customer.#'
- '#Access to an undefined property Cookie::\$id_guest.#'
- '#Access to an undefined property HelperList::\$list_id.#'
- '#Access to an undefined property HelperList::\$shopLinkType.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#1 \$value of method ControllerCore::ajaxRender\(\) expects null, string\|false given.#'
- '#Parameter \#2 \$value of static method CacheCore::store\(\) expects string, array\|mysqli_result\|PDOStatement\|resource\|false\|null given.#'

View File

@@ -0,0 +1,10 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Access to an undefined property Cookie::\$id_customer.#'
- '#Access to an undefined property Cookie::\$id_guest.#'
- '#Access to an undefined property HelperList::\$list_id.#'
- '#Access to an undefined property HelperList::\$shopLinkType.#'
- '#Parameter \#1 \$value of method ControllerCore::ajaxRender\(\) expects null, string\|false given.#'

View File

@@ -0,0 +1,9 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Access to an undefined property Cookie::\$id_customer.#'
- '#Access to an undefined property Cookie::\$id_guest.#'
- '#Access to an undefined property HelperList::\$list_id.#'
- '#Access to an undefined property HelperList::\$shopLinkType.#'

View File

@@ -0,0 +1,9 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Access to an undefined property Cookie::\$id_customer.#'
- '#Access to an undefined property Cookie::\$id_guest.#'
- '#Access to an undefined property HelperList::\$list_id.#'
- '#Access to an undefined property HelperList::\$shopLinkType.#'

View File

@@ -0,0 +1,12 @@
includes:
- %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon
parameters:
paths:
# From PHPStan 0.12, paths to check are relative to the neon file
- ../../productcomments.php
- ../../ProductComment.php
- ../../ProductCommentCriterion.php
- ../../controllers/
- ../../src/
- ../../upgrade/
level: 5

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,33 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_2_4($object)
{
return $object->registerHook('displayProductListReviews') && $object->registerHook('top');
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_2_9_7($object)
{
return $object->unregisterHook('top');
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_4_0_0($object)
{
$res = true;
if (!Configuration::hasKey('PRODUCT_COMMENTS_COMMENTS_PER_PAGE')) {
$res &= (bool) Configuration::updateValue('PRODUCT_COMMENTS_COMMENTS_PER_PAGE', 5);
}
if (!Configuration::hasKey('PRODUCT_COMMENTS_USEFULNESS')) {
$res &= (bool) Configuration::updateValue('PRODUCT_COMMENTS_USEFULNESS', 1);
}
$res &= (bool) $object->unregisterHook('displayRightColumnProduct');
$res &= (bool) $object->registerHook('displayProductAdditionalInfo');
$res &= (bool) $object->registerHook('displayFooterProduct');
return (bool) $res;
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_5_0_0($object)
{
return $object->registerHook('filterProductContent') && $object->registerHook('displayGDPRConsent');
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_5_0_1($object)
{
return $object->unregisterHook('displayGDPRConsent')
&& $object->unregisterHook('header')
&& $object->registerHook('displayHeader');
}

View File

@@ -0,0 +1,10 @@
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit6bdb5caa728ae9f0d80fb8323628afe3::getLoader();

View File

@@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,17 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'PrestaShop\\Module\\ProductComment\\Entity\\ProductComment' => $baseDir . '/src/Entity/ProductComment.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentCriterion' => $baseDir . '/src/Entity/ProductCommentCriterion.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentGrade' => $baseDir . '/src/Entity/ProductCommentGrade.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentReport' => $baseDir . '/src/Entity/ProductCommentReport.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentUsefulness' => $baseDir . '/src/Entity/ProductCommentUsefulness.php',
'PrestaShop\\Module\\ProductComment\\Repository\\ProductCommentCriterionRepository' => $baseDir . '/src/Repository/ProductCommentCriterionRepository.php',
'PrestaShop\\Module\\ProductComment\\Repository\\ProductCommentRepository' => $baseDir . '/src/Repository/ProductCommentRepository.php',
'ProductComments' => $baseDir . '/productcomments.php',
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,10 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'PrestaShop\\Module\\ProductComment\\' => array($baseDir . '/src'),
);

View File

@@ -0,0 +1,43 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit6bdb5caa728ae9f0d80fb8323628afe3
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit6bdb5caa728ae9f0d80fb8323628afe3', 'loadClassLoader'), true, false);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit6bdb5caa728ae9f0d80fb8323628afe3', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit6bdb5caa728ae9f0d80fb8323628afe3::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->setClassMapAuthoritative(true);
$loader->register(false);
return $loader;
}
}

View File

@@ -0,0 +1,43 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit6bdb5caa728ae9f0d80fb8323628afe3
{
public static $prefixLengthsPsr4 = array (
'P' =>
array (
'PrestaShop\\Module\\ProductComment\\' => 33,
),
);
public static $prefixDirsPsr4 = array (
'PrestaShop\\Module\\ProductComment\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
);
public static $classMap = array (
'PrestaShop\\Module\\ProductComment\\Entity\\ProductComment' => __DIR__ . '/../..' . '/src/Entity/ProductComment.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentCriterion' => __DIR__ . '/../..' . '/src/Entity/ProductCommentCriterion.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentGrade' => __DIR__ . '/../..' . '/src/Entity/ProductCommentGrade.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentReport' => __DIR__ . '/../..' . '/src/Entity/ProductCommentReport.php',
'PrestaShop\\Module\\ProductComment\\Entity\\ProductCommentUsefulness' => __DIR__ . '/../..' . '/src/Entity/ProductCommentUsefulness.php',
'PrestaShop\\Module\\ProductComment\\Repository\\ProductCommentCriterionRepository' => __DIR__ . '/../..' . '/src/Repository/ProductCommentCriterionRepository.php',
'PrestaShop\\Module\\ProductComment\\Repository\\ProductCommentRepository' => __DIR__ . '/../..' . '/src/Repository/ProductCommentRepository.php',
'ProductComments' => __DIR__ . '/../..' . '/productcomments.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit6bdb5caa728ae9f0d80fb8323628afe3::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6bdb5caa728ae9f0d80fb8323628afe3::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6bdb5caa728ae9f0d80fb8323628afe3::$classMap;
}, null, ClassLoader::class);
}
}

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,667 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
/**
* Product comments CSS
*/
.product-comment-modal .material-icons[data-icon]:before,
.product-comment-list-item .material-icons[data-icon]:before,
.product-comments-additional-info .material-icons[data-icon]:before,
#product-comments-list-header .material-icons[data-icon]:before,
#product-comments-list-footer .material-icons[data-icon]:before {
content: attr(data-icon);
}
.btn-comment,
.btn-comment-inverse {
height: 36px;
border-radius: 2px;
background-color: #6b868f;
color: #ffffff;
font-size: 14px;
box-shadow: 2px 2px 4px 0 rgba(0, 0, 0, 0.2);
padding: 8px;
}
.btn-comment .material-icons,
.btn-comment-inverse .material-icons {
font-size: 20px;
margin-right: 7px;
}
.btn-comment:hover {
background-color: #3c4d52;
}
.btn-comment-inverse {
background-color: #ffffff;
color: #363a41;
border: 1px solid #979797;
}
.btn-comment-inverse:hover {
background-color: #6b868f;
border: 1px solid #6b868f;
color: #ffffff;
}
.btn-comment-big {
padding: 13px 16px;
height: 45px;
}
.btn-comment-huge {
padding: 13px 28px;
height: 45px;
}
.link-comment {
color: #232323;
}
.link-comment:hover,
.link-comment:active {
text-decoration: underline;
color: #232323;
}
/**
* Additional product infos
*/
.product-comments-additional-info {
margin: 20px 0;
font-weight: 300;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
font-size: 14px;
}
.product-comments-additional-info .link-comment.post-product-comment {
border-left: 1px solid #979797;
padding-left: 12px;
margin-left: 12px;
}
.product-comments-additional-info .comments-note {
margin-right: 30px;
margin-bottom: 20px;
}
/**
* Post comment modal
*/
.product-comment-modal .modal-header {
border: none;
padding: 30px 30px 15px;
}
.product-comment-modal .modal-body {
padding: 15px 30px 30px;
}
.product-comment-modal .modal-header h2 {
float: left;
font-size: 20px;
}
.product-comment-modal .modal-dialog {
width: calc(100% - 30px);
max-width: 774px;
}
.product-comment-modal .modal-dialog h3 {
font-size: 14px;
}
.product-comment-modal .modal-dialog .product-flag {
display: none;
}
.product-comment-modal .modal-dialog .product-cover,
.product-comment-modal .modal-dialog .product-cover img {
width: 99px;
height: 99px;
}
.product-comment-modal label.form-label {
font-size: 16px;
margin: 10px 0;
}
.product-comment-modal input {
width: 100%;
height: 44px;
border: 1px solid #bfbfbf;
padding: 0 10px;
}
.product-comment-modal textarea {
width: 100%;
min-height: 80px;
border: 1px solid #bfbfbf;
margin-bottom: 10px;
padding: 10px 10px;
}
.product-comment-modal .btn-comment,
.product-comment-modal .btn-comment-inverse {
font-size: 16px;
line-height: 16px;
font-weight: bold;
}
.product-comment-modal .required {
font-size: 12px;
margin-left: 5px;
}
.product-comment-modal .post-comment-buttons {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.product-comment-modal .post-comment-buttons .btn-comment {
margin-left: 15px;
}
#product-comment-posted-modal .post-comment-buttons,
#product-comment-post-error .post-comment-buttons,
#update-comment-usefulness-post-error .post-comment-buttons {
margin-top: 30px;
}
.modal-header .material-icons {
color: #40a85f;
font-size: 30px;
line-height: 25px;
}
.modal-header .material-icons.error {
color: #a94442;
}
.modal-header .material-icons.feedback {
color: #f39d72;
}
/**
* Star component
*/
.star-content {
margin: 0 0 0 5px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.star-content div.star,
.star-content div.star-on,
.star-content div.star-hover {
display: block;
width: 20px;
height: 20px;
background: url(../img/stars.png) no-repeat 0 0 transparent;
flex: auto;
margin-left: 3px;
}
.star-content div.star-on,
.star-content div.star-hover {
background-position: -24px 0;
}
.small-stars .star-content div.star,
.small-stars .star-content div.star-on,
.small-stars .star-content div.star-hover {
background: url(../img/small_stars.png) no-repeat 0 0 transparent;
width: 16px;
height: 16px;
margin-left: 2px;
}
.small-stars .star-content div.star-on,
.small-stars .star-content div.star-hover {
background-position: -19px 0;
}
.star-content div.star-hover {
cursor: pointer;
}
.grade-stars {
position: relative;
height: 20px;
min-width: 120px;
display: inline-block;
}
.grade-stars.small-stars {
min-width: 100px;
}
.grade-stars .star-content {
position: absolute;
top: 3px;
left: 0;
}
.criterion-rating .grade-stars .star-content {
top: 0;
}
#post-product-comment-modal .star-content div.star a {
display: block;
position: absolute;
text-indent: -5000px;
}
#post-product-comment-modal .criterion-rating {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
#post-product-comment-modal .criterion-rating label {
color: #363a41;
font-size: 14px;
font-weight: bold;
}
#post-product-comment-form input.error,
#post-product-comment-form textarea.error {
background-color: #f2dede;
border: solid 1px #ebcccc;
}
#post-product-comment-form input.valid,
#post-product-comment-form textarea.valid {
border: solid 1px #d0e9c6;
}
/**
* Product comments list
*/
#product-comments-list-header {
padding: 20px 15px;
color: #232323;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
#product-comments-list-header .comments-nb {
padding-left: 0;
padding-top: 3px;
}
#product-comments-list-header .comments-nb .material-icons {
margin-right: 3px;
}
#product-comments-list .btn-comment {
margin: 0 auto;
display: block;
}
.product-comment-list-item {
padding: 26px 0;
margin: 0 0 20px;
background-color: #ffffff;
text-align: left;
}
#empty-product-comment {
text-align: center;
}
.product-comment-list-item .grade-stars .star-content {
margin: 0 0 10px;
}
.product-comment-list-item .comment-infos {
height: 19px;
color: #6b868f;
font-size: 14px;
letter-spacing: -0.28px;
line-height: 19px;
min-height: 100px;
}
.product-comment-list-item .comment-infos .grade-stars {
margin-bottom: 20px;
}
.product-comment-list-item .comment-content h4 {
height: 22px;
color: #363a41;
font-size: 16px;
font-weight: 600;
letter-spacing: -0.32px;
line-height: 22px;
}
.product-comment-list-item .comment-content p {
color: #363a42;
font-size: 14px;
letter-spacing: -0.28px;
line-height: 19px;
word-break: break-word;
white-space: pre-wrap;
}
.product-comment-list-item .comment-content .comment-buttons a {
color: #6b868f;
font-size: 14px;
letter-spacing: -0.28px;
line-height: 19px;
margin-right: 8px;
}
.product-comment-list-item .comment-content .comment-buttons a .material-icons {
font-size: 18px;
cursor: pointer;
}
/*
** Quickview style
*/
.product-quickview-review {
display: flex;
flex-direction: row;
}
.product-quickview-review .grade-stars .star-content {
margin: 0 0 0 0;
top: 0;
}
/*
** Product list override
*/
#products .thumbnail-container.has-reviews:hover .highlighted-informations,
#products .thumbnail-container.has-reviews:focus .highlighted-informations,
.featured-products
.thumbnail-container.has-reviews:hover
.highlighted-informations,
.featured-products
.thumbnail-container.has-reviews:focus
.highlighted-informations,
.product-accessories
.thumbnail-container.has-reviews:hover
.highlighted-informations,
.featured-products
.thumbnail-container.has-reviews:focus
.highlighted-informations,
.product-miniature
.thumbnail-container.has-reviews:hover
.highlighted-informations,
.product-miniature
.thumbnail-container.has-reviews:focus
.highlighted-informations {
height: 4.5rem;
}
#products
.thumbnail-container.has-reviews:hover
.highlighted-informations
.variant-links,
#products
.thumbnail-container.has-reviews:focus
.highlighted-informations
.variant-links,
.featured-products
.thumbnail-container.has-reviews:hover
.highlighted-informations
.variant-links,
.featured-products
.thumbnail-container.has-reviews:focus
.highlighted-informations
.variant-links,
.product-accessories
.thumbnail-container.has-reviews:hover
.highlighted-informations
.variant-links,
.featured-products
.thumbnail-container.has-reviews:focus
.highlighted-informations
.variant-links,
.product-miniature
.thumbnail-container.has-reviews:hover
.highlighted-informations
.variant-links,
.product-miniature
.thumbnail-container.has-reviews:focus
.highlighted-informations
.variant-links {
min-height: 3.7rem;
}
#products
.thumbnail-container.has-reviews:hover
.highlighted-informations.no-variants,
#products
.thumbnail-container.has-reviews:focus
.highlighted-informations.no-variants,
.featured-products
.thumbnail-container.has-reviews:hover
.highlighted-informations.no-variants,
.featured-products
.thumbnail-container.has-reviews:focus
.highlighted-informations.no-variants,
.product-accessories
.thumbnail-container.has-reviews:hover
.highlighted-informations.no-variants,
.featured-products
.thumbnail-container.has-reviews:focus
.highlighted-informations.no-variants,
.product-miniature
.thumbnail-container.has-reviews:hover
.highlighted-informations.no-variants,
.product-miniature
.thumbnail-container.has-reviews:focus
.highlighted-informations.no-variants {
height: 4.125rem;
}
#products
.product-miniature
.thumbnail-container.has-reviews
.discount-amount.online-only,
#products
.product-miniature
.thumbnail-container.has-reviews
.discount-percentage.online-only,
#products
.product-miniature
.thumbnail-container.has-reviews
.on-sale.online-only,
#products
.product-miniature
.thumbnail-container.has-reviews
.online-only.online-only,
#products .product-miniature .thumbnail-container.has-reviews .pack.online-only,
#products
.product-miniature
.thumbnail-container.has-reviews
.product-flags
.new.online-only,
.featured-products
.product-miniature
.thumbnail-container.has-reviews
.discount-amount.online-only,
.featured-products
.product-miniature
.thumbnail-container.has-reviews
.discount-percentage.online-only,
.featured-products
.product-miniature
.thumbnail-container.has-reviews
.on-sale.online-only,
.featured-products
.product-miniature
.thumbnail-container.has-reviews
.online-only.online-only,
.featured-products
.product-miniature
.thumbnail-container.has-reviews
.pack.online-only,
.featured-products
.product-miniature
.thumbnail-container.has-reviews
.product-flags
.new.online-only,
.product-accessories
.product-miniature
.thumbnail-container.has-reviews
.discount-amount.online-only,
.product-accessories
.product-miniature
.thumbnail-container.has-reviews
.discount-percentage.online-only,
.product-accessories
.product-miniature
.thumbnail-container.has-reviews
.on-sale.online-only,
.product-accessories
.product-miniature
.thumbnail-container.has-reviews
.online-only.online-only,
.product-accessories
.product-miniature
.thumbnail-container.has-reviews
.pack.online-only,
.product-accessories
.product-miniature
.thumbnail-container.has-reviews
.product-flags
.new.online-only {
top: 11.5rem;
}
.product-list-reviews {
position: absolute;
top: -26px;
left: 0;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
width: 100%;
background: rgba(255, 255, 255, 0.5);
padding: 4px 0;
visibility: hidden;
}
.product-list-reviews .grade-stars .star-content {
top: 1px;
}
.product-list-reviews .comments-nb {
margin-left: 5px;
font-size: 13px;
}
@media (min-width: 768px) {
#product-comments-list-footer {
position: relative;
min-height: 45px;
}
#product-comments-list-footer .post-product-comment {
margin: 0 auto;
display: block;
}
#product-comments-list-pagination {
position: absolute;
right: 0;
top: 5px;
}
}
@media (max-width: 768px) {
#product-comments-list-footer {
display: flex;
flex-direction: row-reverse;
flex-wrap: nowrap;
justify-content: space-between;
}
}
@media (max-width: 576px) {
#product-comments-list-footer {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: center;
}
#product-comments-list-pagination {
margin-bottom: 10px;
}
}
#product-comments-list-pagination {
height: 32px;
}
#product-comments-list-pagination ul {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
#product-comments-list-pagination ul li span {
height: 32px;
width: 24px;
margin: 0 5px;
cursor: pointer;
display: block;
text-align: center;
font-size: 20px;
line-height: 32px;
color: #6b868f;
}
#product-comments-list-pagination ul li.active span,
#product-comments-list-pagination ul li span.next i,
#product-comments-list-pagination ul li span.prev i {
font-weight: bold;
}
#product-comments-list-pagination ul li.disabled span {
opacity: 0.3;
cursor: not-allowed;
}
#product-comments-list-pagination ul li.active span {
cursor: not-allowed;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,157 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
jQuery.fn.rating = function(generalOptions) {
const $ratings = $(this);
$ratings.each(function initRating() {
const $ratingComponent = $(this);
var options = generalOptions ? generalOptions : {};
if (!options.grade && $ratingComponent.data('grade')) {
options.grade = $ratingComponent.data('grade');
}
if (!options.min && $ratingComponent.data('min')) {
options.min = $ratingComponent.data('min');
}
if (!options.max && $ratingComponent.data('max')) {
options.max = $ratingComponent.data('max');
}
if (!options.input && $ratingComponent.data('input')) {
options.input = $ratingComponent.data('input');
}
var componentOptions = jQuery.extend({
grade: null,
input: null,
min: 1,
max: 5,
starWidth: 20
}, options);
const minValue = Math.min(componentOptions.min, componentOptions.max);
const maxValue = Math.max(componentOptions.min, componentOptions.max);
const ratingValue = Math.min(Math.max(minValue, componentOptions.grade), maxValue);
$ratingComponent.html('');
$ratingComponent.append('<div class="star-content star-empty clearfix"></div>');
$ratingComponent.append('<div class="star-content star-full clearfix"></div>');
const emptyStars = $('.star-empty', this);
const fullStars = $('.star-full', this);
const emptyStar = $('<div class="star"></div>');
const fullStar = $('<div class="star-on"></div>');
var ratingInput;
if (componentOptions.input) {
ratingInput = $('<input type="number" name="'+componentOptions.input+'" id="'+componentOptions.input+'" />');
ratingInput.val(ratingValue);
ratingInput.css('display', 'none');
ratingInput.on('change', displayInteractiveGrade);
$ratingComponent.append(ratingInput);
initInteractiveGrade();
} else {
displayGrade(ratingValue);
}
function initInteractiveGrade() {
emptyStars.html('');
fullStars.html('');
var newStar;
for (var i = minValue; i <= maxValue; ++i) {
newStar = emptyStar.clone();
newStar.data('grade', i);
newStar.on('mouseenter mouseleave', function overStar() {
var overIndex = $('.star', fullStars).index($(this));
$('.star', fullStars).each(function overStars() {
$(this).removeClass('star-on');
var starIndex = $('.star', fullStars).index($(this));
if (starIndex <= overIndex) {
$(this).addClass('star-hover');
} else {
$(this).removeClass('star-hover');
}
});
});
newStar.on('click', function selectGrade() {
var selectedGrade = $(this).data('grade');
ratingInput.val(selectedGrade);
});
fullStars.append(newStar);
}
fullStars.on('mouseenter', function(){}).on('mouseleave', displayInteractiveGrade);
displayInteractiveGrade();
}
function displayInteractiveGrade() {
$('.star', fullStars).each(function displayStar() {
var starValue = $(this).data('grade');
$(this).removeClass('star-hover');
if (starValue <= ratingInput.val()) {
$(this).addClass('star-on');
} else {
$(this).removeClass('star-on');
}
});
}
function displayGrade(grade) {
emptyStars.html('');
fullStars.html('');
var newStar;
for (var i = minValue; i <= maxValue; ++i) {
if (i <= Math.floor(grade)) {
newStar = emptyStar.clone();
newStar.css('visibility', 'hidden');
emptyStars.append(newStar);
fullStars.append(fullStar.clone());
} else if (i > Math.ceil(grade)) {
newStar = emptyStar.clone();
emptyStars.append(newStar.clone());
} else {
//This the partial star composed of
// - one invisible partial empty star
// - one visible partial empty star (remaining part)
// - one visible partial full star
var fullWidth = (grade - i + 1) * componentOptions.starWidth;
var emptyWidth = componentOptions.starWidth - fullWidth;
newStar = emptyStar.clone();
newStar.css('visibility', 'hidden');
newStar.css('width', fullWidth);
emptyStars.append(newStar);
newStar = emptyStar.clone();
newStar.css('width', emptyWidth);
newStar.css('background-position', '0px -'+fullWidth+'px');
newStar.css('background-position', '-'+fullWidth+'px 0px');
newStar.css('marginLeft', 0);
emptyStars.append(newStar);
fullStar.css('width', fullWidth);
fullStars.append(fullStar.clone());
}
}
}
});
}

View File

@@ -0,0 +1,398 @@
/**
* simplePagination.js v1.6
* A simple jQuery pagination plugin.
* http://flaviusmatis.github.com/simplePagination.js/
*
* Copyright 2012, Flavius Matis
* Released under the MIT license.
* http://flaviusmatis.github.com/license.html
*/
(function($){
var methods = {
init: function(options) {
var o = $.extend({
items: 1,
itemsOnPage: 1,
pages: 0,
displayedPages: 5,
edges: 2,
currentPage: 0,
useAnchors: true,
hrefTextPrefix: '#page-',
hrefTextSuffix: '',
prevText: 'Prev',
nextText: 'Next',
ellipseText: '&hellip;',
ellipsePageSet: true,
cssStyle: 'light-theme',
listStyle: '',
labelMap: [],
selectOnClick: true,
nextAtFront: false,
invertPageOrder: false,
useStartEdge : true,
useEndEdge : true,
onPageClick: function(pageNumber, event) {
// Callback triggered when a page is clicked
// Page number is given as an optional parameter
},
onInit: function() {
// Callback triggered immediately after initialization
}
}, options || {});
var self = this;
o.pages = o.pages ? o.pages : Math.ceil(o.items / o.itemsOnPage) ? Math.ceil(o.items / o.itemsOnPage) : 1;
if (o.currentPage)
o.currentPage = o.currentPage - 1;
else
o.currentPage = !o.invertPageOrder ? 0 : o.pages - 1;
o.halfDisplayed = o.displayedPages / 2;
this.each(function() {
self.addClass(o.cssStyle + ' simple-pagination').data('pagination', o);
methods._draw.call(self);
});
o.onInit();
return this;
},
selectPage: function(page) {
methods._selectPage.call(this, page - 1);
return this;
},
prevPage: function() {
var o = this.data('pagination');
if (!o.invertPageOrder) {
if (o.currentPage > 0) {
methods._selectPage.call(this, o.currentPage - 1);
}
} else {
if (o.currentPage < o.pages - 1) {
methods._selectPage.call(this, o.currentPage + 1);
}
}
return this;
},
nextPage: function() {
var o = this.data('pagination');
if (!o.invertPageOrder) {
if (o.currentPage < o.pages - 1) {
methods._selectPage.call(this, o.currentPage + 1);
}
} else {
if (o.currentPage > 0) {
methods._selectPage.call(this, o.currentPage - 1);
}
}
return this;
},
getPagesCount: function() {
return this.data('pagination').pages;
},
setPagesCount: function(count) {
this.data('pagination').pages = count;
},
getCurrentPage: function () {
return this.data('pagination').currentPage + 1;
},
destroy: function(){
this.empty();
return this;
},
drawPage: function (page) {
var o = this.data('pagination');
o.currentPage = page - 1;
this.data('pagination', o);
methods._draw.call(this);
return this;
},
redraw: function(){
methods._draw.call(this);
return this;
},
disable: function(){
var o = this.data('pagination');
o.disabled = true;
this.data('pagination', o);
methods._draw.call(this);
return this;
},
enable: function(){
var o = this.data('pagination');
o.disabled = false;
this.data('pagination', o);
methods._draw.call(this);
return this;
},
updateItems: function (newItems) {
var o = this.data('pagination');
o.items = newItems;
o.pages = methods._getPages(o);
this.data('pagination', o);
methods._draw.call(this);
},
updateItemsOnPage: function (itemsOnPage) {
var o = this.data('pagination');
o.itemsOnPage = itemsOnPage;
o.pages = methods._getPages(o);
this.data('pagination', o);
methods._selectPage.call(this, 0);
return this;
},
getItemsOnPage: function() {
return this.data('pagination').itemsOnPage;
},
_draw: function() {
var o = this.data('pagination'),
interval = methods._getInterval(o),
i,
tagName;
methods.destroy.call(this);
tagName = (typeof this.prop === 'function') ? this.prop('tagName') : this.attr('tagName');
var $panel = tagName === 'UL' ? this : $('<ul' + (o.listStyle ? ' class="' + o.listStyle + '"' : '') + '></ul>').appendTo(this);
// Generate Prev link
if (o.prevText) {
methods._appendItem.call(this, !o.invertPageOrder ? o.currentPage - 1 : o.currentPage + 1, {text: o.prevText, classes: 'prev'});
}
// Generate Next link (if option set for at front)
if (o.nextText && o.nextAtFront) {
methods._appendItem.call(this, !o.invertPageOrder ? o.currentPage + 1 : o.currentPage - 1, {text: o.nextText, classes: 'next'});
}
// Generate start edges
if (!o.invertPageOrder) {
if (interval.start > 0 && o.edges > 0) {
if(o.useStartEdge) {
var end = Math.min(o.edges, interval.start);
for (i = 0; i < end; i++) {
methods._appendItem.call(this, i);
}
}
if (o.edges < interval.start && (interval.start - o.edges != 1)) {
$panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
} else if (interval.start - o.edges == 1) {
methods._appendItem.call(this, o.edges);
}
}
} else {
if (interval.end < o.pages && o.edges > 0) {
if(o.useStartEdge) {
var begin = Math.max(o.pages - o.edges, interval.end);
for (i = o.pages - 1; i >= begin; i--) {
methods._appendItem.call(this, i);
}
}
if (o.pages - o.edges > interval.end && (o.pages - o.edges - interval.end != 1)) {
$panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
} else if (o.pages - o.edges - interval.end == 1) {
methods._appendItem.call(this, interval.end);
}
}
}
// Generate interval links
if (!o.invertPageOrder) {
for (i = interval.start; i < interval.end; i++) {
methods._appendItem.call(this, i);
}
} else {
for (i = interval.end - 1; i >= interval.start; i--) {
methods._appendItem.call(this, i);
}
}
// Generate end edges
if (!o.invertPageOrder) {
if (interval.end < o.pages && o.edges > 0) {
if (o.pages - o.edges > interval.end && (o.pages - o.edges - interval.end != 1)) {
$panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
} else if (o.pages - o.edges - interval.end == 1) {
methods._appendItem.call(this, interval.end);
}
if(o.useEndEdge) {
var begin = Math.max(o.pages - o.edges, interval.end);
for (i = begin; i < o.pages; i++) {
methods._appendItem.call(this, i);
}
}
}
} else {
if (interval.start > 0 && o.edges > 0) {
if (o.edges < interval.start && (interval.start - o.edges != 1)) {
$panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
} else if (interval.start - o.edges == 1) {
methods._appendItem.call(this, o.edges);
}
if(o.useEndEdge) {
var end = Math.min(o.edges, interval.start);
for (i = end - 1; i >= 0; i--) {
methods._appendItem.call(this, i);
}
}
}
}
// Generate Next link (unless option is set for at front)
if (o.nextText && !o.nextAtFront) {
methods._appendItem.call(this, !o.invertPageOrder ? o.currentPage + 1 : o.currentPage - 1, {text: o.nextText, classes: 'next'});
}
if (o.ellipsePageSet && !o.disabled) {
methods._ellipseClick.call(this, $panel);
}
},
_getPages: function(o) {
var pages = Math.ceil(o.items / o.itemsOnPage);
return pages || 1;
},
_getInterval: function(o) {
return {
start: Math.ceil(o.currentPage > o.halfDisplayed ? Math.max(Math.min(o.currentPage - o.halfDisplayed, (o.pages - o.displayedPages)), 0) : 0),
end: Math.ceil(o.currentPage > o.halfDisplayed ? Math.min(o.currentPage + o.halfDisplayed, o.pages) : Math.min(o.displayedPages, o.pages))
};
},
_appendItem: function(pageIndex, opts) {
var self = this, options, $link, o = self.data('pagination'), $linkWrapper = $('<li></li>'), $ul = self.find('ul');
pageIndex = pageIndex < 0 ? 0 : (pageIndex < o.pages ? pageIndex : o.pages - 1);
options = {
text: pageIndex + 1,
classes: ''
};
if (o.labelMap.length && o.labelMap[pageIndex]) {
options.text = o.labelMap[pageIndex];
}
options = $.extend(options, opts || {});
if (pageIndex == o.currentPage || o.disabled) {
if (o.disabled || options.classes === 'prev' || options.classes === 'next') {
$linkWrapper.addClass('disabled');
} else {
$linkWrapper.addClass('active');
}
$link = $('<span class="current">' + (options.text) + '</span>');
} else {
if (o.useAnchors) {
$link = $('<a href="' + o.hrefTextPrefix + (pageIndex + 1) + o.hrefTextSuffix + '" class="page-link">' + (options.text) + '</a>');
} else {
$link = $('<span >' + (options.text) + '</span>');
}
$link.click(function(event){
return methods._selectPage.call(self, pageIndex, event);
});
}
if (options.classes) {
$link.addClass(options.classes);
}
$linkWrapper.append($link);
if ($ul.length) {
$ul.append($linkWrapper);
} else {
self.append($linkWrapper);
}
},
_selectPage: function(pageIndex, event) {
var o = this.data('pagination');
o.currentPage = pageIndex;
if (o.selectOnClick) {
methods._draw.call(this);
}
return o.onPageClick(pageIndex + 1, event);
},
_ellipseClick: function($panel) {
var self = this,
o = this.data('pagination'),
$ellip = $panel.find('.ellipse');
$ellip.addClass('clickable').parent().removeClass('disabled');
$ellip.click(function(event) {
if (!o.disable) {
var $this = $(this),
val = (parseInt($this.parent().prev().text(), 10) || 0) + 1;
$this
.html('<input type="number" min="1" max="' + o.pages + '" step="1" value="' + val + '">')
.find('input')
.focus()
.click(function(event) {
// prevent input number arrows from bubbling a click event on $ellip
event.stopPropagation();
})
.keyup(function(event) {
var val = $(this).val();
if (event.which === 13 && val !== '') {
// enter to accept
if ((val>0)&&(val<=o.pages))
methods._selectPage.call(self, val - 1);
} else if (event.which === 27) {
// escape to cancel
$ellip.empty().html(o.ellipseText);
}
})
.bind('blur', function(event) {
var val = $(this).val();
if (val !== '') {
methods._selectPage.call(self, val - 1);
}
$ellip.empty().html(o.ellipseText);
return false;
});
}
return false;
});
}
};
$.fn.pagination = function(method) {
// Method calling logic
if (methods[method] && method.charAt(0) != '_') {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.pagination');
}
};
})(jQuery);

View File

@@ -0,0 +1,169 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
jQuery(document).ready(function () {
const $ = jQuery;
const commentsList = $('#product-comments-list');
const emptyProductComment = $('#empty-product-comment');
const commentsListUrl = commentsList.data('list-comments-url');
const updateCommentUsefulnessUrl = commentsList.data('update-comment-usefulness-url');
const reportCommentUrl = commentsList.data('report-comment-url');
const commentPrototype = commentsList.data('comment-item-prototype');
emptyProductComment.hide();
$('.grade-stars').rating();
prestashop.on('updatedProduct', function() {
$('.product-comments-additional-info .grade-stars').rating();
})
document.addEventListener('updateRating', function() {
$('.grade-stars').rating();
});
const updateCommentPostErrorModal = $('#update-comment-usefulness-post-error');
const confirmAbuseModal = $('#report-comment-confirmation');
const reportCommentPostErrorModal = $('#report-comment-post-error');
const reportCommentPostedModal = $('#report-comment-posted');
function showUpdatePostCommentErrorModal(errorMessage) {
$('#update-comment-usefulness-post-error-message').html(errorMessage);
updateCommentPostErrorModal.modal('show');
}
function showReportCommentErrorModal(errorMessage) {
$('#report-comment-post-error-message').html(errorMessage);
reportCommentPostErrorModal.modal('show');
}
function paginateComments(page) {
$.get(commentsListUrl, {page: page}, function(jsonResponse) {
if (jsonResponse.comments && jsonResponse.comments.length > 0) {
populateComments(jsonResponse.comments);
if (jsonResponse.comments_nb > jsonResponse.comments_per_page) {
$('#product-comments-list-pagination').pagination({
currentPage: page,
items: jsonResponse.comments_nb,
itemsOnPage: jsonResponse.comments_per_page,
cssStyle: '',
prevText: '<i class="material-icons" data-icon="chevron_left"></i>',
nextText: '<i class="material-icons" data-icon="chevron_right"></i>',
useAnchors: false,
displayedPages: 2,
onPageClick: paginateComments
});
} else {
$('#product-comments-list-pagination').hide();
}
} else {
commentsList.html('');
emptyProductComment.show();
commentsList.append(emptyProductComment);
}
});
}
function populateComments(comments) {
commentsList.html('');
comments.forEach(addComment);
}
function addComment(comment) {
var commentTemplate = commentPrototype;
var customerName = comment.customer_name;
if (!customerName) {
customerName = comment.firstname+' '+comment.lastname;
}
commentTemplate = commentTemplate.replace(/@COMMENT_ID@/, comment.id_product_comment);
commentTemplate = commentTemplate.replace(/@PRODUCT_ID@/, comment.id_product);
commentTemplate = commentTemplate.replace(/@CUSTOMER_NAME@/, customerName);
commentTemplate = commentTemplate.replace(/@COMMENT_DATE@/, comment.date_add);
commentTemplate = commentTemplate.replace(/@COMMENT_TITLE@/, comment.title);
commentTemplate = commentTemplate.replace(/@COMMENT_COMMENT@/, comment.content);
commentTemplate = commentTemplate.replace(/@COMMENT_USEFUL_ADVICES@/, comment.usefulness);
commentTemplate = commentTemplate.replace(/@COMMENT_GRADE@/, comment.grade);
commentTemplate = commentTemplate.replace(/@COMMENT_NOT_USEFUL_ADVICES@/, (comment.total_usefulness - comment.usefulness));
commentTemplate = commentTemplate.replace(/@COMMENT_TOTAL_ADVICES@/, comment.total_usefulness);
const $comment = $(commentTemplate);
$('.grade-stars', $comment).rating({
grade: comment.grade
});
$('.useful-review', $comment).click(function() {
updateCommentUsefulness($comment, comment.id_product_comment, 1);
});
$('.not-useful-review', $comment).click(function() {
updateCommentUsefulness($comment, comment.id_product_comment, 0);
});
$('.report-abuse', $comment).click(function() {
confirmCommentAbuse(comment.id_product_comment);
});
commentsList.append($comment);
}
function updateCommentUsefulness($comment, commentId, usefulness) {
$.post(updateCommentUsefulnessUrl, {id_product_comment: commentId, usefulness: usefulness}, function(jsonData){
if (jsonData) {
if (jsonData.success) {
$('.useful-review-value', $comment).html(jsonData.usefulness);
$('.not-useful-review-value', $comment).html(jsonData.total_usefulness - jsonData.usefulness);
} else {
const decodedErrorMessage = $("<div/>").html(jsonData.error).text();
showUpdatePostCommentErrorModal(decodedErrorMessage);
}
} else {
showUpdatePostCommentErrorModal(productCommentUpdatePostErrorMessage);
}
}).fail(function() {
showUpdatePostCommentErrorModal(productCommentUpdatePostErrorMessage);
});
}
function confirmCommentAbuse(commentId) {
confirmAbuseModal.modal('show');
confirmAbuseModal.one('modal:confirm', function(event, confirm) {
if (!confirm) {
return;
}
$.post(reportCommentUrl, {id_product_comment: commentId}, function(jsonData){
if (jsonData) {
if (jsonData.success) {
reportCommentPostedModal.modal('show');
} else {
showReportCommentErrorModal(jsonData.error);
}
} else {
showReportCommentErrorModal(productCommentAbuseReportErrorMessage);
}
}).fail(function() {
showReportCommentErrorModal(productCommentAbuseReportErrorMessage);
});
})
}
paginateComments(1);
});

View File

@@ -0,0 +1,131 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
jQuery(document).ready(function () {
const $ = jQuery;
$('body').on('click', '.post-product-comment', function (event) {
event.preventDefault();
showPostCommentModal();
});
const postCommentModal = $('#post-product-comment-modal');
postCommentModal.on('hidden.bs.modal', function () {
postCommentModal.modal('hide');
clearPostCommentForm();
});
const commentPostedModal = $('#product-comment-posted-modal');
const commentPostErrorModal = $('#product-comment-post-error');
function showPostCommentModal() {
commentPostedModal.modal('hide');
commentPostErrorModal.modal('hide');
postCommentModal.modal('show');
}
function showCommentPostedModal() {
postCommentModal.modal('hide');
commentPostErrorModal.modal('hide');
clearPostCommentForm();
commentPostedModal.modal('show');
}
function showPostErrorModal(errorMessage) {
postCommentModal.modal('hide');
commentPostedModal.modal('hide');
clearPostCommentForm();
$('#product-comment-post-error-message').html(errorMessage);
commentPostErrorModal.modal('show');
}
function clearPostCommentForm() {
$('#post-product-comment-form input[type="text"]').val('');
$('#post-product-comment-form input[type="text"]').removeClass('valid error');
$('#post-product-comment-form textarea').val('');
$('#post-product-comment-form textarea').removeClass('valid error');
$('#post-product-comment-form .criterion-rating input').val(3).trigger('change');
}
function initCommentModal() {
$('#post-product-comment-modal .grade-stars').rating();
$('body').on('click', '.post-product-comment', function (event) {
event.preventDefault();
showPostCommentModal();
});
$('#post-product-comment-form').on('submit', submitCommentForm);
}
function submitCommentForm(event) {
event.preventDefault();
var formData = $(this).serializeArray();
if (!validateFormData(formData)) {
return;
}
$.post($(this).attr('action'), $(this).serialize(), function(jsonData) {
if (jsonData) {
if (jsonData.success) {
clearPostCommentForm();
showCommentPostedModal();
} else {
if (jsonData.errors) {
var errorList = '<ul>';
for (var i = 0; i < jsonData.errors.length; ++i) {
errorList += '<li>' + jsonData.errors[i] + '</li>';
}
errorList += '</ul>';
showPostErrorModal(errorList);
} else {
const decodedErrorMessage = $("<div/>").html(jsonData.error).text();
showPostErrorModal(decodedErrorMessage);
}
}
} else {
showPostErrorModal(productCommentPostErrorMessage);
}
}).fail(function() {
showPostErrorModal(productCommentPostErrorMessage);
});
}
function validateFormData(formData) {
var isValid = true;
formData.forEach(function(formField) {
const fieldSelector = '#post-product-comment-form [name="'+formField.name+'"]';
if (!formField.value) {
$(fieldSelector).addClass('error');
$(fieldSelector).removeClass('valid');
isValid = false;
} else {
$(fieldSelector).removeClass('error');
$(fieldSelector).addClass('valid');
}
});
return isValid;
}
initCommentModal();
});

View File

@@ -0,0 +1,151 @@
/**
* 2007-2019 PrestaShop SA and Contributors
*
* 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-2019 PrestaShop SA and Contributors
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function() {
productListingComments.init();
productListingComments.load();
});
var productListingComments = (function () {
var data = {
productIDs: [],
commentsLoadingInProgress: false,
ajaxIDsLimit: 50,
ajaxUrl: ''
}
var DOMStrings = {
productListReviewsContainer: '.product-list-reviews',
productListReviewsNumberOfComments: '.comments-nb',
productListReviewsStarsContainer: '.grade-stars',
productContainer: '.thumbnail-container'
};
var DOMClasses = {
inProgress: 'reviews-loading',
reviewsLoaded: 'reviews-loaded',
hasReviews: 'has-reviews'
};
function setEvents() {
prestashop.on('updateProductList', function() {
addProductsIDs();
});
}
function setAjaxUrl() {
if (data.ajaxUrl !== '')
return;
var url = $(DOMStrings.productListReviewsContainer).first().data('url');
data.ajaxUrl = url;
}
function getNewProductsReviewsElements() {
var $productListReviews = $(DOMStrings.productContainer)
.not('.' + DOMClasses.reviewsLoaded + ', .' + DOMClasses.inProgress)
.addClass(DOMClasses.inProgress)
.find(DOMStrings.productListReviewsContainer);
return $productListReviews;
}
function addProductsIDs() {
var $productsList = getNewProductsReviewsElements(),
seenIds = {};
$productsList.each(function () {
var id = $(this).data('id');
seenIds[id] = true;
});
var IDsArray = Object.keys(seenIds).filter(e => e !== 'undefined');
var prevDataIDs = data.productIDs.splice(0);
data.productIDs = prevDataIDs.concat(IDsArray);
if (!data.commentsLoadingInProgress) {
loadProductsData();
}
}
function loadProductsData() {
if (data.productIDs.length === 0)
return;
data.commentsLoadingInProgress = true;
var dataIDsCopy = data.productIDs.slice(0);
selectedProductIDs = dataIDsCopy.splice(0, data.ajaxIDsLimit);
$.get(data.ajaxUrl, { id_products: selectedProductIDs }, function (jsonData) {
if (jsonData) {
$.each(jsonData.products, function(i, elem) {
var productData = elem;
var $productsReviewsContainer = $('.product-list-reviews[data-id="' + productData.id_product + '"]');
$productsReviewsContainer.each(function () {
var $self = $(this);
if (productData.comments_nb > 0) {
$self.find(DOMStrings.productListReviewsStarsContainer).rating({ grade: productData.average_grade, starWidth: 16 });
$self.find(DOMStrings.productListReviewsNumberOfComments).text('(' + productData.comments_nb + ')');
$self.closest(DOMStrings.productContainer).addClass(DOMClasses.hasReviews);
$self.css('visibility', 'visible');
}
$self.closest(DOMStrings.productContainer).addClass(DOMClasses.reviewsLoaded);
$self.closest(DOMStrings.productContainer).removeClass(DOMClasses.inProgress);
});
data.productIDs.shift();
});
data.commentsLoadingInProgress = false;
if (data.productIDs.length > 0) {
loadProductsData();
}
}
});
}
return {
load: function () {
addProductsIDs();
},
init: function () {
setAjaxUrl();
setEvents();
}
}
})();

View File

@@ -0,0 +1,70 @@
{**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}
{extends file="helpers/form/form.tpl"}
{block name="input"}
{if $input.type == 'products'}
<table id="{$input.name}">
<tr>
<th></th>
<th>ID</th>
<th width="80%">{l s='Product Name' d='Modules.Productcomments.Admin'}</th>
</tr>
{foreach $input.values as $value}
<tr>
<td>
<input type="checkbox" name="{$input.name}[]" value="{$value.id_product}"
{if isset($value.selected) && $value.selected == 1} checked {/if} />
</td>
<td>{$value.id_product}</td>
<td width="80%">{$value.name}</td>
</tr>
{/foreach}
</table>
{elseif $input.type == 'switch' && $smarty.const._PS_VERSION_|@addcslashes:'\'' < '1.6'}
{foreach $input.values as $value}
<input type="radio" name="{$input.name}" id="{$value.id}" value="{$value.value|escape:'html':'UTF-8'}"
{if $fields_value[$input.name] == $value.value}checked="checked"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if} />
<label class="t" for="{$value.id}">
{if isset($input.is_bool) && $input.is_bool == true}
{if $value.value == 1}
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
{else}
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
{/if}
{else}
{$value.label}
{/if}
</label>
{if isset($input.br) && $input.br}<br />{/if}
{if isset($value.p) && $value.p}<p>{$value.p}</p>{/if}
{/foreach}
{else}
{$smarty.block.parent}
{/if}
{/block}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
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;

View File

@@ -0,0 +1,28 @@
{**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}
<a href="{$href}" class="btn btn-success" title="{$action}" >
<i class="icon-check"></i> {$action}
</a>

View File

@@ -0,0 +1,28 @@
{**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}
<a href="{$href}" class="" title="{$action}" >
<i class="icon-check"></i> {$action}
</a>

Some files were not shown because too many files have changed in this diff Show More