VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: ejd on May 02, 2012, 11:10:31 AM

Title: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: ejd on May 02, 2012, 11:10:31 AM
J 2.5.4
VM 2.0.6

In the Order Confirmation Email that the shopper and Admin receive, the columns are not aligned at all.
(See attached screenshot)

Where did the very nice Email format go that was in VM 1.5?

Thanks.



[attachment cleanup by admin]
Title: Re: Order Confirmation Email: Columns Not Aligning
Post by: ejd on May 03, 2012, 10:07:54 AM
Well, I decided to hack this myself instead of wait for a fix.

So, if anybody wants it, this is a fix for invoice_items.php and makes all of the columns aligned correctly in the Confirmation Email.

This file is located at:  /components/com_virtuemart/views/invoice/tmpl/invoice_items.php

<?php
/**
*
* Order items view
*
* @package VirtueMart
* @subpackage Orders
* @author Max Milbers, Valerie Isaksen
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: details_items.php 5432 2012-02-14 02:20:35Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

 if ( 
VmConfig::get('show_tax')) {
    
$colspan=7;
 } else {
    
$colspan=8;
 }
?>

<table class="html-email" width="750px" cellspacing="0" cellpadding="0" border="0">
<tr align="left" class="sectiontableheader">
<td align="left" width="12%"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_SKU'?></strong></td>
<td align="left" colspan="2" ><strong><?php echo JText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE'?></strong></td>

<td align="right" width="19%" ><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE'?></strong></td>
<td align="right" width="7%"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_QTY'?></strong></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right" width="11%" ><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX'?></strong></td>
  <?php ?>
<td align="right" width="11%"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT'?></strong></td>
<td align="right" width="13%"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL'?></strong></td>
</tr>
</table>
<table class="html-email" width="750px" cellspacing="0" cellpadding="0" border="0">
<?php
foreach(
$this->orderDetails['items'] as $item) {
$qtt $item->product_quantity ;
// $_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $item->virtuemart_category_id . '&virtuemart_product_id=' . $item->virtuemart_product_id,true);
$_link =JURI::root().'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' $item->virtuemart_category_id '&virtuemart_product_id=' $item->virtuemart_product_id;


?>

<tr valign="top">
<td width="12%" align="left">
<?php echo $item->order_item_sku?>
</td>
<td align="left" colspan="2" >
<a href="<?php echo $_link?>"><?php echo $item->order_item_name?></a>
<?php
//  vmdebug('$item',$item);
if (!empty($item->product_attribute)) {
if(!class_exists('VirtueMartModelCustomfields'))require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'customfields.php');
$product_attribute VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
}
?>

</td>

<td width="12%" align="right"   class="priceCol" >
    <?php echo '<span >'.$this->currency->priceDisplay($item->product_item_price) .'</span><br />'?>
</td>
<td width="7%" align="right" >
<?php echo $qtt?>
</td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td width="11%" align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($item->product_tax ,0$qtt)."</span>" ?></td>
                                <?php ?>
<td width="11%" align="right" class="priceCol" >
<?php echo  $this->currency->priceDisplay$item->product_subtotal_discount );  //No quantity is already stored with it ?>
</td>
<td width="13%" align="right"  class="priceCol">
<?php
$item->product_basePriceWithTax = (float) $item->product_basePriceWithTax;
$class '';
if(!empty($item->product_basePriceWithTax) && $item->product_basePriceWithTax != $item->product_final_price ) {
echo '<span class="line-through" >'.$this->currency->priceDisplay($item->product_basePriceWithTax,0,$qtt) .'</span><br />' ;
}

echo $this->currency->priceDisplay(  $item->product_subtotal_with_tax ,0); //No quantity or you must use product_final_price ?>

</td>
</tr>
</table>
<table class="html-email" width="750px" cellspacing="0" cellpadding="0" border="0">
<?php
}
?>


<tr class="sectiontableentry1">
<td colspan="6" align="right"><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_PRICES_TOTAL'); ?></td>

                        <?php if ( VmConfig::get('show_tax')) { ?>
<td width="18%" align="right"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_tax)."</span>" ?></td>
                        <?php ?>
<td width="11%" align="right"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_discountAmount)."</span>" ?></td>
<td width="13%" align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_salesPrice?></td>
  </tr>
<?php
if ($this->orderDetails['details']['BT']->coupon_discount <> 0.00) {
    
$coupon_code=$this->orderDetails['details']['BT']->coupon_code?' ('.$this->orderDetails['details']['BT']->coupon_code.')':'';
?>

<tr>
<td align="right" class="pricePad" colspan="5"><?php echo JText::_('COM_VIRTUEMART_COUPON_DISCOUNT').$coupon_code ?></td>
<td width="8%" align="right"></td>

<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"> </td>
                                <?php ?>
<td align="right"><?php echo '- '.$this->currency->priceDisplay($this->orderDetails['details']['BT']->coupon_discount); ?></td>
<td align="right"></td>
</tr>
<?php  ?>


<?php
foreach($this->orderDetails['calc_rules'] as $rule){
if ($rule->calc_kind== 'DBTaxRulesBill') { ?>

<tr >
<td colspan="6"  align="right" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>

                                   <?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"> </td>
                                <?php ?>
<td align="right"> <?php echo  $this->currency->priceDisplay($rule->calc_amount);  ?></td>
<td align="right"><?php echo  $this->currency->priceDisplay($rule->calc_amount);  ?> </td>
</tr>
<?php
} elseif ($rule->calc_kind == 'taxRulesBill') { ?>

<tr >
<td colspan="6"  align="right" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><?php echo $this->currency->priceDisplay($rule->calc_amount); ?> </td>
<?php ?>
<td align="right"><?php    ?> </td>
<td align="right"><?php echo $this->currency->priceDisplay($rule->calc_amount);   ?> </td>
</tr>
<?php
 } elseif ($rule->calc_kind == 'DATaxRulesBill') { ?>

<tr >
<td colspan="6"   align="right" class="pricePad"><?php echo $rule->calc_rule_name ?> </td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"> </td>
<?php ?>
<td align="right"><?php  echo   $this->currency->priceDisplay($rule->calc_amount);  ?> </td>
<td align="right"><?php echo $this->currency->priceDisplay($rule->calc_amount);  ?> </td>
</tr>

<?php
 }

}
?>



<tr>
<td align="right" class="pricePad" colspan="6"><?php echo $this->orderDetails['shipmentName'?></td>


<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_shipment_tax)."</span>" ?></td>
                                <?php ?>
<td align="right"></td>
<td align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_shipment$this->orderDetails['details']['BT']->order_shipment_tax); ?></td>

</tr>
</table>
<table class="html-email" width="750px" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="right" class="pricePad" colspan="6"><?php echo $this->orderDetails['paymentName']  ?><td width="28%">

<?php if ( VmConfig::get('show_tax')) { ?>
<td width="18%" align="right"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_payment_tax)."</span>" ?></td>
                                <?php ?>
<td width="11%" align="right"></td>
<td width="13%"  align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_payment$this->orderDetails['details']['BT']->order_payment_tax); ?></td>


</tr>
    </table>
<table class="html-email" width="750px" cellspacing="0" cellpadding="0" border="0">

<tr>
<td align="right" class="pricePad" colspan="6"><strong><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL'?></strong></td>

<?php if ( VmConfig::get('show_tax')) {  ?>
<td width="40%" align="right"><span  class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_billTaxAmount); ?></span></td>
<?php ?>
<td width="11%" align="right"><span  class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_billDiscountAmount); ?></span></td>
<td width="13%" align="right"><strong><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_total); ?></strong></td>
</tr>

</table>
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: valdez79 on May 04, 2012, 18:24:33 PM
Thank you.
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: chaldama on May 14, 2012, 12:09:19 PM
Thank you for this hack, it would be great to see this incorporated in the next update of VM 2.0.
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: jelly on May 21, 2012, 17:24:40 PM
Thanks EJD, I will try this too.

Just like you, I also very much wonder: "Where did the very nice Email format go that was in VM 1.5?"

I don't really dare to use the default format at the moment, it looks so messy & cluttered which I think will give a bad impression of the shop to the customer...

It also does not really promote using the new VM2...
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: gxHL on May 25, 2012, 15:59:05 PM
Hi thank you for the fix it worked great.
But I'm having the same alignment problem at my checkout page take a look...

How can this be fixed?

[attachment cleanup by admin]
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: ejd on May 26, 2012, 00:06:10 AM
The code for the Checkout page is different than the Confirmation email.

A lot of the size and alignment is from your main Joomla template.

Use a program like Firebug or Web Developer toolbar in Firefox to see which CSS is affecting that page.
The template we were using was easy to fix the CSS.

But unfortunately we are no longer using VM2 as there are still too many little issues that our clients found unacceptable.
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: gxHL on May 26, 2012, 00:09:09 AM
Thank you for the reply.
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: danielbrouwer4 on October 10, 2012, 10:27:25 AM
Hi Guys,

Question, downloading the invoice_items was easy but replacing the document again in the folder I get permission denied? how to solve that?
Title: Re: [SOLVED] Order Confirmation Email: Columns Not Aligning
Post by: gxHL on October 10, 2012, 10:48:16 AM
localhost or online? if its on localhost its probably windows restrictions if its on ftp try changing permissions and then contacting your server administrator.