In Magento 1.9 PayPal is transferring a SHIPTONAME which is used for the shipping address. Instead of populating firstname and lastname with the correct variables, only firstname is populated with SHIPTONAME which includes both first- and lastname and the field for lastname remains empty. I need to change this so SHIPTONAME isn't being used and instead each field is populated with the correct variable.
This function
protected function _exportAddressses($data) { $address = new Varien_Object(); Varien_Object_Mapper::accumulateByMap($data, $address, $this->_billingAddressMap); $address->setExportedKeys(array_values($this->_billingAddressMap)); $this->_applyStreetAndRegionWorkarounds($address); $this->setExportedBillingAddress($address); // assume there is shipping address if there is at least one field specific to shipping if (isset($data['SHIPTONAME'])) { $shippingAddress = clone $address; Varien_Object_Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap); $this->_applyStreetAndRegionWorkarounds($shippingAddress); // PayPal doesn't provide detailed shipping name fields, so the name will be overwritten $shippingAddress->addData(array( 'firstname' => $data['SHIPTONAME'], )); $this->setExportedShippingAddress($shippingAddress); } }
protected function _exportAddressses($data) { $address = new Varien_Object(); Varien_Object_Mapper::accumulateByMap($data, $address, $this->_billingAddressMap); $address->setExportedKeys(array_values($this->_billingAddressMap)); $this->_applyStreetAndRegionWorkarounds($address); $this->setExportedBillingAddress($address); // assume there is shipping address if there is at least one field specific to shipping if (isset($data['SHIPTONAME'])) { $shippingAddress = clone $address; Varien_Object_Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap); $this->_applyStreetAndRegionWorkarounds($shippingAddress); // PayPal doesn't provide detailed shipping name fields, so the name will be overwritten $shippingAddress->addData(array( 'firstname' => $data['SHIPTONAME'], )); $this->setExportedShippingAddress($shippingAddress); } } assigns SHIPTONAME to the firstname field, but simply adding a second declaration like 'lastname' => $data['LASTNAME'], has no effect, as apparently only the firstname field is being used for the shipping address for PayPal Express orders.