Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Подружить модуль Questions & Answers PRO и Opencart


Recommended Posts

Имеем модуль Questions & Answers PRO v2.1.0 и Opencart 2.1.0.2.1.

Не сохраняются настройки модуля, точнее сохраняются неправильно.

При сохранении в админке ошибки:

Цитата

PHP Notice:  unserialize(): Error at offset 0 of 196 bytes in /admin/controller/module/questions_and_answers.php on line 501
PHP Warning:  array_merge(): Argument #2 is not an array in /admin/controller/module/questions_and_answers.php on line 503

Код questions_and_answers.php

Спойлер

<?php
define('EXTENSION_NAME',            'Questions &amp; Answers PRO');
define('EXTENSION_VERSION',         '2.1.0');
define('EXTENSION_ID',              '12158');
define('EXTENSION_COMPATIBILITY',   'OpenCart 2.0.1.x, 2.0.2.x and 2.0.3.x');
define('EXTENSION_STORE_URL',       'http://www.opencart.com/index.php?route=extension/extension/info&extension_id=' . EXTENSION_ID);
define('EXTENSION_PURCHASE_URL',    'http://www.opencart.com/index.php?route=extension/purchase&extension_id=' . EXTENSION_ID);
define('EXTENSION_SUPPORT_EMAIL',   '[email protected]');
define('EXTENSION_SUPPORT_FORUM',   'http://forum.opencart.com/viewtopic.php?f=123&t=103703');
define('OTHER_EXTENSIONS',          'http://www.opencart.com/index.php?route=extension/extension&filter_username=bull5-i');
define('EXTENSION_MIN_PHP_VERSION', '5.3.0');

class ControllerModuleQuestionsAndAnswers extends Controller {
	private $error = array();
	protected $alert = array(
		'error'     => array(),
		'warning'   => array(),
		'success'   => array(),
		'info'      => array()
	);

	private static $config_defaults = array(
		// General
		'qap_installed'                             => 1,
		'qap_installed_version'                     => EXTENSION_VERSION,
		'qap_status'                                => 0,
		'qap_available_bbcode_tags'                 => 'b,i,u,url',
		'qap_remove_sql_changes'                    => 0,

		// General / Hidden
		'qap_multilingual'                          => 0,
		'qap_list_questions'                        => 'all',
		'qap_list_language'                         => '*',
		'qap_admin_url'                             => HTTPS_SERVER,
		'qap_services'                              => "W10=",
		'qap_as'                                    => "WyIwIl0=",

		// General / Notifications
		'qap_new_question_notification'             => 1,
		'qap_new_answer_notification'               => 1,
		'qap_show_answer_in_customer_notification'  => 1,
		'qap_notification_emails'                   => array(),
		'qap_notification_from'                     => 0,

		// General / Dashboard widget
		'qap_db_questions_widget_status'            => 0,
		'qap_db_display_questions'                  => 0,
		'qap_db_answers_widget_status'              => 0,
		'qap_db_display_answers'                    => 0,

		// General / General questions page (FAQ)
		'qap_faq_status'                            => 0,
		'qap_faq_header_link'                       => 1,
		'qap_faq_footer_link'                       => 1,
		'qap_faq_seo_keyword'                       => 'faq',
		'qap_faq_questions_per_page'                => 25,
		'qap_faq_show_search'                       => 1,
		'qap_faq_show_sort'                         => 1,

		// Questions
		'qap_display_all_languages'                 => 1,
		'qap_login_to_view_general_questions'       => 0,
		'qap_login_to_view_product_questions'       => 0,
		'qap_allow_customer_general_questions'      => 1,
		'qap_allow_customer_product_questions'      => 1,
		'qap_login_to_ask_general_questions'        => 0,
		'qap_login_to_ask_product_questions'        => 0,
		'qap_moderate_new_questions'                => 1,
		'qap_allow_bbcode_in_questions'             => 0,
		'qap_display_question_date'                 => 0,
		'qap_display_question_author'               => 1,

		// Answers
		'qap_login_to_view_general_question_answers'=> 0,
		'qap_login_to_view_product_question_answers'=> 0,
		'qap_allow_customer_general_answers'        => 0,
		'qap_allow_customer_product_answers'        => 0,
		'qap_login_to_answer_general_questions'     => 1,
		'qap_login_to_answer_product_questions'     => 1,
		'qap_moderate_customer_answers'             => 0,
		'qap_allow_bbcode_in_answers'               => 0,
		'qap_allow_answer_voting'                   => 1,
		'qap_allow_anonymous_answer_voting'         => 0,
		'qap_display_answer_date'                   => 0,
		'qap_display_answer_author'                 => 1,

		// Form / Question
		'qap_q_form_min_question_length'            => 15,
		'qap_q_form_max_question_length'            => 300,
		'qap_q_form_max_details_length'             => 2000,
		'qap_q_form_display_name'                   => 1,
		'qap_q_form_require_name'                   => 1,
		'qap_q_form_min_name_length'                => 3,
		'qap_q_form_max_name_length'                => 25,
		'qap_q_form_display_email'                  => 1,
		'qap_q_form_require_email'                  => 0,
		'qap_q_form_display_phone'                  => 0,
		'qap_q_form_require_phone'                  => 0,
		'qap_q_form_display_custom_field1'          => 0,
		'qap_q_form_require_custom_field1'          => 0,
		'qap_q_form_min_custom_field1_length'       => 0,
		'qap_q_form_max_custom_field1_length'       => 0,
		'qap_q_form_custom_field1_name'             => array(),
		'qap_q_form_display_custom_field2'          => 0,
		'qap_q_form_require_custom_field2'          => 0,
		'qap_q_form_min_custom_field2_length'       => 0,
		'qap_q_form_max_custom_field2_length'       => 0,
		'qap_q_form_custom_field2_name'             => array(),
		'qap_q_form_display_custom_field3'          => 0,
		'qap_q_form_require_custom_field3'          => 0,
		'qap_q_form_min_custom_field3_length'       => 0,
		'qap_q_form_max_custom_field3_length'       => 0,
		'qap_q_form_custom_field3_name'             => array(),
		'qap_q_form_display_captcha'                => 1,
		'qap_q_form_require_captcha'                => 1,

		// Form / Answer
		'qap_a_form_min_answer_length'              => 2,
		'qap_a_form_max_answer_length'              => 2000,
		'qap_a_form_display_name'                   => 1,
		'qap_a_form_require_name'                   => 1,
		'qap_a_form_min_name_length'                => 3,
		'qap_a_form_max_name_length'                => 25,
		'qap_a_form_display_email'                  => 1,
		'qap_a_form_require_email'                  => 0,
		'qap_a_form_display_phone'                  => 0,
		'qap_a_form_require_phone'                  => 0,
		'qap_a_form_display_custom_field1'          => 0,
		'qap_a_form_require_custom_field1'          => 0,
		'qap_a_form_min_custom_field1_length'       => 0,
		'qap_a_form_max_custom_field1_length'       => 0,
		'qap_a_form_custom_field1_name'             => array(),
		'qap_a_form_display_custom_field2'          => 0,
		'qap_a_form_require_custom_field2'          => 0,
		'qap_a_form_min_custom_field2_length'       => 0,
		'qap_a_form_max_custom_field2_length'       => 0,
		'qap_a_form_custom_field2_name'             => array(),
		'qap_a_form_display_custom_field3'          => 0,
		'qap_a_form_require_custom_field3'          => 0,
		'qap_a_form_min_custom_field3_length'       => 0,
		'qap_a_form_max_custom_field3_length'       => 0,
		'qap_a_form_custom_field3_name'             => array(),
		'qap_a_form_display_captcha'                => 1,
		'qap_a_form_require_captcha'                => 1,
	);

