private function _checkCriterion() { $action_criterion = Tools::getValue('criterion_action'); $name = Tools::getValue('criterion'); if (Tools::isSubmit('submitCriterion') and empty($action_criterion) and !empty($name)) { global $cookie; require_once dirname(__FILE__) . '/ProductCommentCriterion.php'; ProductCommentCriterion::add($cookie->id_lang, $name); $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Settings updated') . '</div>'; } elseif (!empty($action_criterion) and empty($name)) { $id_product_comment_criterion = Tools::getValue('id_product_comment_criterion'); require_once dirname(__FILE__) . '/ProductCommentCriterion.php'; switch ($action_criterion) { case 'edit': ProductCommentCriterion::update($id_product_comment_criterion, Tools::getValue('criterion_id_lang'), Tools::getValue('criterion_name')); break; case 'delete': ProductCommentCriterion::delete($id_product_comment_criterion); break; default: } } }
private function _checkCriterion() { $action_criterion = Tools::getValue('criterion_action'); $name = Tools::getValue('criterion'); if (Tools::isSubmit('submitAddCriterion')) { require_once dirname(__FILE__) . '/ProductCommentCriterion.php'; $languages = Language::getLanguages(); $id_criterion = (int) Tools::getValue('id_product_comment_criterion'); $productCommentCriterion = new ProductCommentCriterion((int) $id_criterion); foreach ($languages as $lang) { $productCommentCriterion->name[(int) $lang['id_lang']] = Tools::getValue('criterion_' . (int) $lang['id_lang']); } // Check default language criterion name $defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT')); if (!Tools::getValue('criterion_' . $defaultLanguage->id)) { $this->_html .= '<div class="error"><img src="../img/admin/error2.png" />' . $this->l('The field <b>Name</b> is required at least in') . ' ' . $defaultLanguage->name . '</div>'; return; } $productCommentCriterion->id_product_comment_criterion_type = (int) Tools::getValue('criterion_type'); $productCommentCriterion->active = (int) Tools::getValue('criterion_active'); if ($productCommentCriterion->save()) { $this->_html .= '<div class="conf confirm">' . (Tools::getValue('editCriterion') ? $this->l('Criterion updated') : $this->l('Criterion added')) . '</div>'; } } else { if (!empty($action_criterion) && empty($name)) { $id_product_comment_criterion = Tools::getValue('id_product_comment_criterion'); require_once dirname(__FILE__) . '/ProductCommentCriterion.php'; switch ($action_criterion) { case 'edit': ProductCommentCriterion::update($id_product_comment_criterion, Tools::getValue('criterion_id_lang'), Tools::getValue('criterion_name')); break; case 'delete': ProductCommentCriterion::delete($id_product_comment_criterion); break; default: } } } }
private function _checkCriterion() { $action_criterion = Tools::getValue('criterion_action'); $name = Tools::getValue('criterion'); if (Tools::isSubmit('submitAddCriterion')) { global $cookie; require_once dirname(__FILE__) . '/ProductCommentCriterion.php'; $languages = Language::getLanguages(); $id_criterion = (int) Tools::getValue('id_product_comment_criterion'); $productCommentCriterion = new ProductCommentCriterion((int) $id_criterion); foreach ($languages as $lang) { $productCommentCriterion->name[(int) $lang['id_lang']] = Tools::getValue('criterion_' . (int) $lang['id_lang']); } $productCommentCriterion->id_product_comment_criterion_type = (int) Tools::getValue('criterion_type'); $productCommentCriterion->active = (int) Tools::getValue('criterion_active'); if ($productCommentCriterion->save()) { $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . (Tools::getValue('editCriterion') ? $this->l('Criterion updated') : $this->l('Criterion added')) . '</div>'; } } elseif (!empty($action_criterion) and empty($name)) { $id_product_comment_criterion = Tools::getValue('id_product_comment_criterion'); require_once dirname(__FILE__) . '/ProductCommentCriterion.php'; switch ($action_criterion) { case 'edit': ProductCommentCriterion::update($id_product_comment_criterion, Tools::getValue('criterion_id_lang'), Tools::getValue('criterion_name')); break; case 'delete': ProductCommentCriterion::delete($id_product_comment_criterion); break; default: } } }