Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Подправить код модуля ответ на комментарий под OC 3.0.3.6


Recommended Posts

Доброго времени суток господа.

Есть код  , написан и заточен вроде как для OC3

Код вносит изменения в комментарии и даёт возможность Администратору отвечать на отзывы пользователей

Пробема в том, что после его добавления через установку (zip архив) -  нету изменений на 3.0.3.6 . 

Данные в базе появляются но админка остается неизменной, окна ответа админа нету. Если ввести ответ через базу - тоже ноль.

Прошу помощи

Спойлер
<file path="admin/controller/catalog/review.php">
	<operation error="skip">
		<search><![CDATA[$this->load->model('catalog/product');]]></search>
		<add position="before"><![CDATA[
			$this->load->model('user/user');
		
			$user_info = $this->model_user_user->getUser($this->user->getId());

			if ($user_info) {
				$data['user_group'] = $user_info['user_group'] ;
			} else {
				$data['user_group'] = '';
			}
		]]></add>
	</operation>
	<operation error="skip">
		<search><![CDATA[if (isset($this->request->post['rating'])) {]]></search>
		<add position="before"><![CDATA[
			if (isset($this->request->post['admin_author'])) {
				$data['admin_author'] = $this->request->post['admin_author'];
			} elseif (!empty($review_info)) {
				$data['admin_author'] = $review_info['admin_author'] ? $review_info['admin_author'] : $data['user_group'];
			} else {
				$data['admin_author'] = $data['user_group'];
			}
			
			if (isset($this->request->post['answer'])) {
				$data['answer'] = $this->request->post['answer'];
			} elseif (!empty($review_info)) {
				$data['answer'] = $review_info['answer'];
			} else {
				$data['answer'] = '';
			}
		]]></add>
	</operation>
</file>
<file path="admin/language/ru-ru/catalog/review.php">
	<operation error="skip">
		<search><![CDATA[$_['entry_text']]]></search>
		<add position="after"><![CDATA[
			$_['entry_author_answer']   	= 'Автор ответа';
			$_['entry_answer']   	= 'Ответ';
		]]></add>
	</operation>
</file>
<file path="admin/language/ua-uk/catalog/review.php">
	<operation error="skip">
		<search><![CDATA[$_['entry_text']]]></search>
		<add position="after"><![CDATA[
			$_['entry_author_answer']   	= 'Автор відповіді';
			$_['entry_answer']   	= 'Відповідь';
		]]></add>
	</operation>
</file>
<file path="admin/language/en-gb/catalog/review.php">
	<operation error="skip">
		<search><![CDATA[$_['entry_text']]]></search>
		<add position="after"><![CDATA[
			$_['entry_author_answer']   	= 'Author answer';
			$_['entry_answer']   	= 'Answer';
		]]></add>
	</operation>
</file>
<file path="admin/model/catalog/review.php">
	<operation error="skip">
		<search><![CDATA[public function getReviews($data = array()) {]]></search>
		<add position="after"><![CDATA[
			$result_hd_description = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "review LIKE 'admin_author';");
			if ($result_hd_description->num_rows == 0) {
				$this->db->query("ALTER TABLE " . DB_PREFIX . "review ADD COLUMN `admin_author` VARCHAR( 64 ) NOT NULL AFTER `author`");                
			}
			
			$result_hd_description = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "review LIKE 'answer';");
			if ($result_hd_description->num_rows == 0) {
				$this->db->query("ALTER TABLE " . DB_PREFIX . "review ADD COLUMN `answer` TEXT NOT NULL AFTER `text`");                
			}
		
		]]></add>
	</operation>
	<operation error="skip">
		<search><![CDATA[
			$this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");			
		]]></search>
		<add position="replace"><![CDATA[
			$this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', admin_author = '" . $this->db->escape($data['admin_author']) . "', answer = '" . $this->db->escape(strip_tags($data['answer'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");
		]]></add>
	</operation>
	<operation error="skip">
		<search><![CDATA[
			$this->db->query("UPDATE " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "', date_modified = NOW() WHERE review_id = '" . (int)$review_id . "'");
		]]></search>
		<add position="replace"><![CDATA[
			$this->db->query("UPDATE " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', admin_author = '" . $this->db->escape($data['admin_author']) . "', answer = '" . $this->db->escape(strip_tags($data['answer'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "', date_modified = NOW() WHERE review_id = '" . (int)$review_id . "'");
		]]></add>
	</operation>
</file>
<file path="admin/view/template/catalog/review_form.twig">
	<operation error="skip">
		<search><![CDATA[<label class="col-sm-2 control-label" for="input-name">{{ entry_rating }}</label>]]></search>
		<add position="before" offset="1"><![CDATA[
		  <div class="form-group">
            <label class="col-sm-2 control-label" for="input-admin-author">{{ entry_author_answer }}</label>
            <div class="col-sm-10">
              <input type="text" name="admin_author" value="{{ admin_author }}" placeholder="{{ user_group }}" id="input-admin-author" class="form-control" />
			</div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-answer">{{ entry_answer }}</label>
            <div class="col-sm-10">
              <textarea name="answer" cols="60" rows="8" placeholder="{{ entry_answer }}" id="input-answer" class="form-control">{{ answer }}</textarea>
            </div>
          </div>
		]]></add>
	</operation>
</file>
<file path="catalog/controller/product/product.php">
	<operation error="skip">
		<search><![CDATA[public function review() {]]></search>
		<add position="after"><![CDATA[
			$data['entry_admin_author'] = $this->config->get('config_name');
		]]></add>
	</operation>
	<operation error="skip">
		<search><![CDATA[$data['reviews'][] = array(]]></search>
		<add position="after"><![CDATA[
			'admin_author'       => $result['admin_author'],
			'answer'       => $result['answer'],			
		]]></add>
	</operation>
</file>
<file path="catalog/model/catalog/review.php">
	<operation error="skip">
		<search><![CDATA[
			$query = $this->db->query("SELECT r.review_id, r.author, r.rating, r.text, p.product_id, pd.name, p.price, p.image, r.date_added FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY r.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
		]]></search>
		<add position="replace"><![CDATA[
			$query = $this->db->query("SELECT r.review_id, r.author, r.admin_author, r.rating, r.text, r.answer, p.product_id, pd.name, p.price, p.image, r.date_added FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY r.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
		]]></add>
	</operation>
</file>
<file path="catalog/view/theme/*/template/product/review.twig">
	<operation error="skip">
		<search><![CDATA[{% endfor %}</td>]]></search>
		<add position="replace"><![CDATA[
			{% endfor %}
			{% if (review['answer']) %} 
			<hr>
			  <div class="answer_admin">
				<p><strong>{{ review['admin_author'] }}</strong> - {{ entry_admin_author }}</p>
				<p>{{ review['answer'] }}</p>
			  </div>
			{% endif %} 
			</td>
		]]></add>
	</operation>
</file>
</modification>

 

Edited by Fantazm
Link to post
Share on other sites

Posted (edited)

Отблагодарю инстантом

Лог

Спойлер
----------------------------------------------------------------
MOD: Answer to the commentary for OC 3x

FILE: admin/controller/catalog/review.php
CODE: $this->load->model('catalog/product');
LINE: 484
CODE: if (isset($this->request->post['rating'])) {
LINE: 535

FILE: admin/language/ru-ru/catalog/review.php
CODE: $_['entry_text']
LINE: 28

FILE: admin/language/en-gb/catalog/review.php
CODE: $_['entry_text']
LINE: 28

FILE: admin/model/catalog/review.php
CODE: public function getReviews($data = array()) {
LINE: 42
CODE: $this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "'");
LINE: 3
CODE: $this->db->query("UPDATE " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . (int)$data['product_id'] . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = '" . $this->db->escape($data['date_added']) . "', date_modified = NOW() WHERE review_id = '" . (int)$review_id . "'");
LINE: 15

FILE: admin/view/template/catalog/review_form.twig
CODE: <label class="col-sm-2 control-label" for="input-name">{{ entry_rating }}</label>
LINE: 66

FILE: catalog/controller/product/product.php
CODE: public function review() {
LINE: 525
CODE: $data['reviews'][] = array(
LINE: 547

FILE: catalog/model/catalog/review.php
CODE: $query = $this->db->query("SELECT r.review_id, r.author, r.rating, r.text, p.product_id, pd.name, p.price, p.image, r.date_added FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY r.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
LINE: 58
----------------------------------------------------------------

 

 

Edited by Fantazm
Link to post
Share on other sites

Актуально. Спецов по опенкарту нету чтоли, я понять не могу?

Link to post
Share on other sites

3 часа назад, Fantazm сказал:

Спецов по опенкарту нету чтоли, я понять не могу?

если у вас сложилось мнение что вам здесь что-то должны - оно ошибочно

 

21 час назад, Fantazm сказал:

нету изменений на 3036

 

  • +1 1
Link to post
Share on other sites

Posted (edited)
56 минут назад, AlexDW сказал:

если у вас сложилось мнение что вам здесь что-то должны - оно ошибочно

 

 

Админка падает после обновления модификаторов на конфиге ,что вы дали

Собственно другие модули всегда ставились нормально и проблем небыло. Только с этим проблемы

 

Screenshot_2021-04-24 Screenshot.png

Edited by Fantazm
Link to post
Share on other sites

Начните с Гугла с вопросом xml validate online. Может у вас в самом модификаторе ошибка.

  • +1 1
Link to post
Share on other sites
Posted (edited)

Вопрос решил.

Изменения не вносились по неизвестным мне причинам.Вбил код вручную - всё заработало.
По словам господина AlexDW - на 3.0.3.6  кривой modification.xml
Но с якобы подправленным у меня сыпется админка и отваливаются стили

Edited by Fantazm
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.