Stoned
I too had some fun with the checkout section. I saw no point in having a separate OPC component that relies totally on JS and lags behind VM releases.
Maybe I can add some additional ideas. I doubt they will make the VM code cut though (LOL)
I modified the section relating to bill to and ship to details so that the section determines if a billing address has been entered, before showing you the option of setting a shipping address.
It also adjusts the button text to show add or edit depending on whether the relevant address has been added.
You need to override the "default button text" to get rid of the add/edit as this is controlled by the status of the address.
I also override the language variable COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_EXPLAIN="<strong>Same as Billing Address<br/></strong>"
You can add the additional styling for the BT address button as the class is changed when the BT details have not been entered.
$q_step = "q_continue";
$q_step = "details";
Option below:-
<div class="width70 floatleft billto-shipto">
<div class="width60 floatleft">
<span><span class="vmicon vm2-billto-icon"></span>
<?php echo JText::_ ('COM_VIRTUEMART_USER_FORM_BILLTO_LBL'); ?></span>
<?php // Output Bill To Address ?>
<div class="output-billto">
<?php
// checks to see if BT has been added
if (empty($this->cart->BT)) {
echo "Please add your billing details";
// changes the css class of the button so I can highlight the action I want them to perform
$q_step = "q_continue";
// changes the button text of BT address does not exist
$q_button_text = "Add ";
} else {
$q_step = "details";
$q_button_text = "Edit ";
foreach ($this->cart->BTaddress['fields'] as $item) {
if (!empty($item['value'])) {
if ($item['name'] === 'agreed') {
// $item['value'] = ($item['value'] === 0) ? JText::_ ('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_NO') : JText::_ ('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_YES');
$item['value'] = "";
}
?>
<!--span class="titles"><?php echo $item['title'] ?></span-->
<span class="values vm2<?php echo '-' . $item['name'] ?>"><?php echo $this->escape ($item['value']) ?></span>
<?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'agreed') { ?>
<br class="clear"/>
<?php
}
}
}
} ?>
<br/>
<a class="<?php echo $q_step ?>" href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT', $this->useXHTML, $this->useSSL) ?>" rel="nofollow">
<?php echo $q_button_text . JText::_ ('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL'); ?>
</a>
<input type="hidden" name="billto" value="<?php echo $this->cart->lists['billTo']; ?>"/>
</div>
</div>
<div class="width40 floatleft">
<span><span class="vmicon vm2-shipto-icon"></span>
<?php echo JText::_ ('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL'); ?></span>
<div class="output-shipto">
<?php
if (empty($this->cart->BT)) {
echo "Please add your billing information first";
} else {
// Output Bill To Address ?>
<?php
if (empty($this->cart->STaddress['fields'])) {
echo JText::sprintf ('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_EXPLAIN', JText::_ ('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'));
} else {
if (!class_exists ('VmHtml')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php');
}
echo JText::_ ('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT');
echo VmHtml::checkbox ('STsameAsBTjs', $this->cart->STsameAsBT) . '<br />';
?>
<div id="output-shipto-display">
<?php
foreach ($this->cart->STaddress['fields'] as $item) {
if (!empty($item['value'])) {
?>
<!-- <span class="titles"><?php echo $item['title'] ?></span> -->
<?php
if ($item['name'] == 'first_name' || $item['name'] == 'middle_name' || $item['name'] == 'zip') {
?>
<span class="values<?php echo '-' . $item['name'] ?>"><?php echo $this->escape ($item['value']) ?></span>
<?php } else { ?>
<span class="values"><?php echo $this->escape ($item['value']) ?></span>
<br class="clear"/>
<?php
}
}
}
?>
</div>
<?php
}
?>
<?php if (!isset($this->cart->lists['current_id'])) {
$this->cart->lists['current_id'] = 0;
} ?>
<br/>
<a class="details" href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&virtuemart_user_id[]=' . $this->cart->lists['current_id'], $this->useXHTML, $this->useSSL) ?>" rel="nofollow">
<?php echo JText::_ ('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); ?>
</a>
<?php }
?>
</div>