Adjustment to home delivery module

Merchant
จาก Australia
เป็นสมาชิกตั้งแต่ มิ.ย. 2023

I was getting a deprecated command error with litecart and PHP 8.2 for the below:

$customer['shipping_address']['postcode'] = preg_replace('#([0-9]{3})-?([0-9]{2})#', '$1$2',
$customer['shipping_address']['postcode']);

This was the fix:

if (isset($customer['shipping_address']['postcode'])) {
    $postcode = $customer['shipping_address']['postcode'];
    $postcode = preg_replace('#([0-9]{3})-?([0-9]{2})#', '$1$2', $postcode);
    $customer['shipping_address']['postcode'] = $postcode;
}

tim
Founder
จาก Sweden
เป็นสมาชิกตั้งแต่ พ.ค. 2013
tim

What file is this? PHP 8.2 will go bananas if passing null when expecting a string argument.

Merchant
จาก Australia
เป็นสมาชิกตั้งแต่ มิ.ย. 2023

Sorry tim its the sm_home_delivery.inc file from the addon library - https://www.litecart.net/en/addons/152/home-delivery

It notes compatibility to 1.3.6

but with this code modification it works with 2.5.4 and PHP 8.2

tim
Founder
จาก Sweden
เป็นสมาชิกตั้งแต่ พ.ค. 2013
tim

Ok, I moved this forum topic from Feature Requests to the Addons section, connecting it to the right addon. For Public Domain addons you are allowed to upload updates of the addons directly on the addon page.

คุณ
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.