From 5b013275bf304317327bad8589518e231b7b5710 Mon Sep 17 00:00:00 2001 From: iesus Date: Fri, 30 Nov 2018 07:40:14 +0100 Subject: [PATCH] When no firstName or lastName present, don't use first and last from full instead use first, and implode the rest so that we don't miss any names in the middle --- .../Svea/Checkout/Model/Payment/CreateOrder.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/community/Svea/Checkout/Model/Payment/CreateOrder.php b/app/code/community/Svea/Checkout/Model/Payment/CreateOrder.php index 83486f7..46fa50f 100755 --- a/app/code/community/Svea/Checkout/Model/Payment/CreateOrder.php +++ b/app/code/community/Svea/Checkout/Model/Payment/CreateOrder.php @@ -117,13 +117,14 @@ protected function _addAddressToQuote($quote, $data) $customer = new Varien_Object($data->getData('Customer')); $fakeFull = explode(' ', $billingAddress->getData('FullName')); - $fakeFirst = (end($fakeFull)) ? end($fakeFull) : $notNull; $fakeLast = (isset($fakeFull[0])) ? $fakeFull[0] : $notNull; + if (isset($fakeFull[0])) { unset($fakeFull[0]); } + $fakeFirst = (end($fakeFull)) ? implode(' ', $fakeFull) : $notNull; $fakeFullShipping = explode(' ', $shippingAddress->getData('FullName')); - $fakeFirstShipping = (end($fakeFull)) ? end($fakeFull) : $notNull; - $fakeLastShipping = (isset($fakeFull[0])) ? $fakeFull[0] : $notNull; - + $fakeLastShipping = (isset($fakeFullShipping[0])) ? $fakeFullShipping[0] : $notNull; + if (isset($fakeFullShipping[0])) { unset($fakeFullShipping[0]); } + $fakeFirstShipping = (end($fakeFullShipping)) ? implode(' ', $fakeFullShipping) : $notNull; $reference = ($data->getData('CustomerReference')) ? ($data->getData('CustomerReference'))