Reputation: 3283
I have an array that has some data that looks like this
$valueOptions = array(
'order_shipping_data_firstname' => Mage::helper('orders2csv')->__('order shipping firstname'),
'order_shipping_data_lastname' => Mage::helper('orders2csv')->__('order shipping lastname'),
'order_shipping_data_region' => Mage::helper('orders2csv')->__('order shipping region'),
'order_shipping_data_street' => Mage::helper('orders2csv')->__('order shipping street'),
'order_shipping_data_city' => Mage::helper('orders2csv')->__('order shipping city')
);
I need to combine the firstname and last name fields but can't figure out a solution. This is the only file in the module that references anything lastname / first name / name so it's calling it externally from within the magento framework. Ideally they would be stored in variables and I could just combine them $fullname = $first . $last etc but this won't work in arrays.
I don't understand the usage of =>
too well but I know if I edit the right hand side and make this : => Mage::helper('orders2csv')->__('order shipping fullname')
the option will appear where I want (in a dropdown), so I guess I'm trying to combine 'order_shipping_data_firstname'&'order_shipping_data_lastname'
and put it before this, but within the array?
I've also tried starting another array in a variable and inserting the variable in the valueOptions array but this broke.
Upvotes: 5
Views: 223
Reputation: 11690
Try this:
$orders = Mage::helper('orders2csv');
$valueOptions = array(
'order_shipping_data_firstname' => $orders->__('order shipping firstname'),
'order_shipping_data_lastname' => $orders->__('order shipping lastname'),
'order_shipping_data_fullname' => $orders->__('order shipping firstname').' '.$orders->__('order shipping lastname'),
'order_shipping_data_region' => $orders->__('order shipping region'),
'order_shipping_data_street' => $orders->__('order shipping street'),
'order_shipping_data_city' => $orders->__('order shipping city')
);
Or this:
$orders = Mage::helper('orders2csv');
$valueOptions = array(
'order_shipping_data_firstname' => $orders->__('order shipping firstname'),
'order_shipping_data_lastname' => $orders->__('order shipping lastname'),
'order_shipping_data_fullname' => $orders->__('order shipping fullname'),
'order_shipping_data_region' => $orders->__('order shipping region'),
'order_shipping_data_street' => $orders->__('order shipping street'),
'order_shipping_data_city' => $orders->__('order shipping city')
);
Upvotes: 1
Reputation: 1027
$foo = array(
'bar' => array(
"hello",
"world"
),
);
var_dump($foo);
array nested in array
Upvotes: 3