	private static $module_defaults = array(
		'module_id'           => '',
		'name'                => '',
		'names'               => array(),
		'type'                => 'product-questions',
		'show_in_tab'         => '0',
		'questions_per_page'  => '15',
		'show_search'         => '1',
		'show_sort'           => '1',
		'lazy_load'           => '1',
		'status'              => '0',
	);

	private static $language_texts = array(
		// Texts
		'text_enabled', 'text_disabled', 'text_yes', 'text_no', 'text_toggle_navigation', 'text_legal_notice', 'text_license', 'text_extension_information',
		'text_terms', 'text_license_text', 'text_support_subject', 'text_faq', 'text_no_modules', 'text_saving', 'text_upgrading', 'text_canceling', 'text_loading',
		'text_opening', 'text_deleting', 'text_remove', 'text_notifications', 'text_dashboard_widgets', 'text_faq_page', 'text_faq_page_info', 'text_default_module_name',
		'text_header', 'text_footer', 'text_product_layout', 'text_confirm_delete', 'text_are_you_sure', 'text_edit_module', 'text_product_questions',
		'text_general_questions', 'text_ask_general_question', 'text_header', 'text_footer', 'text_product_layout', 'text_confirm_delete', 'text_are_you_sure',
		'text_today', 'text_last_7_days', 'text_last_30_days', 'text_last_180_days', 'text_last_360_days', 'text_question_form_settings', 'text_answer_form_settings',
		'text_always', 'text_not_when_logged_in', 'text_store_email_address', 'text_customer_email_address', 'text_bbcode_tags_reference', 'text_name', 'text_tag',
		'text_syntax',
		// Tabs
		'tab_settings', 'tab_questions', 'tab_answers', 'tab_form', 'tab_modules', 'tab_support', 'tab_about', 'tab_general', 'tab_faq', 'tab_services',
		'tab_changelog', 'tab_extension',
		// Buttons
		'button_save', 'button_apply', 'button_cancel', 'button_close', 'button_upgrade', 'button_add_module', 'button_remove', 'button_delete', 'button_refresh',
		'button_general_settings', 'button_purchase_license',
		// Help texts
		'help_dashboard_widget', 'help_remove_sql_changes', 'help_lazy_load', 'help_show_in_tab', 'help_login_to_view_product_questions',
		'help_login_to_view_product_answers', 'help_login_to_view_general_questions', 'help_login_to_view_general_answers', 'help_login_to_ask_product_questions',
		'help_login_to_ask_general_questions', 'help_login_to_answer_product_questions', 'help_login_to_answer_general_questions', 'help_moderate_new_questions',
		'help_moderate_customer_answers', 'help_product_question_answers', 'help_general_question_answers', 'help_allow_answer_voting',
		'help_allow_anonymous_answer_voting', 'help_available_bbcode_tags', 'help_new_question_notification', 'help_new_answer_notification',
		'help_show_answer_in_notification', 'help_notification_emails', 'help_notification_email_from', 'help_questions_per_page', 'help_purchase_additional_licenses',
		'help_display_all_languages', 'help_display_questions', 'help_product_questions', 'help_general_questions', 'help_seo_keyword',
		// Entries
		'entry_installed_version', 'entry_extension_status', 'entry_remove_sql_changes', 'entry_db_questions_widget_status', 'entry_db_answers_widget_status',
		'entry_display_questions', 'entry_display_answers', 'entry_faq_page', 'entry_faq_page_link', 'entry_show_search', 'entry_show_sort', 'entry_type',
		'entry_name', 'entry_show_in_tab', 'entry_status', 'entry_sort_order', 'entry_download_sort_order', 'entry_downloads_per_page', 'entry_lazy_load',
		'entry_login_to_view_general_questions', 'entry_login_to_view_general_answers', 'entry_login_to_view_product_questions',
		'entry_login_to_view_product_answers', 'entry_login_to_ask_general_questions', 'entry_login_to_ask_product_questions', 'entry_login_to_answer_general_questions',
		'entry_login_to_answer_product_questions', 'entry_moderate_new_questions', 'entry_moderate_customer_answers', 'entry_allow_bbcode_in_questions',
		'entry_general_question_answers', 'entry_product_question_answers', 'entry_allow_bbcode_in_answers', 'entry_allow_answer_voting',
		'entry_allow_anonymous_answer_voting', 'entry_available_bbcode_tags', 'entry_display_question_date', 'entry_display_question_author',
		'entry_display_answer_date', 'entry_display_answer_author', 'entry_new_question_notification', 'entry_new_answer_notification',
		'entry_show_answer_in_notification', 'entry_notification_emails', 'entry_notification_email_from', 'entry_questions_per_page',
		'entry_display_all_languages', 'entry_form_min_question_length', 'entry_form_max_question_length', 'entry_form_max_details_length',
		'entry_form_min_answer_length', 'entry_form_max_answer_length', 'entry_form_display_name', 'entry_form_require_name', 'entry_form_min_name_length',
		'entry_form_max_name_length', 'entry_form_display_email', 'entry_form_require_email', 'entry_form_display_phone', 'entry_form_require_phone',
		'entry_form_display_custom', 'entry_form_require_custom', 'entry_form_min_custom_length', 'entry_form_max_custom_length', 'entry_form_custom_field_name',
		'entry_form_display_captcha', 'entry_form_require_captcha', 'entry_extension_name', 'entry_extension_compatibility', 'entry_extension_store_url',
		'entry_copyright_notice', 'entry_general_questions', 'entry_product_questions', 'entry_seo_keyword', 'entry_active_on', 'entry_inactive_on',
		// Errors
		'error_module_name', 'error_seo_keyword', 'error_custom_field_name', 'error_positive_integer', 'error_integer', 'error_email', 'error_ajax_request'
	);

