Exemplo n.º 1
0
 protected function ajaxProcessCommentIsUsefull()
 {
     if (!Tools::isSubmit('id_product_comment') || !Tools::isSubmit('value')) {
         die('0');
     }
     if (ProductComment::isAlreadyUsefulness(Tools::getValue('id_product_comment'), $this->context->cookie->id_customer)) {
         die('0');
     }
     if (ProductComment::setCommentUsefulness((int) Tools::getValue('id_product_comment'), (bool) Tools::getValue('value'), $this->context->cookie->id_customer)) {
         die('1');
     }
     die('0');
 }
Exemplo n.º 2
0
 */
// The usage of this file is deprecated !!!
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/ProductCommentCriterion.php';
include_once dirname(__FILE__) . '/ProductComment.php';
include_once dirname(__FILE__) . '/productcomments.php';
$productCom = new productcomments();
if (Tools::getValue('action') && Tools::getValue('id_product_comment') && Context::getContext()->cookie->id_customer) {
    if (Tools::getValue('action') == 'report') {
        if (!ProductComment::isAlreadyReport(Tools::getValue('id_product_comment'), Context::getContext()->cookie->id_customer) && ProductComment::reportComment((int) Tools::getValue('id_product_comment'), (int) Context::getContext()->cookie->id_customer)) {
            die('0');
        }
    } else {
        if (Tools::getValue('action') == 'usefulness' && Tools::getValue('value') && Tools::getValue('value')) {
            if (!ProductComment::isAlreadyUsefulness(Tools::getValue('id_product_comment'), Context::getContext()->cookie->id_customer) && ProductComment::setCommentUsefulness((int) Tools::getValue('id_product_comment'), (bool) Tools::getValue('value'), Context::getContext()->cookie->id_customer)) {
                die('0');
            }
        }
    }
} else {
    if (Tools::getValue('action') && Tools::getValue('secure_key') == $productCom->secure_key) {
        $review = Tools::jsonDecode(Tools::getValue('review'));
        $id_product = 0;
        $content = null;
        $title = null;
        $name = null;
        $grades = array();
        foreach ($review as $entry) {
            if ($entry->key == 'id_product') {
                $id_product = $entry->value;