Hello Everyone,
I would like to do a little customisation of the email sent to my customers. Something simple like cutting a column in the table of the products purchased. I guess I should modify some file in
/public_html/components/com_virtuemart/views/invoice/tmpl
but have no idea which one.
Anyone can help me?
Thanks
All files in components/com_virtuemart/views/invoice/tmpl
begining with email are used to render the mail.
mail_html.php is the main file for HTML render
inside you have sublayouts and are loaded with
echo $this->loadTemplate('header');
is the code loading : mail_html_header.php
when you call it in mail_html
this file are loaded for all
mail_html_footer.php
mail_html_header.php
mail_html_pricelist.php
mail_html_shopperaddresses.php
this file are loaded for shopper
mail_html_shopper.php
mail_html_shopper_more.php
this file are loaded for shopper
mail_html_vendor.php
mail_html_vendor_more.php
most of this file name are self explaining
Is there someone who knows how you can add the product image thumbnail in this email? I tried some (old) code, found on this forum, but that's work in the current/latest virtuemart version.
Quote from: EIF on February 27, 2017, 10:01:13 AM
Is there someone who knows how you can add the product image thumbnail in this email? I tried some (old) code, found on this forum, but that's work in the current/latest virtuemart version.
Check the Cart folder components/com_virtuemart/views/invoice/ you should have the right code.
if (!empty($prow->images[0])) {
echo $prow->images[0]->displayMediaThumb ('', FALSE);
}
But you need to change a little the code to get full Url
if (!empty($prow->images[0])) {
$prow->images[0]->displayMediaThumb ('',FALSE,"", true, false, true); }
And of course you need to add the table column
If image is missing then you need this code line before:
$productModel->addImages($prow, 1 );
And before the main product loop $productModel = VmModel::getModel('product');
In components\com_virtuemart\views\invoice\tmpl\invoice_items.php I added the code below, in a table column.
<td align="left">
<?php if (!empty($prow->images[0])) { $prow->images[0]->displayMediaThumb ('',FALSE,"", true, false, true); } ?>
</td>
But no image is showing. There is a product image available. What do I do wrong?
Edit: I also added the code you said, but still no image.
Hello and thanks for your reply,
regarding it, I've seen the php files you're suggesting, but of course they take the columns of the table from somewhere else. My question is this: where is decided which are the shown columns in the confirmation order emails? Can I somehow change them?
@mausci1969
mail_html_pricelist.php render the products in the order email
@EIF
add on begin of file
$productModel = VmModel::getModel('product');
in the loop add
$productModel->addImages($prow, 1 );
before the new code
if (!empty($prow->images[0])) {
$prow->images[0]->displayMediaThumb ('',FALSE,"", true, false, true);
}
NOTE: in LAST VM the file is now : invoice_items.php and is used for mail+ standard invoice render and $prow is now $item
Where does the loop code starts?
I have the following changed code now:
<?php
$productModel->addImages($item, 1 );
$menuItemID = shopFunctionsF::getMenuItemId($this->orderDetails['details']['BT']->order_language);
if(!class_exists('VirtueMartModelCustomfields'))require(VMPATH_ADMIN.DS.'models'.DS.'customfields.php');
VirtueMartModelCustomfields::$useAbsUrls = ($this->isMail or $this->isPdf);
foreach($this->orderDetails['items'] as $item) {
$qtt = $item->product_quantity ;
$product_link = JURI::root().'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $item->virtuemart_category_id .
'&virtuemart_product_id=' . $item->virtuemart_product_id . '&Itemid=' . $menuItemID;
?>
<tr valign="top">
<td align="left">
<?php if (!empty($item->images[0])) { $item->images[0]->displayMediaThumb ('',FALSE,"", true, false, true); } ?>
</td>
<td align="left">
<?php echo $item->order_item_sku; ?>
</td>
<td align="" >
<?php echo $qtt; ?>
I guess $productModel->addImages($item, 1 ); is not to be meant at that line,
If you want add image for all product outside and before loop then
$productModel->addImages($item, 1 );
is
$productModel->addImages($this->orderDetails['items'], 1 );
I still can't get this working. No images or showing. Just a blank space...
Do I need to change other files than invoice_items.php to get images? (using virtuemart 3.0.18)
Can you please examine the full code of this file below?
<?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');
$productModel = VmModel::getModel('product');
$colspan=8;
if ($this->doctype != 'invoice') {
$colspan -= 4;
} elseif ( ! VmConfig::get('show_tax')) {
$colspan -= 1;
}
$handled = array();
$discountsBill = false;
$taxBill = false;
$vats = 0;
foreach($this->orderDetails['calc_rules'] as $rule){
if(isset($sumRules[$rule->virtuemart_calc_id])){ // or $rule->calc_kind=='payment' or $rule->calc_kind=='shipment'){
continue;
}
$handled[$rule->virtuemart_calc_id] = true;
$r = new stdClass();
$r->calc_result = $rule->calc_result;
$r->calc_amount = $rule->calc_amount;
$r->calc_rule_name = $rule->calc_rule_name;
$r->calc_kind = $rule->calc_kind;
$r->calc_value = $rule->calc_value;
if($rule->calc_kind == 'DBTaxRulesBill' or $rule->calc_kind == 'DATaxRulesBill'){
$discountsBill[$rule->virtuemart_calc_id] = $r;
}
if($rule->calc_kind == 'taxRulesBill' or $rule->calc_kind == 'VatTax' or $rule->calc_kind=='payment' or $rule->calc_kind=='shipment'){
//vmdebug('method rule',$rule);
$r->label = shopFunctionsF::getTaxNameWithValue($rule->calc_rule_name,$rule->calc_value);
if(isset($taxBill[$rule->virtuemart_calc_id])){
$taxBill[$rule->virtuemart_calc_id]->calc_amount += $r->calc_amount;
} else {
$taxBill[$rule->virtuemart_calc_id] = $r;
}
}
}
?>
<br><br>
<table width="100%">
<tr style='background:#CCCCCC;padding:5'>
<strong>Factuur- & afleveradres</strong>
</tr>
</table>
<table class="html-email" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr align="left" class="sectiontableheader">
<td align="left" width="15%"></td>
<td align="left" width="5%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU') ?></strong></td>
<td align="right" width="6%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></strong></td>
<td align="left" colspan="2" width="38%" ><strong><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE') ?></strong></td>
<?php if ($this->doctype == 'invoice') { ?>
<td align="right" width="10%" ><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE') ?></strong></td>
<?php } ?>
<?php if ($this->doctype == 'invoice') { ?>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right" width="10%" ><strong><?php
if(is_array($taxBill) and count($taxBill)==1){
reset($taxBill);
$t = current($taxBill);
echo shopFunctionsF::getTaxNameWithValue($t->calc_rule_name,$t->calc_value);
} else {
echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX');
}
?></strong></td>
<?php } ?>
<td align="right" width="11%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT') ?></strong></td>
<td align="right" width="11%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td>
<?php } ?>
</tr>
<?php
$productModel->addImages($this->orderDetails['items'], 1 );
$menuItemID = shopFunctionsF::getMenuItemId($this->orderDetails['details']['BT']->order_language);
if(!class_exists('VirtueMartModelCustomfields'))require(VMPATH_ADMIN.DS.'models'.DS.'customfields.php');
VirtueMartModelCustomfields::$useAbsUrls = ($this->isMail or $this->isPdf);
foreach($this->orderDetails['items'] as $item) {
$qtt = $item->product_quantity ;
$product_link = JURI::root().'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $item->virtuemart_category_id .
'&virtuemart_product_id=' . $item->virtuemart_product_id . '&Itemid=' . $menuItemID;
?>
<tr valign="top">
<td align="left">
<?php if (!empty($item->images[0])) { $item->images[0]->displayMediaThumb ('',FALSE,"", true, false, true); } ?>
</td>
<td align="left">
<?php echo $item->order_item_sku; ?>
</td>
<td align="" >
<?php echo $qtt; ?>
</td>
<td align="left" colspan="2" >
<div float="right" ><a href="<?php echo $product_link; ?>"><?php echo $item->order_item_name; ?></a></div>
<?php
$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
?>
</td>
<?php if ($this->doctype == 'invoice') { ?>
<td align="right" class="priceCol" >
<?php
$item->product_discountedPriceWithoutTax = (float) $item->product_discountedPriceWithoutTax;
if (!empty($item->product_priceWithoutTax) && $item->product_discountedPriceWithoutTax != $item->product_priceWithoutTax) {
echo '<span class="line-through">'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
echo '<span >'.$this->currency->priceDisplay($item->product_discountedPriceWithoutTax, $this->user_currency_id) .'</span><br />';
} else {
echo '<span >'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
}
?>
</td>
<?php } ?>
<?php if ($this->doctype == 'invoice') { ?>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right" class="priceCol"><?php echo "<span class='priceColor2'>".$this->currency->priceDisplay($item->product_tax ,$this->user_currency_id, $qtt)."</span>" ?></td>
<?php } ?>
<td align="right" class="priceCol" >
<?php echo $this->currency->priceDisplay( $item->product_subtotal_discount, $this->user_currency_id ); //No quantity is already stored with it ?>
</td>
<td 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,$this->user_currency_id,$qtt) .'</span><br />' ;
}
elseif (empty($item->product_basePriceWithTax) && $item->product_item_price != $item->product_final_price) {
echo '<span class="line-through">' . $this->currency->priceDisplay($item->product_item_price,$this->user_currency_id,$qtt) . '</span><br />';
}
echo $this->currency->priceDisplay( $item->product_subtotal_with_tax ,$this->user_currency_id); //No quantity or you must use product_final_price ?>
</td>
<?php } ?>
</tr>
<?php
}
?>
<?php if ($this->doctype == 'invoice') { ?>
<tr><td colspan="<?php echo $colspan ?>"></td></tr>
<tr class="sectiontableentry1">
<td colspan="6" align="right"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_PRICES_TOTAL'); ?></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><?php echo "<span class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_tax, $this->user_currency_id)."</span>" ?></td>
<?php } ?>
<td align="right"><?php echo "<span class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_discountAmount, $this->user_currency_id)."</span>" ?></td>
<td align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_salesPrice, $this->user_currency_id) ?></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="6"><?php echo vmText::_('COM_VIRTUEMART_COUPON_DISCOUNT').$coupon_code ?></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"> </td>
<?php } ?>
<td align="right"></td>
<td align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->coupon_discount, $this->user_currency_id); ?></td>
</tr>
<?php } ?>
<?php
if($discountsBill){
foreach($discountsBill as $rule){ ?>
<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, $this->user_currency_id); ?></td>
<td align="right"><?php echo $this->currency->priceDisplay($rule->calc_amount, $this->user_currency_id); ?></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"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_shipment_tax, $this->user_currency_id) ?></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, $this->user_currency_id); ?></td>
</tr>
<tr>
<td align="right" class="pricePad" colspan="6"><?php echo $this->orderDetails['paymentName'] ?></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_payment_tax, $this->user_currency_id) ?></span> </td>
<?php } ?>
<td align="right"></td>
<td align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_payment + $this->orderDetails['details']['BT']->order_payment_tax, $this->user_currency_id); ?></td>
</tr>
<tr>
<td align="right" class="pricePad" colspan="6"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_billTaxAmount, $this->user_currency_id); ?></span></td>
<?php } ?>
<td align="right"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_billDiscountAmount, $this->user_currency_id); ?></span></td>
<td align="right"><strong><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_total, $this->user_currency_id); ?></strong></td>
</tr>
<?php
if($this->doVendor){
$comp = $this->orderDetails['details']['BT']->order_currency;
} else {
$comp = $this->user_currency_id;
}
if(!empty($this->orderDetails['details']['BT']->payment_currency_rate)
and $this->orderDetails['details']['BT']->payment_currency_id!=$comp and $this->orderDetails['details']['BT']->payment_currency_rate!=1.0){
?><tr>
<td align="right" class="pricePad" colspan="7"><strong><?php echo vmText::_('COM_VM_TOTAL_IN_PAYMENT_CURRENCY') ?></strong></td>
<td align="right" class="pricePad" colspan="2"><?php
if($this->orderDetails['details']['BT']->order_currency==$this->orderDetails['details']['BT']->user_currency_id and $this->orderDetails['details']['BT']->user_currency_id!=$this->orderDetails['details']['BT']->payment_currency_id){
echo $this->orderDetails['details']['BT']->payment_currency_rate;
} else if ($this->orderDetails['details']['BT']->order_currency==$this->orderDetails['details']['BT']->payment_currency_id and $this->orderDetails['details']['BT']->payment_currency_id!=$this->orderDetails['details']['BT']->user_currency_id){
echo $this->orderDetails['details']['BT']->user_currency_rate;
}
echo ' <strong>';
echo $this->currencyP->priceDisplay($this->orderDetails['details']['BT']->order_total, $this->orderDetails['details']['BT']->payment_currency_id); ?>
</strong></td>
</tr>
<?php
}
if($taxBill){
?><tr >
<td colspan="7" align="right" class="pricePad"><?php echo vmText::_('COM_VIRTUEMART_TOTAL_INCL_TAX') ?> </td>
<td></td>
<td></td>
</tr><?php
foreach($taxBill as $rule){
if ($rule->calc_kind == 'taxRulesBill' or $rule->calc_kind == 'VatTax' ) { ?>
<tr >
<td colspan="6" align="right" class="pricePad"><?php echo $rule->label ?> </td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><?php echo $this->currency->priceDisplay($rule->calc_result, $this->user_currency_id); ?></td>
<?php } ?>
<td align="right"></td>
<td align="right"></td>
</tr>
<?php
}
}
}
?>
<?php } ?>
</table>
This should be OK.
<?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');
$productModel = VmModel::getModel('product');
$productModel->addImages($this->orderDetails['items'], 1 );
$colspan=8;
if ($this->doctype != 'invoice') {
$colspan -= 4;
} elseif ( ! VmConfig::get('show_tax')) {
$colspan -= 1;
}
$handled = array();
$discountsBill = false;
$taxBill = false;
$vats = 0;
foreach($this->orderDetails['calc_rules'] as $rule){
if(isset($sumRules[$rule->virtuemart_calc_id])){ // or $rule->calc_kind=='payment' or $rule->calc_kind=='shipment'){
continue;
}
$handled[$rule->virtuemart_calc_id] = true;
$r = new stdClass();
$r->calc_result = $rule->calc_result;
$r->calc_amount = $rule->calc_amount;
$r->calc_rule_name = $rule->calc_rule_name;
$r->calc_kind = $rule->calc_kind;
$r->calc_value = $rule->calc_value;
if($rule->calc_kind == 'DBTaxRulesBill' or $rule->calc_kind == 'DATaxRulesBill'){
$discountsBill[$rule->virtuemart_calc_id] = $r;
}
if($rule->calc_kind == 'taxRulesBill' or $rule->calc_kind == 'VatTax' or $rule->calc_kind=='payment' or $rule->calc_kind=='shipment'){
//vmdebug('method rule',$rule);
$r->label = shopFunctionsF::getTaxNameWithValue($rule->calc_rule_name,$rule->calc_value);
if(isset($taxBill[$rule->virtuemart_calc_id])){
$taxBill[$rule->virtuemart_calc_id]->calc_amount += $r->calc_amount;
} else {
$taxBill[$rule->virtuemart_calc_id] = $r;
}
}
}
?>
<br><br>
<table width="100%">
<tr style='background:#CCCCCC;padding:5'>
<strong>Factuur- & afleveradres</strong>
</tr>
</table>
<table class="html-email" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr align="left" class="sectiontableheader">
<td align="left" width="15%"></td>
<td align="left" width="5%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU') ?></strong></td>
<td align="right" width="6%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></strong></td>
<td align="left" colspan="2" width="38%" ><strong><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE') ?></strong></td>
<?php if ($this->doctype == 'invoice') { ?>
<td align="right" width="10%" ><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE') ?></strong></td>
<?php } ?>
<?php if ($this->doctype == 'invoice') { ?>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right" width="10%" ><strong><?php
if(is_array($taxBill) and count($taxBill)==1){
reset($taxBill);
$t = current($taxBill);
echo shopFunctionsF::getTaxNameWithValue($t->calc_rule_name,$t->calc_value);
} else {
echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX');
}
?></strong></td>
<?php } ?>
<td align="right" width="11%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT') ?></strong></td>
<td align="right" width="11%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td>
<?php } ?>
</tr>
<?php
$menuItemID = shopFunctionsF::getMenuItemId($this->orderDetails['details']['BT']->order_language);
if(!class_exists('VirtueMartModelCustomfields'))require(VMPATH_ADMIN.DS.'models'.DS.'customfields.php');
VirtueMartModelCustomfields::$useAbsUrls = ($this->isMail or $this->isPdf);
foreach($this->orderDetails['items'] as $item) {
$qtt = $item->product_quantity ;
$product_link = JURI::root().'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $item->virtuemart_category_id .
'&virtuemart_product_id=' . $item->virtuemart_product_id . '&Itemid=' . $menuItemID;
?>
<tr valign="top">
<td align="left">
<?php if (!empty($item->images[0])) { echo $item->images[0]->displayMediaThumb ('',FALSE,"", true, false, true); } ?>
</td>
<td align="left">
<?php echo $item->order_item_sku; ?>
</td>
<td align="" >
<?php echo $qtt; ?>
</td>
<td align="left" colspan="2" >
<div float="right" ><a href="<?php echo $product_link; ?>"><?php echo $item->order_item_name; ?></a></div>
<?php
$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
?>
</td>
<?php if ($this->doctype == 'invoice') { ?>
<td align="right" class="priceCol" >
<?php
$item->product_discountedPriceWithoutTax = (float) $item->product_discountedPriceWithoutTax;
if (!empty($item->product_priceWithoutTax) && $item->product_discountedPriceWithoutTax != $item->product_priceWithoutTax) {
echo '<span class="line-through">'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
echo '<span >'.$this->currency->priceDisplay($item->product_discountedPriceWithoutTax, $this->user_currency_id) .'</span><br />';
} else {
echo '<span >'.$this->currency->priceDisplay($item->product_item_price, $this->user_currency_id) .'</span><br />';
}
?>
</td>
<?php } ?>
<?php if ($this->doctype == 'invoice') { ?>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right" class="priceCol"><?php echo "<span class='priceColor2'>".$this->currency->priceDisplay($item->product_tax ,$this->user_currency_id, $qtt)."</span>" ?></td>
<?php } ?>
<td align="right" class="priceCol" >
<?php echo $this->currency->priceDisplay( $item->product_subtotal_discount, $this->user_currency_id ); //No quantity is already stored with it ?>
</td>
<td 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,$this->user_currency_id,$qtt) .'</span><br />' ;
}
elseif (empty($item->product_basePriceWithTax) && $item->product_item_price != $item->product_final_price) {
echo '<span class="line-through">' . $this->currency->priceDisplay($item->product_item_price,$this->user_currency_id,$qtt) . '</span><br />';
}
echo $this->currency->priceDisplay( $item->product_subtotal_with_tax ,$this->user_currency_id); //No quantity or you must use product_final_price ?>
</td>
<?php } ?>
</tr>
<?php
}
?>
<?php if ($this->doctype == 'invoice') { ?>
<tr><td colspan="<?php echo $colspan ?>"></td></tr>
<tr class="sectiontableentry1">
<td colspan="6" align="right"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_PRICES_TOTAL'); ?></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><?php echo "<span class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_tax, $this->user_currency_id)."</span>" ?></td>
<?php } ?>
<td align="right"><?php echo "<span class='priceColor2'>".$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_discountAmount, $this->user_currency_id)."</span>" ?></td>
<td align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_salesPrice, $this->user_currency_id) ?></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="6"><?php echo vmText::_('COM_VIRTUEMART_COUPON_DISCOUNT').$coupon_code ?></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"> </td>
<?php } ?>
<td align="right"></td>
<td align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->coupon_discount, $this->user_currency_id); ?></td>
</tr>
<?php } ?>
<?php
if($discountsBill){
foreach($discountsBill as $rule){ ?>
<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, $this->user_currency_id); ?></td>
<td align="right"><?php echo $this->currency->priceDisplay($rule->calc_amount, $this->user_currency_id); ?></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"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_shipment_tax, $this->user_currency_id) ?></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, $this->user_currency_id); ?></td>
</tr>
<tr>
<td align="right" class="pricePad" colspan="6"><?php echo $this->orderDetails['paymentName'] ?></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_payment_tax, $this->user_currency_id) ?></span> </td>
<?php } ?>
<td align="right"></td>
<td align="right"><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_payment + $this->orderDetails['details']['BT']->order_payment_tax, $this->user_currency_id); ?></td>
</tr>
<tr>
<td align="right" class="pricePad" colspan="6"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_billTaxAmount, $this->user_currency_id); ?></span></td>
<?php } ?>
<td align="right"><span class='priceColor2'><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_billDiscountAmount, $this->user_currency_id); ?></span></td>
<td align="right"><strong><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_total, $this->user_currency_id); ?></strong></td>
</tr>
<?php
if($this->doVendor){
$comp = $this->orderDetails['details']['BT']->order_currency;
} else {
$comp = $this->user_currency_id;
}
if(!empty($this->orderDetails['details']['BT']->payment_currency_rate)
and $this->orderDetails['details']['BT']->payment_currency_id!=$comp and $this->orderDetails['details']['BT']->payment_currency_rate!=1.0){
?><tr>
<td align="right" class="pricePad" colspan="7"><strong><?php echo vmText::_('COM_VM_TOTAL_IN_PAYMENT_CURRENCY') ?></strong></td>
<td align="right" class="pricePad" colspan="2"><?php
if($this->orderDetails['details']['BT']->order_currency==$this->orderDetails['details']['BT']->user_currency_id and $this->orderDetails['details']['BT']->user_currency_id!=$this->orderDetails['details']['BT']->payment_currency_id){
echo $this->orderDetails['details']['BT']->payment_currency_rate;
} else if ($this->orderDetails['details']['BT']->order_currency==$this->orderDetails['details']['BT']->payment_currency_id and $this->orderDetails['details']['BT']->payment_currency_id!=$this->orderDetails['details']['BT']->user_currency_id){
echo $this->orderDetails['details']['BT']->user_currency_rate;
}
echo ' <strong>';
echo $this->currencyP->priceDisplay($this->orderDetails['details']['BT']->order_total, $this->orderDetails['details']['BT']->payment_currency_id); ?>
</strong></td>
</tr>
<?php
}
if($taxBill){
?><tr >
<td colspan="7" align="right" class="pricePad"><?php echo vmText::_('COM_VIRTUEMART_TOTAL_INCL_TAX') ?> </td>
<td></td>
<td></td>
</tr><?php
foreach($taxBill as $rule){
if ($rule->calc_kind == 'taxRulesBill' or $rule->calc_kind == 'VatTax' ) { ?>
<tr >
<td colspan="6" align="right" class="pricePad"><?php echo $rule->label ?> </td>
<?php if ( VmConfig::get('show_tax')) { ?>
<td align="right"><?php echo $this->currency->priceDisplay($rule->calc_result, $this->user_currency_id); ?></td>
<?php } ?>
<td align="right"></td>
<td align="right"></td>
</tr>
<?php
}
}
}
?>
<?php } ?>
</table>
Hello,
thanks for the answer and sorry for the late reply.
I've checked the file mail_html_pricelist.php
This is the code:
defined('_JEXEC') or die('Restricted access');
$oldlayout=$this->getLayout();
$this->setLayout('invoice');
echo $this->loadTemplate('items');
$this->setLayout($oldlayout);
I guess the columns are brought by the loadTemplate function, but still cannot see how to change them.
Quote from: Studio 42 on February 28, 2017, 21:09:46 PM
This should be OK.
Yes, it does work now. Thank you very much! :D
Another question for the confirmation mail.
I am displaying the order date, using the "created_on" field. But how can I change the date notation to the local setting of the user?
By default the notation is 2017-03-02, when it is 2nd of march. I like it to display as 02-03-2017.
Any ideas?
See here for eg https://www.ostraining.com/blog/joomla/change-joomla-s-date-format/
The article explain how to change it, but i don't know the KEY used by VM.
Ok, I will check that site.
I used to have an extension for the e-mails. I found in that code something about setting the date format.
private function userFormattedDate($timestamp, $timezone) {
$dateFormat = emp_helper::getGlobalParam('date_format');
$date = new JDate();
if(!function_exists('date_timestamp_set')){
$tmpdate = getdate( ( int ) $timestamp );
$date->setDate( $tmpdate['year'] , $tmpdate['mon'] , $tmpdate['mday'] );
$date->setTime( $tmpdate['hours'] , $tmpdate['minutes'] , $tmpdate['seconds'] );
}
else{
$date->setTimestamp($timestamp);
}
$date->setTimezone(new DateTimeZone($timezone));
$ret = $date->format($dateFormat, true);
return $ret;
}
private function userFormattedDateLocale($timestamp, $timezone, $locale = null) {
if (!is_null($locale)){
$curLocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, $locale);
setlocale(LC_TIME, $locale);
}
$dateFormat = emp_helper::getGlobalParam('date_format_locale');
$defTZ = date_default_timezone_get();
date_default_timezone_set($timezone);
$date = strftime($dateFormat, $timestamp);
date_default_timezone_set($defTZ);
if ($date === false){
$dateFormat = "%b %d, %Y";
$date = strftime($dateFormat); //March 10, 2011
}
if(!is_null($locale)){
setlocale(LC_CTYPE, $curLocale);
setlocale(LC_TIME, $curLocale);
}
return $date;
}
}
If you use Joomla, the timezone is set by user(in your case too), but this is not the right timeZone when you send yourself the mail or if user is not connected.
So i think timezone should be manually set or it's better to use UTC time zone.
You can use
$format = JText::_('DATE_FORMAT_LC4'); // or DATE_FORMAT_LC3
$date = JFactory::getDate($mydate, 'UTC');
echo $date->toFormat($format);
So no other ideas in about how to change my confirmation email columns?
mausci1969
There are not really any "other ideas" - you need to change the templates for the files that are used in email confirmation.
Studio42 has given you some input to this in the previous posts.
If you cannot see how to do this then you may need to engage a developer.
Looks like in virtuemart 3.2.14 the layout of the e-mail has been changed.
I put back my own code in thes mail_html files. Also in invoice_items.php. But still the table of the items (sku, name, price, etc) is the standaard of virtuemart. Somehow my own code has not beed used.
Where is this new virtuemart code of the invoice items now, which I need to edit? The rest of the e-mail displays my own layout, except the table of the invoice items.
Edit: found it! Looks like mail_html_pricelist.php is used now, not only invoice_items.php.
I have used this method to show the product image on my invoices, and I have it working properly.
It took me forever searching for a way to specify the image size displayed on the invoice, so I wanted to share the trick because making a DIV around the image php code and specifying width and height there has no effect.
You need to add "$width=X,$height=X" to the php code displaying the image:
<?php if (!empty($item->images[0])) { echo $item->images[0]->displayMediaThumb ('',FALSE,"", true, false, true,$width=50,$height=50); } ?>
Quote from: EIF on April 20, 2018, 16:37:53 PM
Edit: found it! Looks like mail_html_pricelist.php is used now, not only invoice_items.php.
THANKS EIF!
I might never have figured this out without your note!
why are u people not using template over rides?
Quote from: GJC Web Design on September 01, 2019, 16:17:33 PM
why are u people not using template over rides?
GJC,
We are using our template over rides - the issue here is that if you only have the one over ride file invoice_items.php it does not work for us you also need to add the file mail_html_pricelist.php (unedited) as having only the file invoice_items.php is not enough to get our own template file to be used -- a bug since 3.2.12?
There is no bug,
earlier one file was called by the other, so both price list tables were the same.
For good reason, to have different tables for mail and invoice, this has been changed. So finally you can easily leave out columns or rows in your invoice that you show in your mail.
The status column is one of the examples. Many shop owners want to show the status of single products in the email, but the invoice is delivered without the status.
Regards
Stefan