	public function __construct($registry) {
		parent::__construct($registry);
		$this->load->helper('qap');
		$this->load->language('module/questions_and_answers');
		$this->load->model('module/questions_and_answers');
	}

	public function index() {
		$this->document->addStyle('view/stylesheet/qap/module.min.css');

		$this->document->addScript('view/javascript/qap/module.min.js');

		$this->document->setTitle($this->language->get('extension_name'));

		$this->load->model('setting/setting');
		$this->load->model('extension/module');

		$ajax_request = isset($this->request->server['HTTP_X_REQUESTED_WITH']) && !empty($this->request->server['HTTP_X_REQUESTED_WITH']) && strtolower($this->request->server['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';

		if (isset($this->request->get['module_id'])) {
			$module_id = $this->request->get['module_id'];
		} else {
			$module_id = null;
		}

		if ($this->request->server['REQUEST_METHOD'] == 'POST' && !$ajax_request) {
			if (!is_null($module_id)) {
				if ($this->validateModuleForm($this->request->post)) {
					$this->model_extension_module->editModule($module_id, $this->request->post);

					$this->session->data['success'] = sprintf($this->language->get('text_success_update_module'), $this->request->post['name']);

					$this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
				}
			} else {
				if ($this->validateForm($this->request->post)) {
					$original_settings = $this->model_setting_setting->getSetting('qap');

					foreach (self::$config_defaults as $setting => $default) {
						$value = $this->config->get($setting);
						if ($value === null) {
							$original_settings[$setting] = $default;
						}
					}

					$modules = isset($this->request->post['modules']) ? $this->request->post['modules'] : array();
					unset($this->request->post['modules']);

					$settings = array_merge($original_settings, $this->request->post);
					$settings['qap_installed_version'] = $original_settings['qap_installed_version'];

					$this->model_setting_setting->editSetting('qap', $settings);

					$previous_modules = $this->model_extension_module->getModulesByCode('questions_and_answers');
					$previous_modules = array_remap_key_to_id('module_id', $previous_modules);

					foreach ($modules as $module) {
						if (!empty($module['module_id'])) {
							$module_id = $module['module_id'];
							unset($previous_modules[$module_id]);
							$this->model_extension_module->editModule($module_id, $module);
						} else {
							$this->model_extension_module->addModule('questions_and_answers', $module);

							$module_id = $this->db->getLastId();
							$module['module_id'] = $module_id;
							$this->model_extension_module->editModule($module_id, $module);
						}
					}

					// Delete any modules left over
					foreach ($previous_modules as $module_id => $module) {
						$this->model_extension_module->deleteModule($module_id);
					}

					$this->session->data['success'] = $this->language->get('text_success_update');

					$this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
				}
			}
		} else if ($this->request->server['REQUEST_METHOD'] == 'POST' && $ajax_request) {
			$response = array();

			if (!is_null($module_id)) {
				if ($this->validateModuleForm($this->request->post)) {
					$this->model_extension_module->editModule($module_id, $this->request->post);

					$this->alert['success']['updated'] = sprintf($this->language->get('text_success_update_module'), $this->request->post['name']);
				}
			} else {
				if ($this->validateForm($this->request->post)) {
					$original_settings = $this->model_setting_setting->getSetting('qap');

					foreach (self::$config_defaults as $setting => $default) {
						$value = $this->config->get($setting);
						if ($value === null) {
							$original_settings[$setting] = $default;
						}
					}

					$modules = isset($this->request->post['modules']) ? $this->request->post['modules'] : array();
					unset($this->request->post['modules']);

					$settings = array_merge($original_settings, $this->request->post);
					$settings['qap_installed_version'] = $original_settings['qap_installed_version'];

					$this->model_setting_setting->editSetting('qap', $settings);

					$previous_modules = $this->model_extension_module->getModulesByCode('questions_and_answers');
					$previous_modules = array_remap_key_to_id('module_id', $previous_modules);

					foreach ($modules as $idx => $module) {
						if (!empty($module['module_id'])) {
							$module_id = $module['module_id'];
							unset($previous_modules[$module_id]);
							$this->model_extension_module->editModule($module_id, $module);
						} else {
							$this->model_extension_module->addModule('questions_and_answers', $module);

							$module_id = $this->db->getLastId();

							$module['module_id'] = $module_id;
							$this->model_extension_module->editModule($module_id, $module);

							$response['values']['modules'][$idx]['module_id'] = $module_id;
						}
					}

					// Delete any modules left over
					foreach ($previous_modules as $module_id => $module) {
						$this->model_extension_module->deleteModule($module_id);
					}

					$this->alert['success']['updated'] = $this->language->get('text_success_update');

					if ((int)$original_settings['qap_status'] != (int)$this->request->post['qap_status']) {
						$response['reload'] = true;
						$this->session->data['success'] = $this->language->get('text_success_update');
					}
				} else {
					if (!$this->checkVersion()) {
						$response['reload'] = true;
					}
				}
			}

			$response = array_merge($response, array("errors" => $this->error), array("alerts" => $this->alert));

			$this->response->addHeader('Content-Type: application/json');
			$this->response->setOutput(json_enc($response, JSON_UNESCAPED_SLASHES));
			return;
		}

		$db_structure_ok = $this->checkVersion() && $this->model_module_questions_and_answers->checkDatabaseStructure($this->alert);

		$this->checkPrerequisites();

		$this->checkVersion();

		$data['heading_title'] = $this->language->get('extension_name');
		$data['text_other_extensions'] = sprintf($this->language->get('text_other_extensions'), OTHER_EXTENSIONS);

		foreach (self::$language_texts as $text) {
			$data[$text] = $this->language->get($text);
		}

		$data['ext_name'] = EXTENSION_NAME;
		$data['ext_version'] = EXTENSION_VERSION;
		$data['ext_id'] = EXTENSION_ID;
		$data['ext_compatibility'] = EXTENSION_COMPATIBILITY;
		$data['ext_store_url'] = EXTENSION_STORE_URL;
		$data['ext_purchase_url'] = EXTENSION_PURCHASE_URL;
		$data['ext_support_email'] = EXTENSION_SUPPORT_EMAIL;
		$data['ext_support_forum'] = EXTENSION_SUPPORT_FORUM;
		$data['other_extensions_url'] = OTHER_EXTENSIONS;
		$data['oc_version'] = VERSION;

		$data['alert_icon'] = function($type) {
			$icon = "";
			switch ($type) {
				case 'error':
					$icon = "fa-times-circle";
					break;
				case 'warning':
					$icon = "fa-exclamation-triangle";
					break;
				case 'success':
					$icon = "fa-check-circle";
					break;
				case 'info':
					$icon = "fa-info-circle";
					break;
				default:
					break;
			}
			return $icon;
		};

		if (!is_null($module_id) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
			$module_info = $this->model_extension_module->getModule($module_id);
			if (!$module_info) {
				$this->response->redirect($this->url->link('module/questions_and_answers', 'token=' . $this->session->data['token'], 'SSL'));
				return;
			}
		} else {
			$module_info = null;
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL'),
			'active'    => false
		);

		$data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_module'),
			'href'      => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
			'active'    => false
		);

		$data['breadcrumbs'][] = array(
			'text'      => $this->language->get('extension_name'),
			'href'      => $this->url->link('module/questions_and_answers', 'token=' . $this->session->data['token'], 'SSL'),
			'active'    => is_null($module_id)
		);

		if (!is_null($module_id)) {
			$module_name = (!empty($module_info['name'])) ? $module_info['name'] : ((!empty($this->request->post['name'])) ? $this->request->post['name'] : EXTENSION_NAME);
			$data['breadcrumbs'][] = array(
				'text'      => $module_name,
				'href'      => $this->url->link('module/questions_and_answers', 'token=' . $this->session->data['token'] . '&module_id=' . $module_id, 'SSL'),
				'active'    => true
			);
		}

		$data['save'] = $this->url->link('module/questions_and_answers', 'token=' . $this->session->data['token'] . (!is_null($module_id) ? '&module_id=' . $module_id : ''), 'SSL');
		$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
		$data['delete'] = $this->url->link('extension/module/delete', 'token=' . $this->session->data['token'] . (!is_null($module_id) ? '&module_id=' . $module_id : ''), 'SSL');
		$data['upgrade'] = $this->url->link('module/questions_and_answers/upgrade', 'token=' . $this->session->data['token'], 'SSL');
		$data['general_settings'] = $this->url->link('module/questions_and_answers', 'token=' . $this->session->data['token'], 'SSL');
		$data['extension_installer'] = $this->url->link('extension/installer', 'token=' . $this->session->data['token'], 'SSL');
		$data['services'] = html_entity_decode($this->url->link('module/questions_and_answers/services', 'token=' . $this->session->data['token'], 'SSL'));

		$data['update_pending'] = !$this->checkVersion();

		if (!$data['update_pending']) {
			$this->updateEventHooks();
		} else if (!is_null($module_id)) {
			$this->response->redirect($this->url->link('module/questions_and_answers', 'token=' . $this->session->data['token'], 'SSL'));
			return;
		}

		$data['ssl'] = (
				(int)$this->config->get('config_secure') ||
				isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ||
				!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ||
				!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on'
			) ? 's' : '';

		$this->load->model('localisation/language');
		$languages = $this->model_localisation_language->getLanguages();
		$data['languages'] = array_remap_key_to_id('language_id', $languages);
		$data['default_language'] = $this->config->get('config_language_id');
		$data['multilingual'] = count($languages) > 1;

		$data['seo_url'] = $this->config->get('config_seo_url');

		$data['installed_version'] = $this->installedVersion();

		$data['qap_admin_url'] = HTTPS_SERVER;

		if (is_null($module_id)) {
			# Loop through all settings for the post/config values
			foreach (array_keys(self::$config_defaults) as $setting) {
				if (isset($this->request->post[$setting])) {
					$data[$setting] = $this->request->post[$setting];
				} else {
					$data[$setting] = $this->config->get($setting);
					if ($data[$setting] === null) {
						if (!isset($this->alert['warning']['unsaved']) && $this->checkVersion())  {
							$this->alert['warning']['unsaved'] = $this->language->get('error_unsaved_settings');
						}
						if (isset(self::$config_defaults[$setting])) {
							$data[$setting] = self::$config_defaults[$setting];
						}
					}
				}
			}
			if (isset($this->request->post['modules'])) {
				$data['modules'] = $this->request->post['modules'];
			} else {
				$modules = $this->model_extension_module->getModulesByCode('questions_and_answers');

				foreach ($modules as $idx => $module) {
					$module_settings = unserialize($module['setting']);
					unset($module['setting']);
					$module = array_merge($module, $module_settings);

					foreach (array_keys(self::$module_defaults) as $setting) {
						if (!isset($module[$setting])) {
							$module[$setting] = self::$module_defaults[$setting];

							if (!isset($this->alert['warning']['unsaved']) && $this->checkVersion())  {
								$this->alert['warning']['unsaved'] = $this->language->get('error_unsaved_settings');
							}
						}
						$modules[$idx] = $module;
					}
				}

				$data['modules'] = $modules;
			}

			foreach (array_keys(self::$module_defaults) as $setting) {
				$data["qap_m_$setting"] = self::$module_defaults[$setting];
			}
		} else {
			foreach (array_keys(self::$module_defaults) as $setting) {
				if (isset($this->request->post[$setting])) {
					$data[$setting] = $this->request->post[$setting];
				} else if (isset($module_info[$setting])) {
					$data[$setting] = $module_info[$setting];
				} else {
					$data[$setting] = self::$module_defaults[$setting];
					if (!isset($this->alert['warning']['unsaved']) && $this->checkVersion())  {
						$this->alert['warning']['unsaved'] = $this->language->get('error_unsaved_settings');
					}
				}
			}
			$data['module_id'] = $module_id;

			$modules = $this->model_extension_module->getModulesByCode('questions_and_answers');

			$tab_position_used = 0;

			foreach ($modules as $idx => $module) {
				$module_settings = unserialize($module['setting']);
				if ((int)$module_settings['show_in_tab'] && $module_id != $module['module_id']) {
					$tab_position_used = 1;
					break;
				}
			}
			$data['tab_position_used'] = $tab_position_used;
		}

		$this->load->model('setting/store');

		$stores = $this->model_setting_store->getStores();

		$data['stores'] = array();

		$data['stores'][0] = array(
			'name' => $this->config->get('config_name'),
			'url'  => HTTP_CATALOG
		);

		foreach ($stores as $store) {
			$data['stores'][$store['store_id']] = array(
				'name' => $store['name'],
				'url'  => $store['url']
			);
		}

		if (isset($this->session->data['error'])) {
			$this->error = $this->session->data['error'];

			unset($this->session->data['error']);
		}

		if (isset($this->error['warning'])) {
			$this->alert['warning']['warning'] = $this->error['warning'];
		}

		if (isset($this->error['error'])) {
			$this->alert['error']['error'] = $this->error['error'];
		}

		if (isset($this->session->data['success'])) {
			$this->alert['success']['success'] = $this->session->data['success'];

			unset($this->session->data['success']);
		}

		$data['errors'] = $this->error;

		$data['token'] = $this->session->data['token'];

		$data['alerts'] = $this->alert;

		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');

		if (is_null($module_id)) {
			$this->response->setOutput($this->load->view('module/questions_and_answers.tpl', $data));
		} else {
			$this->response->setOutput($this->load->view('module/questions_and_answers_module.tpl', $data));
		}
	}

	public function install() {
		$this->registerEventHooks();

		$this->model_module_questions_and_answers->applyDatabaseChanges();

		// Add FAQ layout
		$this->load->model('design/layout');
		$this->load->model('setting/store');

		$stores = $this->model_setting_store->getStores();

		$layout_data = array();
		$layout_data["name"] = $this->language->get("text_faq_layout");
		$layout_data["layout_route"] = array(0 => array(
			"store_id"  => 0,
			"route"     => "module/questions_and_answers/faq"
		));

		foreach ($stores as $store) {
			$layout_data["layout_route"][] = array(
				"store_id"  => $store["store_id"],
				"route"     => "module/questions_and_answers/faq"
			);
		}

		$this->model_design_layout->addLayout($layout_data);

		$this->load->model('localisation/language');

		$languages = $this->model_localisation_language->getLanguages();
		$languages = array_remap_key_to_id('language_id', $languages);
		foreach ($languages as $language_id => $language) {
			self::$config_defaults['qap_notification_emails'][$language_id] = $this->config->get('config_email');
		}

		$this->load->model('setting/setting');
		$this->model_setting_setting->editSetting('qap', self::$config_defaults);
	}

	public function uninstall() {
		$this->removeEventHooks();

		if ($this->config->get("qap_remove_sql_changes")) {
			$this->model_module_questions_and_answers->revertDatabaseChanges();
		}

		// Remove FAQ layout
		$query = $this->db->query("SELECT layout_id FROM " . DB_PREFIX . "layout_route WHERE route = 'module/questions_and_answers/faq' LIMIT 1");
		if ($query->num_rows) {
			$this->load->model('design/layout');
			$this->model_design_layout->deleteLayout($query->row['layout_id']);
		}

		$this->load->model('setting/setting');
		$this->model_setting_setting->deleteSetting('qap');

		$this->load->model('extension/module');
		$this->model_extension_module->deleteModulesByCode('questions_and_answers');
	}

	public function upgrade() {
		$ajax_request = isset($this->request->server['HTTP_X_REQUESTED_WITH']) && !empty($this->request->server['HTTP_X_REQUESTED_WITH']) && strtolower($this->request->server['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';

		$response = array();

		if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateUpgrade()) {
			$this->load->model('setting/setting');

			if ($this->model_module_questions_and_answers->upgradeDatabaseStructure($this->installedVersion(), $this->alert)) {
				$settings = array();

				// Go over all settings, add new values and remove old ones
				foreach (self::$config_defaults as $setting => $default) {
					$value = $this->config->get($setting);
					if ($value === null) {
						$settings[$setting] = $default;
					} else {
						$settings[$setting] = $value;
					}
				}

				// Add FAQ layout if needed
				$query = $this->db->query("SELECT layout_id FROM " . DB_PREFIX . "layout_route WHERE route = 'module/questions_and_answers/faq' LIMIT 1");
				if (!$query->num_rows) {
					$this->load->model('design/layout');
					$this->load->model('setting/store');

					$stores = $this->model_setting_store->getStores();

					$layout_data = array();
					$layout_data["name"] = $this->language->get("text_faq_layout");
					$layout_data["layout_route"] = array(0 => array(
						"store_id"  => 0,
						"route"     => "module/questions_and_answers/faq"
					));

					foreach ($stores as $store) {
						$layout_data["layout_route"][] = array(
							"store_id"  => $store["store_id"],
							"route"     => "module/questions_and_answers/faq"
						);
					}

					$this->model_design_layout->addLayout($layout_data);
				}

				$settings['qap_installed_version'] = EXTENSION_VERSION;

				$this->model_setting_setting->editSetting('qap', $settings);

				$this->session->data['success'] = sprintf($this->language->get('text_success_upgrade'), EXTENSION_VERSION);
				$this->alert['success']['upgrade'] = sprintf($this->language->get('text_success_upgrade'), EXTENSION_VERSION);

				$response['success'] = true;
				$response['reload'] = true;
			} else {
				$this->alert['error']['database_upgrade'] = $this->language->get('error_upgrade_database');
			}
		}

		$response = array_merge($response, array("errors" => $this->error), array("alerts" => $this->alert));

		if (!$ajax_request) {
			$this->session->data['errors'] = $this->error;
			$this->session->data['alerts'] = $this->alert;
			$this->response->redirect($this->url->link('module/questions_and_answers', 'token=' . $this->session->data['token'], 'SSL'));
		} else {
			$this->response->addHeader('Content-Type: application/json');
			$this->response->setOutput(json_enc($response, JSON_UNESCAPED_SLASHES));
			return;
		}
	}

	public function services() {
		$services = base64_decode($this->config->get('qap_services'));
		$response = json_decode($services, true);
		$force = isset($this->request->get['force']) && (int)$this->request->get['force'];

		if ($response && isset($response['expires']) && $response['expires'] >= strtotime("now") && !$force) {
			$response['cached'] = true;
		} else {
			$url = "http://www.opencart.ee/services/?eid=" . EXTENSION_ID . "&info=true&general=true";
			$hostname = (!empty($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : '' ;

			if (function_exists('curl_init')) {
				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL, $url);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
				curl_setopt($ch, CURLOPT_HEADER, false);
				curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
				curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
				curl_setopt($ch, CURLOPT_TIMEOUT, 60);
				curl_setopt($ch, CURLOPT_USERAGENT, base64_encode("curl " . EXTENSION_ID));
				curl_setopt($ch, CURLOPT_REFERER, $hostname);
				$json = curl_exec($ch);
			} else {
				$json = false;
			}

			if ($json !== false) {
				$this->load->model('setting/setting');
				$settings = $this->model_setting_setting->getSetting('qap');
				$settings['qap_services'] = base64_encode($json);
				$this->model_setting_setting->editSetting('qap', $settings);
				$response = json_decode($json, true);
			} else {
				$response = array();
			}
		}

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_enc($response, JSON_UNESCAPED_SLASHES));
	}

	private function registerEventHooks() {
		// $this->load->model('extension/event');
		// $this->model_extension_event->addEvent('qap.product.add', 'post.product.add', 'module/questions_and_answers/add_hook');
	}

	private function removeEventHooks() {
		// $this->load->model('extension/event');
		// $this->model_extension_event->deleteEvent('qap.product.add');
	}

	private function updateEventHooks() {
		$this->load->model('extension/event');

		$event_hooks = array(
			// 'qap.product.add'           => array('trigger' => 'post.product.add',                   'action' => 'module/questions_and_answers/add_hook'),
		);

		foreach ($event_hooks as $code => $hook) {
			$event = $this->model_extension_event->getEvent($code);

			if (!$event || $event['trigger'] != $hook['trigger'] || $event['action'] != $hook['action']) {
				$this->model_extension_event->addEvent($code, $hook['trigger'], $hook['action']);

				if (empty($this->alert['success']['hooks_updated'])) {
					$this->alert['success']['hooks_updated'] = $this->language->get('text_success_hooks_update');
				}
			}
		}

		// Delete old triggers
		$query = $this->db->query("SELECT `code` FROM " . DB_PREFIX . "event WHERE `code` LIKE 'qap.%'");
		$events = array_keys($event_hooks);

		foreach ($query->rows as $row) {
			if (!in_array($row['code'], $events)) {
				$this->model_extension_event->deleteEvent($row['code']);

				if (empty($this->alert['success']['hooks_updated'])) {
					$this->alert['success']['hooks_updated'] = $this->language->get('text_success_hooks_update');
				}
			}
		}
	}

	private function checkPrerequisites() {
		$errors = false;

		if (!class_exists('VQMod')) {
			$errors = true;
			$this->alert['error']['vqmod'] = $this->language->get('error_vqmod');
		}

		if (version_compare(phpversion(), EXTENSION_MIN_PHP_VERSION) < 0) {
			$errors = true;
			$this->alert['error']['php'] = sprintf($this->language->get('error_php_version'), phpversion(), EXTENSION_MIN_PHP_VERSION);
		}

		return !$errors;
	}

	private function checkVersion() {
		$errors = false;

		$installed_version = $this->installedVersion();

		if ($installed_version != EXTENSION_VERSION) {
			$errors = true;
			$this->alert['info']['version'] = sprintf($this->language->get('error_version'), EXTENSION_VERSION);
		}

		return !$errors;
	}

	private function validate() {
		$errors = false;

		if (!$this->user->hasPermission('modify', 'module/questions_and_answers')) {
			$errors = true;
			$this->alert['error']['permission'] = $this->language->get('error_permission');
		}

		if (!$errors) {
			return $this->checkVersion() && $this->model_module_questions_and_answers->checkDatabaseStructure($this->alert) && $this->checkPrerequisites();
		} else {
			return false;
		}
	}

	private function validateUpgrade() {
		$errors = false;

		if (!$this->user->hasPermission('modify', 'module/questions_and_answers')) {
			$errors = true;
			$this->alert['error']['permission'] = $this->language->get('error_permission');
		}

		return !$errors;
	}

	private function validateForm(&$data) {
		$errors = false;

		if ($this->config->get('config_seo_url') && utf8_strlen(trim($data['qap_faq_seo_keyword'])) == 0) {
			$errors = true;
			$this->error['faq_seo_keyword'] = $this->language->get('error_seo_keyword');
		}

		if ((int)$data['qap_new_question_notification'] || (int)$data['qap_new_answer_notification']) {
			foreach ((array)$data['qap_notification_emails'] as $language_id => $value) {
				if (empty($value)) {
					$errors = true;
					$this->error["notification_emails"][$language_id]['email'] = $this->language->get('error_missing_email');
				} else {
					$emails = explode(',', $value);

					foreach ($emails as $email) {
						if (!validate_email($email)) {
							$errors = true;
							$this->error["notification_emails"][$language_id]['email'] = $this->language->get('error_email');
						}
					}
				}
			}
		}

		if ((int)$data['qap_q_form_min_question_length'] < 0 || (string)((int)$data['qap_q_form_min_question_length']) != $data['qap_q_form_min_question_length']) {
			$errors = true;
			$this->error['q_form_min_question_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_q_form_max_question_length'] < 0 || (string)((int)$data['qap_q_form_max_question_length']) != $data['qap_q_form_max_question_length']) {
			$errors = true;
			$this->error['q_form_max_question_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_q_form_max_question_length'] < (int)$data['qap_q_form_min_question_length']) {
			$errors = true;
			$this->error['q_form_max_question_length'] = $this->language->get('error_max_smaller');
		}

		if ((int)$data['qap_q_form_max_details_length'] < 0 || (string)((int)$data['qap_q_form_max_details_length']) != $data['qap_q_form_max_details_length']) {
			$errors = true;
			$this->error['q_form_max_details_length'] = $this->language->get('error_positive_integer');
		}

		if ((int)$data['qap_q_form_min_name_length'] < 0 || (string)((int)$data['qap_q_form_min_name_length']) != $data['qap_q_form_min_name_length']) {
			$errors = true;
			$this->error['q_form_min_name_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_q_form_max_name_length'] < 0 || (string)((int)$data['qap_q_form_max_name_length']) != $data['qap_q_form_max_name_length']) {
			$errors = true;
			$this->error['q_form_max_name_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_q_form_max_name_length'] < (int)$data['qap_q_form_min_name_length']) {
			$errors = true;
			$this->error['q_form_max_name_length'] = $this->language->get('error_max_smaller');
		}

		if ((int)$data['qap_a_form_min_answer_length'] < 0 || (string)((int)$data['qap_a_form_min_answer_length']) != $data['qap_a_form_min_answer_length']) {
			$errors = true;
			$this->error['a_form_min_answer_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_a_form_max_answer_length'] < 0 || (string)((int)$data['qap_a_form_max_answer_length']) != $data['qap_a_form_max_answer_length']) {
			$errors = true;
			$this->error['a_form_max_answer_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_a_form_max_answer_length'] < (int)$data['qap_a_form_min_answer_length']) {
			$errors = true;
			$this->error['a_form_max_answer_length'] = $this->language->get('error_max_smaller');
		}

		if ((int)$data['qap_a_form_min_name_length'] < 0 || (string)((int)$data['qap_a_form_min_name_length']) != $data['qap_a_form_min_name_length']) {
			$errors = true;
			$this->error['a_form_min_name_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_a_form_max_name_length'] < 0 || (string)((int)$data['qap_a_form_max_name_length']) != $data['qap_a_form_max_name_length']) {
			$errors = true;
			$this->error['a_form_max_name_length'] = $this->language->get('error_positive_integer');
		} else if ((int)$data['qap_a_form_max_name_length'] < (int)$data['qap_a_form_min_name_length']) {
			$errors = true;
			$this->error['a_form_max_name_length'] = $this->language->get('error_max_smaller');
		}

		foreach (array(1, 2, 3) as $index) {
			if ((int)$data['qap_q_form_display_custom_field' . $index]) {
				foreach ((array)$data['qap_q_form_custom_field' . $index . '_name'] as $language_id => $value) {
					if (utf8_strlen(trim($value)) == 0) {
						$errors = true;
						$this->error['q_form_custom_field' . $index . '_name'][$language_id]['name'] = $this->language->get('error_custom_field_name');
					}
				}
			}

			if ((int)$data['qap_q_form_min_custom_field' . $index . '_length'] < 0 || (string)((int)$data['qap_q_form_min_custom_field' . $index . '_length']) != $data['qap_q_form_min_custom_field' . $index . '_length']) {
				$errors = true;
				$this->error['q_form_min_custom_field' . $index . '_length'] = $this->language->get('error_positive_integer');
			} else if ((int)$data['qap_q_form_max_custom_field' . $index . '_length'] < 0 || (string)((int)$data['qap_q_form_max_custom_field' . $index . '_length']) != $data['qap_q_form_max_custom_field' . $index . '_length']) {
				$errors = true;
				$this->error['q_form_max_custom_field' . $index . '_length'] = $this->language->get('error_positive_integer');
			} else if ((int)$data['qap_q_form_max_custom_field' . $index . '_length'] < (int)$data['qap_q_form_min_custom_field' . $index . '_length']) {
				$errors = true;
				$this->error['q_form_max_custom_field' . $index . '_length'] = $this->language->get('error_max_smaller');
			}
		}

		foreach (array(1, 2, 3) as $index) {
			if ((int)$data['qap_a_form_display_custom_field' . $index]) {
				foreach ((array)$data['qap_a_form_custom_field' . $index . '_name'] as $language_id => $value) {
					if (utf8_strlen(trim($value)) == 0) {
						$errors = true;
						$this->error['a_form_custom_field' . $index . '_name'][$language_id]['name'] = $this->language->get('error_custom_field_name');
					}
				}
			}

			if ((int)$data['qap_a_form_min_custom_field' . $index . '_length'] < 0 || (string)((int)$data['qap_a_form_min_custom_field' . $index . '_length']) != $data['qap_a_form_min_custom_field' . $index . '_length']) {
				$errors = true;
				$this->error['a_form_min_custom_field' . $index . '_length'] = $this->language->get('error_positive_integer');
			} else if ((int)$data['qap_a_form_max_custom_field' . $index . '_length'] < 0 || (string)((int)$data['qap_a_form_max_custom_field' . $index . '_length']) != $data['qap_a_form_max_custom_field' . $index . '_length']) {
				$errors = true;
				$this->error['a_form_max_custom_field' . $index . '_length'] = $this->language->get('error_positive_integer');
			} else if ((int)$data['qap_a_form_max_custom_field' . $index . '_length'] < (int)$data['qap_a_form_min_custom_field' . $index . '_length']) {
				$errors = true;
				$this->error['a_form_max_custom_field' . $index . '_length'] = $this->language->get('error_max_smaller');
			}
		}

		if ((int)$data['qap_faq_questions_per_page'] < 0 || (string)((int)$data['qap_faq_questions_per_page']) != $data['qap_faq_questions_per_page']) {
			$errors = true;
			$this->error['faq_questions_per_page'] = $this->language->get('error_positive_integer');
		}

		if (isset($data['modules'])) {
			foreach ((array)$data['modules'] as $idx => $module) {
				if (isset($module['names'])) {
					foreach ((array)$module['names'] as $language_id => $value) {
						if (!utf8_strlen($value)) {
							$errors = true;
							$this->error['modules'][$idx]['names'][$language_id]['name'] = $this->language->get('error_module_name');
						}
					}
				} else {
					$errors = true;
				}

				if ((int)$module['questions_per_page'] < 0 || (string)((int)$module['questions_per_page']) != $module['questions_per_page']) {
					$errors = true;
					$this->error['modules'][$idx]['questions_per_page'] = $this->language->get('error_positive_integer');
				}
			}
		}

		if ($errors) {
			$this->alert['warning']['warning'] = $this->language->get('error_warning');
		}

		if (!$errors) {
			return $this->validate();
		} else {
			return false;
		}
	}

	private function validateModuleForm(&$data) {
		$errors = false;

		if (isset($data['names'])) {
			foreach ((array)$data['names'] as $language_id => $value) {
				if (!utf8_strlen($value)) {
					$errors = true;
					$this->error['names'][$language_id]['name'] = $this->language->get('error_module_name');
				}
			}
		} else {
			$errors = true;
		}

		if ((int)$data['questions_per_page'] < 0 || (string)((int)$data['questions_per_page']) != $data['questions_per_page']) {
			$errors = true;
			$this->error['questions_per_page'] = $this->language->get('error_positive_integer');
		}

		if ($errors) {
			$this->alert['warning']['warning'] = $this->language->get('error_warning');
		}

		if (!$errors) {
			return $this->validate();
		} else {
			return false;
		}
	}

	private function installedVersion() {
		$installed_version = $this->config->get('qap_installed_version');
		return $installed_version ? $installed_version : '2.0.0';
	}
}

 

 

При попытке вызова модуля:

Цитата

PHP Notice:  unserialize(): Error at offset 0 of 196 bytes in /catalog/controller/product/product.php on line 279
PHP Notice:  unserialize(): Error at offset 0 of 196 bytes in /catalog/controller/product/product.php on line 279

Код в product.php:

Спойлер

if ($this->config->get('qap_status')) {
                $this->load->model('extension/module');

                $qap_modules = $this->model_extension_module->getModulesByCode('questions_and_answers');

                $qap_settings = null;

                foreach((array)$qap_modules as $module) {
                    $module_settings = unserialize($module['setting']);

                    if ($module_settings['type'] == 'product-questions' && (int)$module_settings['status']) {
                        $qap_settings = $module_settings;
                        break;
                    }
                }

                $data['text_ask'] = $this->language->get('text_ask');

                if ($qap_settings && (int)$qap_settings['show_in_tab']) {
                    $data['question_form_url'] = $this->url->link('module/questions_and_answers/question_form', 'mid=' . $qap_settings['module_id'] . '&pos=content_modal' . ($product_id ? '&pid=' . $product_id : ''), 'SSL');
                    $data['qas'] = $this->load->controller('module/questions_and_answers', $qap_settings);
                    $data['tab_qap'] = isset($qap_settings['names'][$this->config->get('config_language_id')]) ? $qap_settings['names'][$this->config->get('config_language_id')] : $this->language->get('tab_qap');
                    $product_question_count = isset($this->session->data["question_count"][$product_id]) ? $this->session->data["question_count"][$product_id] : 0;
                    $data['tab_qap'] = sprintf($data['tab_qap'], $product_question_count);
                    $data['qap_mid'] = $qap_settings['module_id'];

                    if ($data['qas']) {
                        $this->document->addScript('catalog/view/javascript/qap/qap.min.js');

                        if (file_exists('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/qap/qap.min.css')) {
                            $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/qap/qap.min.css');
                        } else {
                            $this->document->addStyle('catalog/view/theme/default/stylesheet/qap/qap.min.css');
                        }
                    }
                } else {
                    $data['tab_qap'] = $this->language->get('tab_qap');
                    $data['qas'] = null;
                    $data['qap_mid'] = '0';

                    if ($qap_settings) {
                        $data['question_form_url'] = $this->url->link('module/questions_and_answers/question_form', 'mid=' . $qap_settings['module_id'] . '&pos=content_modal' . ($product_id ? '&pid=' . $product_id : ''), 'SSL');
                        $data['qap_mid'] = $qap_settings['module_id'];
                    }
                }
            } else {
                $data['qas'] = null;
            }

 

 

 

В чём может быть причина? Пробовал менять в базе строку с настройкой модуля в oc_module, без толку.oc_module

Змінено користувачем fanton123
Надіслати
Поділитися на інших сайтах


Так https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=12158&filter_download_id=58&filter_rating=2&page=4

У модуля есть поддержка же? Если Вы его купили, то как минимум нужно попробовать задать вопрос автору модуля. И я бы не стал вываливать весь код модуля в паблик, все же это чей то труд (

  • +1 1
Надіслати
Поділитися на інших сайтах


13 минут назад, fanton123 сказал:

Модуль не мой попросили адаптировать. А я понять почему он работает на половину.

Ну тогда научитесь гуглить https://davidwalsh.name/php-serialize-unserialize-issues

https://www.google.com/search?q=PHP+Notice%3A+unserialize()%3A+Error+at+offset+0+of+196+bytes&oq=PHP+Notice%3A+ unserialize()%3A+Error+at+offset+0+of+196+bytes&aqs=chrome..69i57j69i64&sourceid=chrome&ie=UTF-8

Раз взялись помогать, но не хотите обращаться в поддержку. По сути со стороны щас выглядит так - "скачал варез, не работает" ищет помощи, придумывает оправдания.

Надіслати
Поділитися на інших сайтах


Вместо сериализации используйте json (encode/decode), правил много модулей PAVOTHEMES / и другие забугорные, если все данные на английском все ок сохраняет, кириллици - отлетает с ошибкой Notice:  unserialize(): Error at offset

Надіслати
Поділитися на інших сайтах

Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.