Post by opensab677 » Sun Mar 13, 2022 10:23 pm

On my hosting with php 7.4 after upgrade from version 3.0.2.0 to 3.0.3.8 I notice that when I place a product in the cart and click on checkout I have this message
Warning: A non-numeric value encountered in /home/....../public_html/....../catalog/model/extension/total/shipping.php on line 24
... where on line 24 I have
$total['total'] += $this->session->data['shipping_method']['cost'];

...and after upgrade doesn't work anymore seo urls that instead worked on 3.0.2.0
Anyone has suggestions?
thanks

New member

Posts

Joined
Mon Sep 04, 2017 7:54 pm

Post by straightlight » Sun Mar 13, 2022 10:30 pm

opensab677 wrote:
Sun Mar 13, 2022 10:23 pm
On my hosting with php 7.4 after upgrade from version 3.0.2.0 to 3.0.3.8 I notice that when I place a product in the cart and click on checkout I have this message
Warning: A non-numeric value encountered in /home/....../public_html/....../catalog/model/extension/total/shipping.php on line 24
... where on line 24 I have
$total['total'] += $this->session->data['shipping_method']['cost'];

...and after upgrade doesn't work anymore seo urls that instead worked on 3.0.2.0
Anyone has suggestions?
thanks
On line 4 of that file, replace:

Code: Select all

if ($this->cart->hasShipping() && isset($this->session->data['shipping_method'])) {
with:

Code: Select all

if ($this->cart->hasShipping() && isset($this->session->data['shipping_method']['title']) && isset($this->session->data['shipping_method']['cost'])) {

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by opensab677 » Sun Mar 13, 2022 11:35 pm

now in /catalog/model/extension/total/ (opencart 3.0.3.8 + Php 7.4)
the file shipping.php is like this below but the error persist

<?php
class ModelExtensionTotalShipping extends Model {
public function getTotal($total) {
if ($this->cart->hasShipping() && isset($this->session->data['shipping_method']['title']) && isset($this->session->data['shipping_method']['cost'])) {
$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'];
}
}
}

New member

Posts

Joined
Mon Sep 04, 2017 7:54 pm

Post by straightlight » Mon Mar 14, 2022 1:53 am

See this solution inside the method: https://github.com/opencart/opencart/bl ... ipping.php (and exclude the 'extension' key line in the array).

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 4 guests