/** * get some method dependend form fields * * @param Mage_Sales_Model_Quote $order * @return array */ public function getMethodDependendFormFields($order, $requestParams = null) { $billingAddress = $order->getBillingAddress(); $shippingAddress = $order->getShippingAddress(); $street = str_replace("\n", ' ', $billingAddress->getStreet(-1)); $regexp = '/^([^0-9]*)([0-9].*)$/'; if (!preg_match($regexp, $street, $splittedStreet)) { $splittedStreet[1] = $street; $splittedStreet[2] = ''; } $formFields = parent::getMethodDependendFormFields($order, $requestParams); $gender = Mage::getSingleton('eav/config')->getAttribute('customer', 'gender')->getSource()->getOptionText($order->getCustomerGender()); $formFields['CIVILITY'] = $gender == 'Male' ? 'M' : 'V'; $formFields['OWNERADDRESS'] = trim($splittedStreet[1]); $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]); $formFields['OWNERZIP'] = $billingAddress->getPostcode(); $formFields['OWNERTOWN'] = $billingAddress->getCity(); $formFields['OWNERCTY'] = $billingAddress->getCountry(); $formFields['OWNERTELNO'] = $billingAddress->getTelephone(); $street = str_replace("\n", ' ', $shippingAddress->getStreet(-1)); if (!preg_match($regexp, $street, $splittedStreet)) { $splittedStreet[1] = $street; $splittedStreet[2] = ''; } $formFields['ECOM_SHIPTO_POSTAL_NAME_PREFIX'] = $shippingAddress->getPrefix(); $formFields['ECOM_SHIPTO_POSTAL_NAME_FIRST'] = $shippingAddress->getFirstname(); $formFields['ECOM_SHIPTO_POSTAL_NAME_LAST'] = $shippingAddress->getLastname(); $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = trim($splittedStreet[1]); $formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = trim($splittedStreet[2]); $formFields['ECOM_SHIPTO_POSTAL_POSTALCODE'] = $shippingAddress->getPostcode(); $formFields['ECOM_SHIPTO_POSTAL_CITY'] = $shippingAddress->getCity(); $formFields['ECOM_SHIPTO_POSTAL_COUNTRYCODE'] = $shippingAddress->getCountry(); // copy some already known values $formFields['ECOM_SHIPTO_ONLINE_EMAIL'] = $order->getCustomerEmail(); if (is_array($requestParams)) { if (array_key_exists('OWNERADDRESS', $requestParams)) { $formFields['OWNERADDRESS'] = $requestParams['OWNERADDRESS']; } if (array_key_exists('ECOM_BILLTO_POSTAL_STREET_NUMBER', $requestParams)) { $formFields['ECOM_BILLTO_POSTAL_STREET_NUMBER'] = $requestParams['ECOM_BILLTO_POSTAL_STREET_NUMBER']; } if (array_key_exists('ECOM_SHIPTO_POSTAL_STREET_LINE1', $requestParams)) { $formFields['ECOM_SHIPTO_POSTAL_STREET_LINE1'] = $requestParams['ECOM_SHIPTO_POSTAL_STREET_LINE1']; } if (array_key_exists('ECOM_SHIPTO_POSTAL_STREET_NUMBER', $requestParams)) { $formFields['ECOM_SHIPTO_POSTAL_STREET_NUMBER'] = $requestParams['ECOM_SHIPTO_POSTAL_STREET_NUMBER']; } } return $formFields; }
public function getMethodDependendFormFields($order, $requestParams = null) { $formFields = parent::getMethodDependendFormFields($order, $requestParams); $shippingAddress = $order->getShippingAddress(); $birthday = new DateTime($order->getCustomerDob()); $gender = Mage::getSingleton('eav/config')->getAttribute('customer', 'gender')->getSource()->getOptionText($order->getCustomerGender()); $formFields['CIVILITY'] = $gender == 'Male' ? 'Herr' : 'Frau'; $formFields['ORDERSHIPCOST'] = round(100 * $order->getBaseShippingInclTax()); if (!$this->getConfig()->canSubmitExtraParameter($order->getStoreId())) { // add the shipto parameters even if the submitOption is false, because they are required for OpenInvoice $shipToParams = $this->getRequestHelper()->extractShipToParameters($shippingAddress, $order); $formFields = array_merge($formFields, $shipToParams); } return $formFields; }