once you enable the feature in OPC and set a few user fields to be shown in the third address you may need to adjust a few of your Virtuemart and OPC theme files:
1. to display the address in OPC templates, you can use this code (if you opc theme does not display the 3rd address automatically):
three_column themes:
- Code: Select all
<?php if (!empty($third_address)) { ?>
<h4><?php $iter++; echo $iter.'. ';?><?php echo OPCLang::_('COM_ONEPAGE_THIRD_ADDRESS') ?> </h4>
<?php
echo $third_address;
?>
<?php } ?>
clean_simple themes:
- Code: Select all
<?php if ($third_address != '1') { ?>
<h3 class="shipping_h3"><?php echo OPCLang::_('COM_ONEPAGE_THIRD_ADDRESS'); ?></h3>
<fieldset class="other_address">
<?php echo $third_address; ?>
</fieldset>
<?php } ?>
insert the above code into your onepage.unlogged.tpl.php and onepage.logged.tpl.php above this line:
- Code: Select all
<!-- end shipping address info -->
2. to display the 3rd address in your backend, you may want to adjust your order backend VM theme:
\public_html\administrator\components\com_virtuemart\views\orders\tmpl\order.php (you can also use Joomla template overrides)
- Code: Select all
<?php
if (file_exists(JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_onepage'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'third_address.php')) {
require_once(JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_onepage'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'third_address.php');
$this->thirdaddress = OPCthirdAddress::populateAddressFields($this->orderdetails['details']['BT']->virtuemart_order_id);
if (!empty($this->thirdaddress)) { ?>
<table class="adminlist" width="100%">
<thead>
<tr>
<th style="text-align: center;" colspan="2"><?php echo JText::_('COM_ONEPAGE_THIRD_ADDRESS') ?></th>
</tr>
</thead>
<?php
foreach ($this->thirdaddress['fields'] as $field) {
if (!empty($field['value'])) {
echo '<tr><td class="key">' . $field['title'] . '</td>'
. '<td>' . $field['value'] . '</td></tr>';
}
}
?></table>
<?php }
}
?>
In VM3 if you'd like to display the 3rd address for the order details of the customer, you may want to adjust this VM template:
\components\com_virtuemart\views\orders\tmpl\details_order.php (you can also copy or edit your joomla template overrides)
- Code: Select all
<?php
if (file_exists(JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_onepage'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'third_address.php')) {
require_once(JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_onepage'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'third_address.php');
$this->thirdaddress = OPCthirdAddress::populateAddressFields($this->orderdetails['details']['BT']->virtuemart_order_id);
if (!empty($this->thirdaddress)) { ?>
<strong>
<?php echo JText::_('COM_ONEPAGE_THIRD_ADDRESS') ?></strong><br/>
<table border="0"><?php
foreach ($this->thirdaddress['fields'] as $field) {
if (!empty($field['value'])) {
echo '<tr><td class="key">' . $field['title'] . '</td>'
. '<td>' . $field['value'] . '</td></tr>';
}
}
?></table>
<?php }
}
This feature was tested on VM3 latest and also VM2.0.14
Best regards, Stan