News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Adding product thumbnail in order listing and order email

Started by dummyjoomla, September 26, 2020, 16:47:49 PM

Previous topic - Next topic

dummyjoomla

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.

GJC Web Design

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>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

dummyjoomla

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>


GJC Web Design

#3
<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>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

dummyjoomla

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>