Here are some fields for modifying the cart page to make it more user friendly.
I use these fields to make my own "checkout steps"
<?php if (empty($this->cart->BT)){ ?> What you put here will be shown when NO billing address is completed<?php }?>
<?php if (!empty($this->cart->BT)){ ?> This shows AFTER the billing Address is completed <?php }?>
<?php if ($this->cart->cartData['paymentName'] == 'No payment selected') {?> This shows when the payment has NOT been selected<?php }?>
^^^ "No payment selected" is English, so change it to suit your language<?php if ($this->cart->cartData['paymentName'] != 'No payment selected') {?> AFTER Payment Has Been Selected<?php }?>
^^ Same language applies here. This code will change the text from "Add Your Billing" to Edit Your Billing, if the billing is already filled in. <?php if (empty($this->cart->BT)){ ?>
<a class="details bold font14 m4" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT',$this->useXHTML,$this->useSSL) ?>">
Add Your Billing Address
</a> <?php } ?>
<?php if (!empty($this->cart->BT)){ ?>
<a class="details bold font14 m4" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT',$this->useXHTML,$this->useSSL) ?>">
Edit Your Billing Address
</a> <?php } ?>
This Code will display "Shipping to a Different Address?" when the billing is filled in, but NOT the shipping. <?php if ((!empty($this->cart->BT)) && (empty($this->cart->ST))){ ?>
<a class="details bold font14 m4" 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) ?>">
Shipping to a different address? </a><?php } ?>
Displays "Edit Your Shipping Address" When its already filled in <?php if(!empty($this->cart->STaddress['fields'])){ ?>
<a class="details bold font14 m4" 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) ?>">
Edit Your Shipping Address
</a> <?php }?>
A couple ways of NOT displaying taxes & calculation rules when billing address is not filled in. BUT, the total will include the tax amount, but can also be wrapped.
<?php if (!empty($this->cart->BT)){ ?>
WRAP the calculation in this code
?>
OR: You can set the rule to 0 , if no billing address is filled in.<?php foreach($this->cart->cartData['taxRulesBill'] as $rule){ ?>
<?php if (empty($this->cart->BT)){ $rule=Null;}?>
<tr class="sectiontableentry<?php $i ?>">
<td colspan="4" align="right"><?php echo $rule['calc_name'] ?> </td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv($rule['virtuemart_calc_id'].'Diff','', $this->cart->pricesUnformatted[$rule['virtuemart_calc_id'].'Diff'],false); ?> </td>
<?php } ?>
<td align="right"><?php ?> </td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv($rule['virtuemart_calc_id'].'Diff','', $this->cart->pricesUnformatted[$rule['virtuemart_calc_id'].'Diff'],false); ?> </td>
</tr>
<?php
if($i) $i=1; else $i=0;
}
?>
This code <?php if (empty($this->cart->BT)){ $rule=Null;}?> sets the rule to Null if the billing is not filled in
If the billing address is not filled in, you can subtract the tax from the total. To show the total without tax.<?php if (empty($this->cart->BT)){$this->cart->pricesUnformatted['billTotal']=$this->cart->pricesUnformatted['billTotal']-$this->cart->pricesUnformatted['billTaxAmount'];}?> <?php echo $this->currencyDisplay->createPriceDiv('billTotal','', $this->cart->pricesUnformatted['billTotal'],false); ?>
THIS code will display the "Confirm order button" where you want it. ONLY when the billing & payment has been filled in<?php if ((!empty($this->cart->BT))&& ($this->cart->cartData['paymentName'] != 'No payment selected') ){
echo '<h1 class="bottom10 border" style="width:180px;">';
echo $this->checkout_link_html;
$text = JText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU');
echo '</h1>';
}?>
Same code as above, but checks if "terms of service are checked"<?php if (((!empty($this->cart->BT))&& ($this->cart->cartData['paymentName'] != 'No payment selected') )&& ($this->cart->tosAccepted)){
echo '<h1 class="bottom10 border" style="width:180px;">';
echo $this->checkout_link_html;
$text = JText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU');
echo '</h1>';
Choose Payment Page Auto select payment method.
http://forum.virtuemart.net/index.php?topic=108974UPDATED::: still working
Code below will be for improvements while using the native "1 page checkout" To hide the payment form when a payment has already been set. It will also display the "edit payment" linkcart/default_pricelist.php
change this
<?php if (!empty($this->layoutName) && $this->layoutName == 'default') {
if (VmConfig::get('oncheckout_opc', 0))) {
to this
<?php if (!empty($this->layoutName) && $this->layoutName == 'default') {
if ((VmConfig::get('oncheckout_opc', 0))&& ($this->cart->cartData['paymentName'] == 'No payment selected')) {
I was getting problems with checking for billing address when default country is set. So I wrote this function
<?php function valBT($items){
foreach($items['fields'] as $item){
if ($item['name']!='address_1') continue;
if ($item['name']=='address_1' && !empty($item['value']) ){return true;}
else return false;
}} ?>
Then you can check if the billing is empty like this
<?php if (!valBT($this->cart->BTaddress)){ ?>This is when it is empty<?php }?>
& when it is not empty
<?php if (valBT($this->cart->BTaddress)){ ?>This is when billing is filled in <?php }?>
You can also use this native function to test if all is filled in, billing, shipment method, and payment method<?php if ($this->cart->getDataValidated()){ ?> This is when its all selected <?php }?>
or
<?php if (!$this->cart->getDataValidated()){ ?> This is when it's missing something<?php }?>
Test if the billing & shipping address is the same<?php if ($this->cart->ST==$this->cart->BT) { ?> This is when they are the same <?php } ?>
or if different
<?php if ($this->cart->ST!=$this->cart->BT) { ?> This is when they are the same <?php } ?>