Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

При оформлении заказа ошибка: Unexpected < in JSON


Recommended Posts

Здравствуйте! Очень давно в магазине на ostore 2.3 получаем ошибку при оформлении заказа:
image.png.9e01a8b5e8b9a217ba815ae3d0c60b67.png

 

Прилагаю кусочек кода строчки 174 startup.php 
 

$this->tax->setShippingAddress($this->session->data['shipping_address']['country_id'], $this->session->data['shipping_address']['zone_id']);


И весь файл startup.php
 

Спойлер
<?php
class ControllerStartupStartup extends Controller {
public function index() {
// Store
if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`ssl`, 'www.', '') = '" . $this->db->escape('https://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'");
} else {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`url`, 'www.', '') = '" . $this->db->escape('http://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'");
}
 
if (isset($this->request->get['store_id'])) {
$this->config->set('config_store_id', (int)$this->request->get['store_id']);
} else if ($query->num_rows) {
$this->config->set('config_store_id', $query->row['store_id']);
} else {
$this->config->set('config_store_id', 0);
}
 
if (!$query->num_rows) {
$this->config->set('config_url', HTTP_SERVER);
$this->config->set('config_ssl', HTTPS_SERVER);
}
 
// Settings
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "setting` WHERE store_id = '0' OR store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY store_id ASC");
 
foreach ($query->rows as $result) {
if (!$result['serialized']) {
$this->config->set($result['key'], $result['value']);
} else {
$this->config->set($result['key'], json_decode($result['value'], true));
}
}
 
// Url
$this->registry->set('url', new Url($this->config->get('config_url'), $this->config->get('config_secure') ? $this->config->get('config_ssl') : $this->config->get('config_url')));
 
// Language
$code = '';
 
$this->load->model('localisation/language');
 
$languages = $this->model_localisation_language->getLanguages();
 
if (isset($this->session->data['language'])) {
$code = $this->session->data['language'];
}
 
if (isset($this->request->cookie['language']) && !array_key_exists($code, $languages)) {
$code = $this->request->cookie['language'];
}
 
// Language Detection
if (!empty($this->request->server['HTTP_ACCEPT_LANGRUGE']) && !array_key_exists($code, $languages)) {
$detect = '';
 
$browser_languages = explode(',', $this->request->server['HTTP_ACCEPT_LANGRUGE']);
 
// Try using local to detect the language
foreach ($browser_languages as $browser_language) {
foreach ($languages as $key => $value) {
if ($value['status']) {
$locale = explode(',', $value['locale']);
 
if (in_array($browser_language, $locale)) {
$detect = $key;
break 2;
}
}
}
}
 
if (!$detect) {
// Try using language folder to detect the language
foreach ($browser_languages as $browser_language) {
if (array_key_exists(strtolower($browser_language), $languages)) {
$detect = strtolower($browser_language);
 
break;
}
}
}
 
$code = $detect ? $detect : '';
}
 
if (!array_key_exists($code, $languages)) {
$code = $this->config->get('config_language');
}
 
if (!isset($this->session->data['language']) || $this->session->data['language'] != $code) {
$this->session->data['language'] = $code;
}
 
if (!isset($this->request->cookie['language']) || $this->request->cookie['language'] != $code) {
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}
 
// Overwrite the default language object
$language = new Language($code);
$language->load($code);
 
$this->registry->set('language', $language);
 
// Set the config language_id
$this->config->set('config_language_id', $languages[$code]['language_id']);
 
// Set multiLanguage settings
$langdata = $this->config->get('config_langdata');
if (isset($langdata[$languages[$code]['language_id']])) {
foreach ($langdata[$languages[$code]['language_id']] as $key => $value) {
$this->config->set('config_' . $key, $value);
}
}
 
// Customer
$customer = new Cart\Customer($this->registry);
$this->registry->set('customer', $customer);
 
// Customer Group
if ($this->customer->isLogged()) {
$this->config->set('config_customer_group_id', $this->customer->getGroupId());
} elseif (isset($this->session->data['customer']) && isset($this->session->data['customer']['customer_group_id'])) {
// For API calls
$this->config->set('config_customer_group_id', $this->session->data['customer']['customer_group_id']);
} elseif (isset($this->session->data['guest']) && isset($this->session->data['guest']['customer_group_id'])) {
$this->config->set('config_customer_group_id', $this->session->data['guest']['customer_group_id']);
}
 
// Tracking Code
if (isset($this->request->get['tracking'])) {
setcookie('tracking', $this->request->get['tracking'], time() + 3600 * 24 * 1000, '/');
 
$this->db->query("UPDATE `" . DB_PREFIX . "marketing` SET clicks = (clicks + 1) WHERE code = '" . $this->db->escape($this->request->get['tracking']) . "'");
}
 
// Affiliate
$this->registry->set('affiliate', new Cart\Affiliate($this->registry));
 
// Currency
$code = '';
 
$this->load->model('localisation/currency');
 
$currencies = $this->model_localisation_currency->getCurrencies();
 
if (isset($this->session->data['currency'])) {
$code = $this->session->data['currency'];
}
 
if (isset($this->request->cookie['currency']) && !array_key_exists($code, $currencies)) {
$code = $this->request->cookie['currency'];
}
 
if (!array_key_exists($code, $currencies)) {
$code = $this->config->get('config_currency');
}
 
if (!isset($this->session->data['currency']) || $this->session->data['currency'] != $code) {
$this->session->data['currency'] = $code;
}
 
if (!isset($this->request->cookie['currency']) || $this->request->cookie['currency'] != $code) {
setcookie('currency', $code, time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
}
 
$this->registry->set('currency', new Cart\Currency($this->registry));
 
// Tax
$this->registry->set('tax', new Cart\Tax($this->registry));
 
if (isset($this->session->data['shipping_address'])) {
$this->tax->setShippingAddress($this->session->data['shipping_address']['country_id'], $this->session->data['shipping_address']['zone_id']);
} elseif ($this->config->get('config_tax_default') == 'shipping') {
$this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
 
if (isset($this->session->data['payment_address'])) {
$this->tax->setPaymentAddress($this->session->data['payment_address']['country_id'], $this->session->data['payment_address']['zone_id']);
} elseif ($this->config->get('config_tax_default') == 'payment') {
$this->tax->setPaymentAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
}
 
$this->tax->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
 
// Weight
$this->registry->set('weight', new Cart\Weight($this->registry));
 
// Length
$this->registry->set('length', new Cart\Length($this->registry));
 
// Cart
$this->registry->set('cart', new Cart\Cart($this->registry));
 
// Encryption
$this->registry->set('encryption', new Encryption($this->config->get('config_encryption')));
 
// OpenBay Pro
$this->registry->set('openbay', new Openbay($this->registry));
}
}


Помогите пожалуйси, в какую сторону копать. 

Link to comment
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
 Share

  • 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.