Page 1 of 1

[SOLVED] PHP7.4 Error

Posted: Sun Apr 03, 2022 8:23 pm
by SenerK
Hello,

In PHP7.4 I get an error like this in the plugin, how can I solve it?
Unknown: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /public_html/catalog/model/extension/total/promotion_total.php on line 1260
promotion_total.php on line 1260;

Code: Select all


1260				$promotion_name = isset($general_settings['name'][$this->config->get('config_language')]) ? $general_settings['name'][$this->config->get('config_language')] : is_array($general_settings['name']) ? end($general_settings['name']) : '';
1261
1262				$conditions = $value['conditions'];
1263				$condition_rules = $value['condition_rules'];
1264				$actions = $value['actions'];
1265				$total_promotion = 0;
1266				$this->usedProducts = array();
Thanks,
Sener

Re: PHP7.4 Error

Posted: Sun Apr 03, 2022 9:13 pm
by JNeuhoff
There is no catalog/model/extension/total/promotion_total.php in OpenCart 3.0.x.x releases.

Hence, you'll have to contact the extension author to fix this line, which should be easily done.

Re: PHP7.4 Error

Posted: Mon Apr 04, 2022 12:40 am
by straightlight

Code: Select all

if (isset($general_settings['name'][$this->config->get('config_language')])) {
	$promotion_name = $general_settings['name'][$this->config->get('config_language')];
} elseif (!empty($general_settings['name']) && is_array($general_settings['name'])) {
	$promotion_name = end($general_settings['name']);
}

$conditions = $value['conditions'];

$condition_rules = $value['condition_rules'];

$actions = $value['actions'];

$total_promotion = 0;

$this->usedProducts = array();

[Solved] Re: PHP7.4 Error

Posted: Mon Apr 04, 2022 4:04 am
by SenerK
Thanks, problem solved!
straightlight wrote:
Mon Apr 04, 2022 12:40 am

Code: Select all

if (isset($general_settings['name'][$this->config->get('config_language')])) {
	$promotion_name = $general_settings['name'][$this->config->get('config_language')];
} elseif (!empty($general_settings['name']) && is_array($general_settings['name'])) {
	$promotion_name = end($general_settings['name']);
}

$conditions = $value['conditions'];

$condition_rules = $value['condition_rules'];

$actions = $value['actions'];

$total_promotion = 0;

$this->usedProducts = array();

Re: [Solved] Re: PHP7.4 Error

Posted: Mon Apr 04, 2022 4:23 am
by straightlight
SenerK wrote:
Mon Apr 04, 2022 4:04 am
Thanks, problem solved!
straightlight wrote:
Mon Apr 04, 2022 12:40 am

Code: Select all

if (isset($general_settings['name'][$this->config->get('config_language')])) {
	$promotion_name = $general_settings['name'][$this->config->get('config_language')];
} elseif (!empty($general_settings['name']) && is_array($general_settings['name'])) {
	$promotion_name = end($general_settings['name']);
}

$conditions = $value['conditions'];

$condition_rules = $value['condition_rules'];

$actions = $value['actions'];

$total_promotion = 0;

$this->usedProducts = array();
No problem, enjoy!