I'd like to add some data to a variable in a contributed module but I'm not sure how to do that with a custom module.
The Question:
The module I need to 'hack' is the Drupal Commerce PayPal WPP Module. I talked with PayPal and they said specifically I'd need to hack this file: 'commerce_paypal_wpp.module'. They said on line 365 if I added more data to the 'CUSTOM' variable (see below) it would pass that on to PayPal. Sweet! But how can I do that?
My Proposed Solution
I'm thinking I will create my variables to add to CUSTOM, like so (this is how I'd normally do it in PHP of course:
$fname = 'examplename';
$lname = 'examplelastname';
$arr = array($fname, $lname);
$allthedata = implode('+', $arr);
CUSTOM = $allthedata
It's that last line I don't know how to add properly! This, because 'CUSTOM' is already defined in the contributed module (see below).
The Function I Need to Edit:
The function in question in the contributed module is:
function commerce_paypal_wpp_submit_form_submit($payment_method,
$pane_form, $pane_values, $order, $charge) {
And the relevant code with 'CUSTOM' > the variable I want to change:
// Add additional transaction invormation to the request array.
$nvp += array(
// Order Information; we append the timestamp to the order number to
allow
// for multiple transactions against the same order.
'INVNUM' => substr($order->order_number, 0, 127) . '-' . REQUEST_TIME,
'CUSTOM' => substr(t('Order @number', array('@number' => $order-
>order_number)), 0, 256),
'DESC' => substr(implode(', ', $description), 0, 127),
// Customer Information
'EMAIL' => substr($order->mail, 0, 127),
'IPADDRESS' => substr($ip_address, 0, 15),
'FIRSTNAME' => substr($billing_address['first_name'], 0, 25),
'LASTNAME' => substr($billing_address['last_name'], 0, 25),
'STREET' => substr($billing_address['thoroughfare'], 0, 100),
'STREET2' => substr($billing_address['premise'], 0, 100),
'CITY' => substr($billing_address['locality'], 0, 40),
'STATE' => substr($billing_address['administrative_area'], 0, 40),
'COUNTRYCODE' => $billing_address['country'],
'ZIP' => substr($billing_address['postal_code'], 0, 20),
);
}