Easystore Warning "Attempt To Read Property "quantity" On Null In...administrator/components/com_easystore/src/Checkout/OrderManager.php On Line 827" - Question | JoomShaper
SP Page Builder 6 is Here! Learn More →

Easystore Warning "Attempt To Read Property "quantity" On Null In...administrator/components/com_easystore/src/Checkout/OrderManager.php On Line 827"

AF

Alexander Frenkel

EasyStore 5 months ago

Hi team, getting this many times in my Orders list:

Warning: Attempt to read property "quantity" on null in /var/www/vhosts/.../administrator/components/com_easystore/src/Checkout/OrderManager.php on line 827

May be someone could check. Thank you. BR, Alexander

0
3 Answers
Toufiq
Toufiq
Accepted Answer
Senior Staff 5 months ago #192022

Hi there,

Thank you for reaching out, and I apologize for any inconvenience caused by this oversight. Please check now. We will update it next update.

administrator/components/com_easystore/src/Checkout/OrderManager.php

old code

        return array_map(function ($item) {

            $item->weight = $item->weight ?? 0;
            $unit = $item->has_variants 
                ? (isset($item->variant_data->unit) ? $item->variant_data->unit : (isset($item->unit) ? $item->unit : null)) 
                : (isset($item->unit) ? $item->unit : null);
            $item->unit = $unit;
            $item->weight_total = bcmul($item->weight, (int) $item->cart_item->quantity, 2);
            $item->weight_total_with_unit = SettingsHelper::getWeightWithUnit($item->weight_total, $unit);
            $item->weight_with_unit = SettingsHelper::getWeightWithUnit($item->weight, $unit);
            return $item;
        }, $products);

New code

return array_map(function ($item) {

            $item->weight = $item->weight ?? 0;
            $unit = $item->has_variants 
                ? (isset($item->variant_data->unit) ? $item->variant_data->unit : (isset($item->unit) ? $item->unit : null)) 
                : (isset($item->unit) ? $item->unit : null);
            $item->unit = $unit;

            $quantity = isset($item->cart_item) && isset($item->cart_item->quantity) ? (int) $item->cart_item->quantity : 0;

            $item->weight_total = bcmul($item->weight, $quantity, 2);
            $item->weight_total_with_unit = SettingsHelper::getWeightWithUnit($item->weight_total, $unit);
            $item->weight_with_unit = SettingsHelper::getWeightWithUnit($item->weight, $unit);

            return $item;
        }, $products);

Best regards,

Toufiqur Rahman (Team Lead, Support)

0
AF
Alexander Frenkel
Accepted Answer
5 months ago #192023

OK, thank you. It works now.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 5 months ago #192024

You are most welcome & Thanks

0