How to show products that are the same but with quantity 2 or higher on its own line?
From that description it is not clear what you want to do.
I guess You want to display quantity pricing. It is not standard, but some templates have this feature, for example Hera from olympian themes.
Maybe someone will share code for this, otherwise is the that template not very expensive and has a lot of features.
regards
Jörgen @ Kreativ Fotografi
Quote from: jenkinhill on July 03, 2018, 18:35:35 PM
From that description it is not clear what you want to do.
Sorry I should've been clearer.
Right now my invoice list every product on its own line, for example:
Product - Quantity - Price
Shoe - 1 - 10,95
Now when the quantity is 2 the quantity gets that number:
Shoe - 2 - 21,90
What I want is that instead of the 2 in the quantity I just want the Shoe to get its own line on the invoice:
Shoe - 1 - 10,95
Shoe - 1 - 10,95
I want to know if that is possible and how to do that.
Quote from: Jörgen on July 03, 2018, 19:15:58 PM
I guess You want to display quantity pricing. It is not standard, but some templates have this feature, for example Hera from olympian themes.
Maybe someone will share code for this, otherwise is the that template not very expensive and has a lot of features.
regards
Jörgen @ Kreativ Fotografi
No, I don't think so, but that could be, see above what I want exactly. Thanks.
The only solution i see is to modify the PHP code in cart, but you need to do it in the order too.
Quote from: Studio 42 on July 03, 2018, 23:03:07 PM
The only solution i see is to modify the PHP code in cart, but you need to do it in the order too.
Isn't it possible to only change the template for the invoice for example?
I only want this on my invoice, in the shop and administrator part of my website it's good how it works right now.
then do a template override for virtuemart order items
Quote from: Studio 42 on July 04, 2018, 11:06:16 AM
then do a template override for virtuemart order items
Can you point me in where I must be, and how to do this?
override \components\com_virtuemart\views\orders\tmpl\details_items.php
See doc https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
The code is too long to write, so check to do it yourself
Quote from: Studio 42 on July 04, 2018, 17:23:10 PM
override \components\com_virtuemart\views\orders\tmpl\details_items.php
See doc https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
The code is too long to write, so check to do it yourself
Ok, thanks for pointing me in the right direction. Funny thing is, the changes don't do anything to the PDF output. I have tried to change the PHP file above. But that didn't work. I also tried to change the /invoice/invoice_items.php but that didn't work either:
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;
if($qtt > 1){
for($i = 0; $i < $qtt; $i++){ ?>
<tr valign="top">
<td align="left">
<?php echo $item->order_item_sku; ?>
</td>
<td align="left" colspan="2" >
<div float="right" ><a href="<?php echo $product_link; ?>"><?php echo $item->order_item_name; ?></a></div>
<?php
//if (!empty($item->product_attribute)) {
if(!class_exists('VirtueMartModelCustomfields'))require(VMPATH_ADMIN.DS.'models'.DS.'customfields.php');
$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
//}
?>
</td>
<td align="center">
<?php echo $this->orderstatuses[$item->order_status]; ?>
</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->currency) .'</span><br />';
echo '<span >'.$this->currency->priceDisplay($item->product_discountedPriceWithoutTax, $this->currency) .'</span><br />';
} else {
echo '<span >'.$this->currency->priceDisplay($item->product_item_price, $this->currency) .'</span><br />';
}
?>
</td>
<?php } ?>
<td align="right" >
<?php echo "1"; ?>
</td>
<?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->currency, $qtt)."</span>" ?></td>
<?php } ?>
<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->currency,$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->currency,$qtt) . '</span><br />';
}
echo $this->currency->priceDisplay( $item->product_subtotal_with_tax ,$this->currency); //No quantity or you must use product_final_price ?>
</td>
<?php } ?>
</tr> <?
}
} else { ?>
<tr valign="top">
<td align="left">
<?php echo $item->order_item_sku; ?>
</td>
<td align="left" colspan="2" >
<div float="right" ><a href="<?php echo $product_link; ?>"><?php echo $item->order_item_name; ?></a></div>
<?php
//if (!empty($item->product_attribute)) {
if(!class_exists('VirtueMartModelCustomfields'))require(VMPATH_ADMIN.DS.'models'.DS.'customfields.php');
$product_attribute = VirtueMartModelCustomfields::CustomsFieldOrderDisplay($item,'FE');
echo $product_attribute;
//}
?>
</td>
<td align="center">
<?php echo $this->orderstatuses[$item->order_status]; ?>
</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->currency) .'</span><br />';
echo '<span >'.$this->currency->priceDisplay($item->product_discountedPriceWithoutTax, $this->currency) .'</span><br />';
} else {
echo '<span >'.$this->currency->priceDisplay($item->product_item_price, $this->currency) .'</span><br />';
}
?>
</td>
<?php } ?>
<td align="right" >
<?php echo $qtt; ?>
</td>
<?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->currency, $qtt)."</span>" ?></td>
<?php } ?>
<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->currency,$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->currency,$qtt) . '</span><br />';
}
echo $this->currency->priceDisplay( $item->product_subtotal_with_tax ,$this->currency); //No quantity or you must use product_final_price ?>
</td>
<?php } ?>
</tr>
<? }
?>
What am I doing wrong or forgetting for that matter?
EDIT: So I checked the Delivery Note, and that is now displaying every product on its own line! Now only the invoice needs to be changed. Looks like the Delivery Note is the only thing that gets the code from the file i changed, that means the actual PDF code is generated elsewhere. I cannot find where though.
You don't spoke about PDF
See \components\com_virtuemart\views\invoice\tmpl\invoice_items.php, this should be the file to render the PDF and print view items
Quote from: Studio 42 on July 05, 2018, 11:29:52 AM
You don't spoke about PDF
See \components\com_virtuemart\views\invoice\tmpl\invoice_items.php, this should be the file to render the PDF and print view items
I did change that part as well, but the PDF is still being made as is.
A simple question.
Do you delete the original file each time you do a new test ?
If not the rendered PDF is from the file saved in your secured folder
I checked exactly.
This is the function called in admin
public function callInvoiceView(){
if(!class_exists( 'VirtueMartControllerInvoice' )) require(VMPATH_SITE.DS.'controllers'.DS.'invoice.php');
$controller = new VirtueMartControllerInvoice();
$controller->display();
}
So the used view is invoice
In invoice controller display, it load invoice layout and invoice_items is the part redenring the items(products)
Got it working. Already generated invoices are not touched, but new invoices are rightly generated now.