Post by blongso » Wed Nov 23, 2022 5:45 am

Hello community!
I need help because I have no idea how to correct this error:
"A non well formed numeric value encountered in /home3/xxxx/public_html/xxxx/catalog/model/extension/total/shipping.php on line 24"

Code: Select all

<?php
class ModelExtensionTotalShipping extends Model {
	public function getTotal($total) {
		if ($this->cart->hasShipping() && isset($this->session->data['shipping_method'])) {
			$total['totals'][] = array(
				'code'       => 'shipping',
				'title'      => $this->session->data['shipping_method']['title'],
				'value'      => $this->session->data['shipping_method']['cost'],
				'sort_order' => $this->config->get('total_shipping_sort_order')
			);

			if ($this->session->data['shipping_method']['tax_class_id']) {
				$tax_rates = $this->tax->getRates($this->session->data['shipping_method']['cost'], $this->session->data['shipping_method']['tax_class_id']);

				foreach ($tax_rates as $tax_rate) {
					if (!isset($total['taxes'][$tax_rate['tax_rate_id']])) {
						$total['taxes'][$tax_rate['tax_rate_id']] = $tax_rate['amount'];
					} else {
						$total['taxes'][$tax_rate['tax_rate_id']] += $tax_rate['amount'];
					}
				}
			}

			$total['total'] += $this->session->data['shipping_method']['cost'];
		}
	}
}
Line 24= $total['total'] += $this->session->data['shipping_method']['cost'];

BTW ... our customers have problems since they do not arrive on a system of direct payment by card. Could this problem be related to the error?
Can someone please help us?
THX in advance!!

New member

Posts

Joined
Sat Apr 11, 2020 4:18 am

Post by Cue4cheap » Wed Nov 23, 2022 7:16 am

You didn't tell us the OC version but maybe this: https://github.com/opencart/opencart/is ... -469652397
There are other posts about this so do a search....
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by ADD Creative » Wed Nov 23, 2022 8:08 am

Check all your shipping extensions. Maybe one of the costs has some extra characters in.

Does your site have display errors on. If so the notice could cause other problems. You should never have error display on on a live production site.

You need make sure display errors in set to off in all 3 places. Your PHP settings, in system/config/default.php and in the settings. Not only can this cause minor notices and warnings to cause bigger errors, as you have seen, it can also be a security risk.

1. In your PHP settings make sure display_errors is set to Off. Use phpinfo() to check. It should be off by default, but there are lots of rubbish hosts out there.

2. In system/config/default.php set error_display to false.

3. In your OpenCart Setting on the server tab set Display Errors to No.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 103 guests