Jump to content
Sign in to follow this  

Ошибка PHP, Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION

Recommended Posts

После редактирования полей в гостевом оформлении заказа выдвет ошибку:

SyntaxError: JSON Parse error: Unrecognized token '<'

<br />
<b>Parse error</b>:  syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) in <b>/home/mstislav/domains/akhost.ru/public_html/solnishkova/catalog/controller/checkout/guest.php</b> on line <b>251</b><br />

if (!$json) {
$this->session->data['guest']['customer_group_id'] = $customer_group_id;
$this->session->data['guest']['firstname'] = $this->request->post['firstname'];
$this->session->data['guest']['email'] = $this->request->post['email'];
$this->session->data['guest']['telephone'] = $this->request->post['telephone'];

$this->session->data['guest']['payment']['firstname'] = $this->request->post['firstname'];

$this->session->data['guest']['payment']['tax_id'] = $this->request->post['tax_id'];
$this->session->data['guest']['payment']['address_1'] = $this->request->post['address_1'];
$this->session->data['guest']['payment']['address_2'] = $this->request->post['address_2'];
$this->session->data['guest']['payment']['city'] = $this->request->post['city'];
$this->session->data['guest']['payment']['country_id'] = $this->request->post['country_id'];
$this->session->data['guest']['payment']['zone_id'] = $this->request->post['zone_id'];


$country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);

if ($country_info) {
$this->session->data['guest']['payment']['country'] = $country_info['name'];
$this->session->data['guest']['payment']['iso_code_2'] = $country_info['iso_code_2'];
$this->session->data['guest']['payment']['iso_code_3'] = $country_info['iso_code_3'];
$this->session->data['guest']['payment']['address_format'] = $country_info['address_format'];
} else {
$this->session->data['guest']['payment']['country'] = '';
$this->session->data['guest']['payment']['iso_code_2'] = '';
$this->session->data['guest']['payment']['iso_code_3'] = '';
$this->session->data['guest']['payment']['address_format'] = '';


$zone_info = $this->model_localisation_zone->getZone($this->request->post['zone_id']);

if ($zone_info) {
$this->session->data['guest']['payment']['zone'] = $zone_info['name'];
$this->session->data['guest']['payment']['zone_code'] = $zone_info['code'];
} else {
$this->session->data['guest']['payment']['zone'] = '';
$this->session->data['guest']['payment']['zone_code'] = '';

if (!empty($this->request->post['shipping_address'])) {
$this->session->data['guest']['shipping_address'] = true;
} else {
$this->session->data['guest']['shipping_address'] = false;

Share this post

Link to post
Share on other sites

В вопросе уже половина ответа. Сравните оригинальный файл из чистого дистрибутива с вашим исправленным - перед if (!$json) { скорей всего скобку закрывающую забыли, либо лишнюю поставили, либо после скобки ; воткнули.

Лучше всего использовать Notepad++ или иной редактор с подсветкой синтаксиса.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.


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.