Is it possible to add the total number of products at the order? this would help a lot for order picking.
What php code can be used and in which file?
Using vm 3.2 and joomla 3.7.2
Thanks,
Pas
Should be possible with a core hack or develop a vm extended plugin. Before add to cart execution check the cart quantity and return if there are to many products.
Thanks for your reply, but I guess no check is needed :)
Just the sum of articles (2 apples, 10 beans, 5 bread = 17 products)
Regards,
Pas
Ah OK ... this should be inside the cart object. Make a vmdebug inside one of your cart template overrides and look what is there.
Hi could you explain this a bit more detailed, what/where should this be done, and what should I look for?
Just need total products added at bottom of admin order.
Thanks,
Pas
mail_html_vendor.php
or
mail_html_vendor_more.php
$this->orderDetails['totalItems']
Hi, I added the code to mail_html_vendor.php but gave an error 0 ?
Guess I did it wrong
<?php
// echo vmText::_('COM_VIRTUEMART_CART_MAIL_VENDOR_TITLE').$this->vendor->vendor_name.'<br/>';
echo vmText::sprintf('COM_VIRTUEMART_MAIL_VENDOR_CONTENT',$this->vendor->vendor_store_name,$this->shopperName,$this->currency->priceDisplay($this->orderDetails['details']['BT']->order_total),$this->orderDetails['details']['BT']->order_number);
if(!empty($this->orderDetails['details']['BT']->customer_note)){
echo '<br /><br />'.vmText::sprintf('COM_VIRTUEMART_CART_MAIL_VENDOR_SHOPPER_QUESTION',$this->orderDetails['details']['BT']->customer_note).'<br />';
echo vmText::$this->orderDetails['totalItems'];
}
?>
???? echo vmText::$this->orderDetails['totalItems'];
try echo 'Total Order Items: '.$this->orderDetails['totalItems'];
Hello
I must miss something obvious, but the proposed solution does not work. There is no such item...
echo 'Total Order Items: '.$this->orderDetails['totalItems'];
I suggest this solution
<?php
$totalNrOfOrderItems= 0;
foreach ($this->orderDetails['items'] as $orderItem) {
$totalNrOfOrderItems = $totalNrOfOrderItems + $orderItem->product_quantity;
}
echo vmText::_('VM_TOTAL_NUMBER_OF_ORDER_ITEMS') . $totalNrOfOrderItems;
?>
Hope that this will help.
regards
Jörgen @ Kreativ Fotografi
[edit] changed [items] to ['items'] [/edit]
Ah .. I just assumed there was cos K&K said.. ;)
I have just added my solution to the /templates/my-template/html/com_virtuemart/invoice/invoice_items.php and can see that it works as expected. As 2cool said, it is a nice feature for order picking.
Have a nice day
Jörgen @ Kreativ Fotografi
Quote from: Jörgen on June 04, 2017, 13:41:17 PM
Hello
I must miss something obvious, but the proposed solution does not work. There is no such item...
echo 'Total Order Items: '.$this->orderDetails['totalItems'];
oh sorry you're right, I just copy paste it from my template and forgot I've set this before on mail_html.php:
$totalItems = 0;
foreach($this->orderDetails['items'] as $item) {
$totalItems += $item->product_quantity;
}
$this->orderDetails['totalItems'] = $totalItems;
Hi and thank you,
I'm almost got this right....
But I see this on orders: VM_TOTAL_NUMBER_OF_ORDER_ITEMS5
Is this just a issue in translation file? i'm using Dutch language...
Thanks and regards,
Pas
Quote from: 2cool on June 06, 2017, 09:58:49 AM
But I see this on orders: VM_TOTAL_NUMBER_OF_ORDER_ITEMS5
Is this just a issue in translation file? i'm using Dutch language...
This is a custom language key and you must create it
Extensions -> Languages -> Overrides
Thanks for your help!
But I tried to do the same on a new site but can't reproduce this again :(
Get this error on mails Notice: Use of undefined constant items - assumed 'items' in /templates/mytemplate/html/com_virtuemart/invoice/invoice_items.php on line 272
Step by step:
- in /components/com_virtuemart/views/invoice/tmpl/mail_html_vendor.php add:
echo 'Total Order Items: '.$this->orderDetails['totalItems'];
- in /templates/my-template/html/com_virtuemart/invoice/invoice_items.php -> add:
<?php
$totalNrOfOrderItems= 0;
foreach ($this->orderDetails[items] as $orderItem) {
$totalNrOfOrderItems = $totalNrOfOrderItems + $orderItem->product_quantity;
}
echo vmText::_('VM_TOTAL_NUMBER_OF_ORDER_ITEMS') . $totalNrOfOrderItems;
?>
- in /components/com_virtuemart/views/invoice/tmpl/mail_html.php -> add:
$totalItems = 0;
foreach($this->orderDetails['items'] as $item) {
$totalItems += $item->product_quantity;
}
$this->orderDetails['totalItems'] = $totalItems;
- Create a langauage override for 'VM_TOTAL_NUMBER_OF_ORDER_ITEMS'
Thanks and regards,
Pas
QuoteUse of undefined constant items - assumed 'items'
'items
'<?php
$totalNrOfOrderItems= 0;
foreach ($this->orderDetails['items'] as $orderItem) {
$totalNrOfOrderItems = $totalNrOfOrderItems + $orderItem->product_quantity;
}
echo vmText::_('VM_TOTAL_NUMBER_OF_ORDER_ITEMS') . $totalNrOfOrderItems;
?>
Of course You are right.
I wonder why the code snippet showed [items] instead of ['items']. Could swear that I copied it from the code without editing. Bý the way, Your example shows [imems] instead of [items] ;)
Will also change my original post.
regards
Jörgen @ Kreativ Fotografi
Thanks for your help, got one last question:
I added this to nl-NL.override.ini:
VM_TOTAL_NUMBER_OF_ORDER_ITEMS="Totaal aantal artikelen: "
This doesn't work anymore?
shows: VM_TOTAL_NUMBER_OF_ORDER_ITEMS2 on invoice mails?
Regards,
Pas
you need it for frontend AND backend
Yes! works perfect real nice, thanks for your help.
Regards,
Pas