Aha i see, I didnt know if the value of the main product was the default if no other was entered in the variant. I have added this to the email and it seems to work really well. The PDF on the other hand still wont generate on products with variants, even if i take out the code I added about the product description. This is the code i am using in the invoice.php file please can you see if it works for you when someone buys a product with a variant?
<?php
/**
* @copyright Copyright (C) 2009-2012 ACYBA SARL - All rights reserved.
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
?>
<style type="text/css">
<!--
.invoicetitle{ text-align:center;font-size:30px; padding-top:40px;padding-bottom:40px}
legend { padding:5px 10px; background-color:#5471B5;color:white;font-weight:bold;border-color:#ccc}
fieldset { padding:10px; border-color:#ccc;}
div.date{text-align:right;color:#333;}
.storeaddress{
color:#333;
}
.addresses{padding-top:50px;}
.addresses td{padding-left:50px;}
.addresses fieldset {float:left;}
table.products{margin:auto;margin-top:60px;width:580px;border-collapse:collapse}
.price{text-align:center;}
.products td, .products th{border:1px solid #ccc;padding:7px 4px;}
.products th{background-color:#5471B5;color:white;}
td.newarea{text-align:right;padding-right:20px;}
tr.total{font-weight:bold;}
.products tr.limitation td{background-color:#ccc;padding:1px 0px;}
.hikashop_order_custom_fields_fieldset{margin-top : 20px;}
.footer{font-size:10px;color:#aaa;text-align:center;}
-->
</style>
<page style="font-size: 12px" backtop="14mm" backbottom="14mm" backleft="10mm" backright="10mm">
<page_footer>
<div class="footer">
<?php echo str_replace(array("\r\n","\n","\r"),array('<br/>','<br/>','<br/>'),$this->params->get('footer')); ?>
</div>
</page_footer>
<div class="storeaddress">
<!--<?php
$store = str_replace(array("\r\n","\n","\r"),array('<br/>','<br/>','<br/>'),$config->get('store_address',''));
if(JText::_($store)!=$store){
$store = JText::_($store);
}
echo $store;
?>-->
</div>
<?php if(empty($order->order_invoice_number)){
$order->order_invoice_number = $order->order_number;
}
if(empty($order->order_invoice_created)){
$order->order_invoice_created = $order->order_created;
} ?>
<div style="margin-left:auto; margin-right:auto; margin-top:-30px;"><p style="text-align:center;"><img class="w600" src="images/voucher-pdf-header.png" border="0" alt="" /></p></div>
<div class="invoicetitle" style="font-size:24px;">Voucher Code: <?php echo $order->order_invoice_number; ?></div>
<div class="date" style="margin-bottom:-20px; margin-top:-20px;"><p style="text-align:center;"><?php echo JText::_('DATE').' Purchased: '.hikashop_getDate($order->order_invoice_created,'%d %B %Y ');?></p>
<p style="text-align:center;">Please quote your voucher code when contacting the venue to redeem. If you have purchased more than one deal the same code will be valid multiple times.</p>
</div>
<!--<table class="addresses">
<tr>
<?php
$addresses = array('billing_address','shipping_address');
foreach($addresses as $oneAddress){
if(empty($order->$oneAddress)) continue;
if ($oneAddress=='shipping_address' && empty($pluginsShipping)) continue; ?>
<td valign="top">
<fieldset>
<legend><?php echo JText::_('HIKASHOP_'.strtoupper($oneAddress)); ?></legend>
<?php
if(!empty($order->$oneAddress->address_company)) echo $order->$oneAddress->address_company.'<br/>';
echo $order->$oneAddress->address_title.' '.$order->$oneAddress->address_firstname.' '.$order->$oneAddress->address_lastname.'<br/>';
echo $order->$oneAddress->address_street.'<br/>';
echo $order->$oneAddress->address_post_code.' '.$order->$oneAddress->address_city.' '.$order->$oneAddress->address_state.'<br/>';
echo $order->$oneAddress->address_country.'<br/>';
if(!empty($order->$oneAddress->address_telephone)) echo JText::sprintf('TELEPHONE_IN_ADDRESS',$order->$oneAddress->address_telephone).'<br/>';
if(!empty($order->$oneAddress->address_vat)) echo JText::_('VAT_NUMBER').' : '.$order->$oneAddress->address_vat.'<br/>';
?>
</fieldset>
</td>
<?php } ?>
</tr>
</table>-->
<table class="products">
<tr class="products_title">
<th style="width:300px; background-color:#FF8811;">
<?php echo JText::_('PRODUCT'); ?>
</th>
<th style="width:100px; background-color:#333;" class="price">
<?php echo JText::_('UNIT_PRICE'); ?>
</th>
<th style="width:80px; background-color:#333;" class="price">
<?php echo JText::_('PRODUCT_QUANTITY'); ?>
</th>
<th style="width:100px; background-color:#333;" class="price">
<?php echo JText::_('PRICE'); ?>
</th>
</tr>
<?php
if(hikashop_level(2)){
$fieldsClass = hikashop_get('class.field');
$null = null;
$itemFields = $fieldsClass->getFields('frontcomp',$null,'item');
}
$group = $config->get('group_options',0);
foreach($order->products as $product){
if($group && $product->order_product_option_parent_id) continue;
?>
<tr>
<td>
<?php echo implode('<br/>',$this->str_split_unicode($product->order_product_name,50));
if($group){
$display_item_price=false;
foreach($order->products as $j => $optionElement){
if($optionElement->order_product_option_parent_id != $product->order_product_id) continue;
if($optionElement->order_product_price>0){
$display_item_price = true;
}
}
if($display_item_price){
if($config->get('price_with_tax')){
echo ' '.$currencyHelper->format($product->order_product_price+$product->order_product_tax,$order->order_currency_id);
}else{
echo ' '.$currencyHelper->format($product->order_product_price,$order->order_currency_id);
}
}
}
if(!empty($fields['item'])){
foreach($fields['item'] as $field){
$namekey = $field->field_namekey;
if(empty($product->$namekey)) continue;
echo '<p>'.$fieldsClass->getFieldName($field).': '.$fieldsClass->show($field,$product->$namekey).'</p>';
}
}
if($group){
foreach($order->products as $j => $optionElement){
if($optionElement->order_product_option_parent_id != $product->order_product_id) continue;
$product->order_product_price +=$optionElement->order_product_price;
$product->order_product_tax +=$optionElement->order_product_tax;
$product->order_product_total_price+=$optionElement->order_product_total_price;
$product->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat;
?><br/><?php
echo $optionElement->order_product_name;
if($optionElement->order_product_price>0){
if($config->get('price_with_tax')){
echo ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$order->order_currency_id).' )';
}else{
echo ' ( + '.$currencyHelper->format($optionElement->order_product_price,$order->order_currency_id).' )';
}
}
}
} ?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($product->order_product_price+$product->order_product_tax,$order->order_currency_id);
}else{
echo $currencyHelper->format($product->order_product_price,$order->order_currency_id);
} ?>
</td>
<td class="price">
<?php echo $product->order_product_quantity;?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($product->order_product_total_price,$order->order_currency_id);
}else{
echo $currencyHelper->format($product->order_product_total_price_no_vat,$order->order_currency_id);
} ?>
</td>
</tr>
<?php
}
?>
<tr class="limitation"><td colspan="4"></td></tr>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'SUBTOTAL' ); ?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($order->order_subtotal,$order->order_currency_id);
}else{
echo $currencyHelper->format($order->order_subtotal_no_vat,$order->order_currency_id);
} ?>
</td>
</tr>
<?php $taxes = $order->order_subtotal - $order->order_subtotal_no_vat - $order->order_discount_tax + $order->order_shipping_tax;;
if(!empty($order->order_discount_code)){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'HIKASHOP_COUPON' ); ?>
</td>
<td class="price">
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($order->order_discount_price*-1,$order->order_currency_id);
}else{
echo $currencyHelper->format(($order->order_discount_price-@$order->order_discount_tax)*-1,$order->order_currency_id);
}
?>
</td>
</tr>
<?php }
if(!empty($order->order_shipping_method)){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'SHIPPING' ); ?>
</td>
<td class="price" >
<?php
if($config->get('price_with_tax')){
echo $currencyHelper->format($order->order_shipping_price,$order->order_currency_id);
}else{
echo $currencyHelper->format($order->order_shipping_price-@$order->order_shipping_tax,$order->order_currency_id);
} ?>
</td>
</tr>
<?php }
if(!empty($order->additional)) {
$exclude_additionnal = explode(',', $config->get('order_additional_hide', ''));
foreach($order->additional as $additional) {
if(in_array($additional->name, $exclude_additionnal)) continue;
echo '<tr><td colspan="3" class="newarea">'. JText::_($additional->order_product_name).'</td><td class="price">';
if(!empty($additional->order_product_price) || empty($additionaltionnal->order_product_options)) {
if($config->get('price_with_tax')){
echo $currencyHelper->format($additional->order_product_price+@$additional->order_product_tax, $order->order_currency_id);
}else{
echo $currencyHelper->format($additional->order_product_price, $order->order_currency_id);
}
} else {
echo $additional->order_product_options;
}
echo '</td></tr>';
}
}
if($taxes != 0){
if($config->get('detailed_tax_display') && !empty($order->order_tax_info)){
foreach($order->order_tax_info as $tax){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo $tax->tax_namekey; ?>
</td>
<td class="price">
<?php echo $currencyHelper->format($tax->tax_amount,$order->order_currency_id); ?>
</td>
</tr>
<?php
}
}else{ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'VAT' ); ?>
</td>
<td class="price">
<?php echo $currencyHelper->format($taxes,$order->order_currency_id); ?>
</td>
</tr>
<?php }
} ?>
<?php
if(!empty($order->order_payment_method) && $order->order_payment_price != 0){ ?>
<tr>
<td colspan="3" class="newarea">
<?php echo JText::_( 'HIKASHOP_PAYMENT' ); ?>
</td>
<td class="price" >
<?php echo $currencyHelper->format($order->order_payment_price,$order->order_currency_id); ?>
</td>
</tr>
<?php } ?>
<tr class="total">
<td colspan="3" class="newarea">
<?php echo JText::_( 'HIKASHOP_TOTAL' ); ?>
</td>
<td class="price" >
<?php echo $currencyHelper->format($order->order_full_price,$order->order_currency_id); ?>
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td> <h1 style="background-color:#333;font-size:14px;padding:5px; text-align:center; color:#fff; font-family:Arial, Helvetica, sans-serif;">Full Details / T&C's / How to Redeem...</h1>
<p style="font-size:10px;"><br/>
<?php
$productClass = hikashop_get('class.product');
foreach($order->products as $item){
$product = $productClass->get($item->product_id);
echo $item->order_product_name.'<strong></strong>';
if($product->product_type=='variant'){
$product = $productClass->get($product->product_parent_id);
}
echo $product->product_description.'<br/><hr><br/>';
} ?>
</p>
</td>
</tr>
</table>
<p>
<?php
if (!empty($pluginsShipping))
echo JText::_('HIKASHOP_SHIPPING_METHOD').' : '.$pluginsShipping->getName($order->order_shipping_method, $order->order_shipping_id).'<br/>' ;
if(!empty($pluginsPayment))
echo JText::_('HIKASHOP_PAYMENT_METHOD').' : '.$pluginsPayment->getName($order->order_payment_method, $order->order_payment_id).'<br/>';
?>
</p>
<br/>
<?php if(hikashop_level(2) && !empty($fields['order'])){?>
<fieldset class="hikashop_order_custom_fields_fieldset">
<legend><?php echo JText::_('ADDITIONAL_INFORMATION'); ?></legend>
<table class="hikashop_order_custom_fields_table adminlist" cellpadding="1" width="100%">
<?php foreach($fields['order'] as $fieldName => $oneExtraField) {
if(!@$oneExtraField->field_frontcomp || empty($order->$fieldName)) continue;
?>
<tr class="hikashop_order_custom_field_<?php echo $fieldName;?>_line">
<td class="key">
<?php echo $fieldsClass->getFieldName($oneExtraField);?>
</td>
<td>
<?php echo $fieldsClass->show($oneExtraField,$order->$fieldName); ?>
</td>
</tr>
<?php } ?>
</table>
</fieldset>
<br/>
<?php } ?>
<div style="margin-left:auto; margin-right:auto; margin-top:0px;"><p style="text-align:center;"><img class="w600" src="images/voucher-footer-pdf.png" border="0" alt="" /></p></div>
</page>