VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: dummyjoomla on September 26, 2020, 16:47:49 PM

Title: Adding product thumbnail in order listing and order email
Post by: dummyjoomla on September 26, 2020, 16:47:49 PM
Hi, I am using joomla 3.8 and virtuemart 3. I am trying to add in a product thumbnail image in order listing and also order email, I cannot seem to find any code that works for me online. Can anyone help me? Thanks.
Title: Re: Adding product thumbnail in order listing and order email
Post by: GJC Web Design on September 26, 2020, 17:49:48 PM
I use in the invoice for example

in the items loop

foreach($this->orderDetails['items'] as $item) {
$product = $model->getProductSingle($item->virtuemart_product_id,false);
$model->addImages($product);
$image = $product->images[0];
.............


then to display

<span class="img-thumbnail"><?php echo $image->displayMediaThumb (''FALSE''TRUEFALSETRUE8080); ?></span>
Title: Re: Adding product thumbnail in order listing and order email
Post by: dummyjoomla on September 27, 2020, 06:27:47 AM
Hi, thanks for helping, I tried to add in the order details page(details_items.php) its not working. below is my code, let me know If there is any mistake.
<?php 
foreach($this->orderDetails['items'] as $item) {
$product $model->getProductSingle($item->virtuemart_product_id,false);
$model->addImages($product);
$image $product->images[0];
}
?>



<table width="<?php echo $widthTable ?>%" cellspacing="0" cellpadding="0" border="0" class="orderdetails-table">
<tr style="text-align: left;" class="sectiontableheader">
<th style="text-align: left;display: none;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU'?></th>
<th style="text-align: left;" colspan="5" width="<?php echo $widthTitle ?>%" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE'?></th>
<th style="text-align: center;display: none;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_STATUS'?></th>
<th style="text-align: right;" width="15%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE'?></th>
<th style="text-align: right;" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY'?></th>
<?php if ( VmConfig::get('show_tax')) { ?>
<th style="text-align: right;" width="11%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX'?></th>
  <?php ?>
<th style="text-align: right;display: none;" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT'?></th>
<th style="text-align: right;" width="17%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL'?></th>
</tr>
<?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_idFALSE);
?>

<tr style="vertical-align: top;">
<td style="text-align: left;display: none;">
<?php echo $item->order_item_sku?>
</td>
<td style="text-align: left;" colspan="5" >
<div><span class="img-thumbnail"><?php echo $image->displayMediaThumb (''FALSE''TRUEFALSETRUE8080); ?></span><a href="<?php echo $_link?>"><?php echo $item->order_item_name?></a> (<?php echo $item->category_name ?>)</div>
<?php
$product_attribute VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
?>

</td>

Quote from: GJC Web Design on September 26, 2020, 17:49:48 PM
I use in the invoice for example

in the items loop

foreach($this->orderDetails['items'] as $item) {
$product = $model->getProductSingle($item->virtuemart_product_id,false);
$model->addImages($product);
$image = $product->images[0];
.............


then to display

<span class="img-thumbnail"><?php echo $image->displayMediaThumb (''FALSE''TRUEFALSETRUE8080); ?></span>

Title: Re: Adding product thumbnail in order listing and order email
Post by: GJC Web Design on September 27, 2020, 11:26:54 AM
<table width="<?php echo $widthTable ?>%" cellspacing="0" cellpadding="0" border="0" class="orderdetails-table">
<tr style="text-align: left;" class="sectiontableheader">
<th style="text-align: left;display: none;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU'?></th>
<th style="text-align: left;" colspan="5" width="<?php echo $widthTitle ?>%" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE'?></th>
<th style="text-align: center;display: none;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_STATUS'?></th>
<th style="text-align: right;" width="15%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE'?></th>
<th style="text-align: right;" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY'?></th>
<?php if ( VmConfig::get('show_tax')) { ?>
<th style="text-align: right;" width="11%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX'?></th>
  <?php ?>
<th style="text-align: right;display: none;" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT'?></th>
<th style="text-align: right;" width="17%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL'?></th>
</tr>
<?php
$model 
VmModel::getModel('product');
foreach(
$this->orderdetails['items'] as $item) {
$product $model->getProductSingle($item->virtuemart_product_id,false);
$model->addImages($product);
$image $product->images[0];
$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_idFALSE);
?>

<tr style="vertical-align: top;">
<td style="text-align: left;display: none;">
<?php echo $item->order_item_sku?>
</td>
<td style="text-align: left;" colspan="5" >
<div><span class="img-thumbnail"><?php echo $image->displayMediaThumb (''FALSE''TRUEFALSETRUE8080); ?></span><a href="<?php echo $_link?>"><?php echo $item->order_item_name?></a> (<?php echo $item->category_name ?>)</div>
<?php
$product_attribute VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
?>

</td>
Title: Re: Adding product thumbnail in order listing and order email
Post by: dummyjoomla on September 27, 2020, 18:39:27 PM
Thankyou GJC, its working now. Appreciate your help.
Quote from: GJC Web Design on September 27, 2020, 11:26:54 AM
<table width="<?php echo $widthTable ?>%" cellspacing="0" cellpadding="0" border="0" class="orderdetails-table">
<tr style="text-align: left;" class="sectiontableheader">
<th style="text-align: left;display: none;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU'?></th>
<th style="text-align: left;" colspan="5" width="<?php echo $widthTitle ?>%" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE'?></th>
<th style="text-align: center;display: none;" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_STATUS'?></th>
<th style="text-align: right;" width="15%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE'?></th>
<th style="text-align: right;" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY'?></th>
<?php if ( VmConfig::get('show_tax')) { ?>
<th style="text-align: right;" width="11%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX'?></th>
  <?php ?>
<th style="text-align: right;display: none;" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT'?></th>
<th style="text-align: right;" width="17%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL'?></th>
</tr>
<?php
$model 
VmModel::getModel('product');
foreach(
$this->orderdetails['items'] as $item) {
$product $model->getProductSingle($item->virtuemart_product_id,false);
$model->addImages($product);
$image $product->images[0];
$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_idFALSE);
?>

<tr style="vertical-align: top;">
<td style="text-align: left;display: none;">
<?php echo $item->order_item_sku?>
</td>
<td style="text-align: left;" colspan="5" >
<div><span class="img-thumbnail"><?php echo $image->displayMediaThumb (''FALSE''TRUEFALSETRUE8080); ?></span><a href="<?php echo $_link?>"><?php echo $item->order_item_name?></a> (<?php echo $item->category_name ?>)</div>
<?php
$product_attribute VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
?>

</td>