Hello,
I'd like to edit a little bit the information that is displayed in the order mail under "Bill To" address. I'd like to remove the shopper group which is shown there, as well as some other small customizations. The code that displays this information in the file mail_html_shopperaddresses.php is:
<?php
foreach ($this->userfields['fields'] as $field) {
if (!empty($field['value'])) {
?><!-- span class="titles"><?php echo $field['title'] ?></span -->
<span class="values vm2<?php echo '-' . $field['name'] ?>" ><?php echo $field['value'] ?></span>
<?php if ($field['name'] != 'title' and $field['name'] != 'first_name' and $field['name'] != 'middle_name' and $field['name'] != 'zip') { ?>
<br class="clear" />
<?php
}
}
}
?>
I can't find where this information is extracted from. But anyway, I think that if the correct file is edited, this might result in incorrectly displayed information in other places in the site. So, I'd prefer to insert the information from each field separatelly in the mail - First name, Last name, Address, etc. How can I do it, what is the correct way?
Any help? I've tried with this:
<?php echo $this->userfields->first_name; ?>
for first name, etc. but unfortunatelly without any result... How can I get the information from each field separately and add it into the mail?
This is mine.
If you notice the line
if ($field['name']=='virtuemart_country_id') continue;
SKIPS the country name.
THEN THIS LINE:
if ($field['name']=='phone_1') {$field['value'] = ltrim($field['value'], '1');
$field['value'] = str_replace( '-', '.', $field['value'] );}
Removes the 1 from the first digit in the phone number.
THEN: changes the format from
813-666-6666
to 813.666.6666
<?php
foreach ($this->userfields['fields'] as $field) {
if (!empty($field['value'])) {
if ($field['name']=='virtuemart_country_id') continue;
if ($field['name']=='phone_1') {$field['value'] = ltrim($field['value'], '1');
$field['value'] = str_replace( '-', '.', $field['value'] );}
if ($field['name']=='virtuemart_state_id'){$stateId= shopfunctions::getStateIDByName ($field['value']);
$field['value'] =shopfunctions::getStateByID ($stateId, 'state_2_code');}
?>
<span class="values vm2<?php echo '-' . $field['name'] ?>" ><?php echo $this->escape($field['value']) ?></span>
<?php if (($field['name'] == 'first_name') OR ($field['name'] =='zip') OR ($field['name'] =='company') OR ($field['name']=='phone_1') OR ($field['name']=='email') OR ($field['name']=='address_1') OR ($field['name']=='address_2') ) { ?>
<br class="clear" />
<?php
}
if ($field['name']=='city'){echo ' ,';}
}
}
?>
Hi,
And thanks for sharing this. To be honest, I don't understand how to extract each field value that I want from the code you've posted. But as you say:
Quote from: PRO on February 11, 2016, 22:10:24 PM
If you notice the line
if ($field['name']=='virtuemart_country_id') continue;
SKIPS the country name.
that gave me another idea - I've listed all the fields I want to be skipped by using this line and altering "virtuemart_country_id" with the desired field name. And it looks it is working for now... I need some more testing of it, but seems it is OK.
Thanks!