@@ -185,9 +185,9 @@ public function parseAddress(Address $shippingAddress)
185
185
$ street = $ shippingAddress ->getStreet ();
186
186
if ($ this ->config ->housenumberExtensionOnThirdStreet ()) {
187
187
return [
188
- 'street ' => trim ($ street [0 ] ?? null ),
189
- 'houseNumber ' => trim (isset ( $ street [1 ]) ? $ street [ 1 ] : null ),
190
- 'houseNumberExtension ' => trim (isset ( $ street [2 ]) ? $ street [ 2 ] : null ),
188
+ 'street ' => trim ($ street [0 ] ?? '' ),
189
+ 'houseNumber ' => trim ($ street [1 ] ?? '' ),
190
+ 'houseNumberExtension ' => trim ($ street [2 ] ?? '' ),
191
191
];
192
192
}
193
193
$ street = implode (' ' , $ street );
@@ -403,26 +403,39 @@ private function getProductDimemension(Item $item)
403
403
}
404
404
405
405
if ($ widthAttribute = $ this ->config ->getProductAttributeWidth ()) {
406
- if ($ width = $ product ->getData ($ widthAttribute ) * $ k ) {
406
+ if ($ width = $ this -> reformatVolumeData ( $ product ->getData ($ widthAttribute) ) * $ k ) {
407
407
$ dimensionArray ['width ' ] = (int )$ width ;
408
408
}
409
409
}
410
410
411
411
if ($ heightAttribute = $ this ->config ->getProductAttributeHeight ()) {
412
- if ($ height = $ product ->getData ($ heightAttribute ) * $ k ) {
412
+ if ($ height = $ this -> reformatVolumeData ( $ product ->getData ($ heightAttribute) ) * $ k ) {
413
413
$ dimensionArray ['height ' ] = (int )$ height ;
414
414
}
415
415
}
416
416
417
- if ($ lengthAttribute = $ this ->config ->getProductAttributeLength () * $ k ) {
418
- if ($ length = $ product ->getData ($ lengthAttribute )) {
417
+ if ($ lengthAttribute = $ this ->config ->getProductAttributeLength ()) {
418
+ if ($ length = $ this -> reformatVolumeData ( $ product ->getData ($ lengthAttribute )) * $ k ) {
419
419
$ dimensionArray ['length ' ] = (int )$ length ;
420
420
}
421
421
}
422
422
423
423
return $ dimensionArray ;
424
424
}
425
425
426
+ /**
427
+ * @param $value
428
+ * @return float
429
+ */
430
+ private function reformatVolumeData ($ value ): float
431
+ {
432
+ if ($ value == null ) {
433
+ return 0.00 ;
434
+ }
435
+
436
+ return (float )str_replace (', ' , '. ' , $ value );
437
+ }
438
+
426
439
/**
427
440
* Check if parent item is bundle
428
441
*
0 commit comments