How to disable VirtueMart order e-mails and invoices
- Last revised:
- Mittwoch, 24. Mai 2017
Answer
Because VM Invoice can supply VirtueMart e-mails, you will maybe want to disable default VirtueMart order confirmation e-mails.
Unfortunatelly, the only way how to do this now is modifying VM source code.
If using VirtueMArt 1.x.x, try this istructions:
http://www.chillcreations.com/blog/22-joomla/302-no-virtuemart-order-confirmation-e-mail.html
Disabling VirtueMart 2.0.22 or 3.x and newer PDF Invoices
To prevent customer from getting also VM native invoices, you first need to create a dummy order status in VirtueMart -> Order Statuses called for example "No Invoice", and then assign it to the "Default Order Status to create an invoice" option in VirtueMart -> Configuration -> Checkout settings in VM2 or in VirtueMart -> Configuration -> E-mails in VM3. That way the invoice PDF won't be created.
If you don't want your customers to receive any e-mails from VirtueMart at all, set your "No Invoice" status created in previuos step also to the "Default Order Status to send email to shopper" option in VirtueMart -> Configuration -> Checkout setting/Emails.
If using VirtueMart 2.x.x older than 2.0.22 (EDIT: New, better working integration):
- open file JOOMLA_ROOT/components/com_virtuemart/helpers/shopfunctionsf.php
Find line 243 (can differ depends on your version of VM)
Important is, replace line$user= self::sendVmMail($view, $recipient,$noVendorMail);
with
//edied: ARTIO: disable initial e-mail to customer. send only to vendor.
if ($viewName=='invoice' AND in_array($vars['orderDetails']['details']['BT']->order_status, array('P','U')))
$user = null;
else
$user= self::sendVmMail($view, $recipient,$noVendorMail); - Open file JOOMLA_ROOT /administrator/components/com_virtuemart/models/orders.php
Find line 1290 (can differ depends on your version of VM)
And replace// Send the email
if (shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null,$vars['doVendor'])) {
...
with// Send the email
$res = shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null,$vars['doVendor']);
if ($res===null) //edited: ARTIO: when sent to customer disabled, dont display message.
return true;
if ($res) {
…
This option will disable initial "pending order" E-mail. However, customer will get e-mails if you keep checked "notify customer" option when changing order status. If you want to disable e-mails also for other statuses, don't check „notify customer“ or edit condition in point 1 like:
… array('P','U' /* other statuses: */, 'P','S') ...
How to enabled sending of invoices from VM Invoice:
set up "Automatic" mode in Global configuration --> General configuration and also enabled "VM Invoice Autorun" plugin or set up cron task (described in VM Invoice documentation point 4.1).