VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: Engel Joris on June 15, 2013, 09:14:18 AM

Title: VM 2.0 and emails : confirmation emails
Post by: Engel Joris on June 15, 2013, 09:14:18 AM
All,

Using VM 2.0.20b and J!2.5.11 and PHP 5.3.25.

Have been looking through this forum (and the wider internet of course) for a couple of hours now, and was not able to find the answers to my questions :
1. Where can I edit the subjects of the emails sent both to the vendor and the customer? I have found where to edit the mails themself, but I need to edit the subjects
    At this point, the subjects start with the [ordernumber] ... order total ....
   Where can I change this ? In what file ?

2. I want to do disable the emails to the vendor when the status of an order is changed.
    I found this code on this page : http://www.artio.net/faqs/vm-invoice/how-to-disable-virtuemart-order-e-mails-and-invoices (http://www.artio.net/faqs/vm-invoice/how-to-disable-virtuemart-order-e-mails-and-invoices)
   
    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') ...




Wich I tried to change a bit into :
//edited:JEWEP: disable statusupdate e-mail to vendor. send only to customer. original code : ARTIO
if ($viewName=='invoice' AND in_array($vars['orderDetails']['details']['BT']->order_status, array('P','X','R','S')))
$user = null;
else
$user= self::sendVmMail($view, $recipient,$noVendorMail);
if (isset($view->doVendor) && !$recipient) {
self::sendVmMail($view, $view->vendorEmail, TRUE);
}
return $user ;

}


But this does not work. I think I messed up somewhere :-)
The idea is that the vendor only gets the confirmation email on status 'U', but the customer of course needs to get all of the emails upon changes on the status order.


Thanks for any and all replies in this matter....
;)



Title: Re: VM 2.0 and emails : confirmation emails
Post by: jenkinhill on June 15, 2013, 11:47:05 AM
1. The subject line is assembled from a language string COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_x  and some variables in components/com_virtuemart/views/invoice/view-html.php
See http://forum.virtuemart.net/index.php?topic=116224.msg392456#msg392456  Problem is that you can easily override the language string but not view-html.php - although you could try this to avaoid a core edit: http://stackoverflow.com/questions/13763539/overriding-joomla-core-component-file

2. In the next VM version:



[attachment cleanup by admin]
Title: Re: VM 2.0 and emails : confirmation emails
Post by: Engel Joris on June 15, 2013, 17:54:42 PM
hey jenkinhill,

Thanks for the fast reply.
Will try your reply on question 1. tomorrow.

When would the next version of VM be released?


Thanks for your endless efforts !
Title: Re: VM 2.0 and emails : confirmation emails
Post by: drukman2000 on July 17, 2013, 09:15:55 AM
Quote from: Engel Joris on June 15, 2013, 09:14:18 AM
All,

Using VM 2.0.20b and J!2.5.11 and PHP 5.3.25.

Have been looking through this forum (and the wider internet of course) for a couple of hours now, and was not able to find the answers to my questions :
1. Where can I edit the subjects of the emails sent both to the vendor and the customer? I have found where to edit the mails themself, but I need to edit the subjects
    At this point, the subjects start with the [ordernumber] ... order total ....
   Where can I change this ? In what file ?

2. I want to do disable the emails to the vendor when the status of an order is changed.
    I found this code on this page : http://www.artio.net/faqs/vm-invoice/how-to-disable-virtuemart-order-e-mails-and-invoices (http://www.artio.net/faqs/vm-invoice/how-to-disable-virtuemart-order-e-mails-and-invoices)
   
    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') ...




Wich I tried to change a bit into :
//edited:JEWEP: disable statusupdate e-mail to vendor. send only to customer. original code : ARTIO
if ($viewName=='invoice' AND in_array($vars['orderDetails']['details']['BT']->order_status, array('P','X','R','S')))
$user = null;
else
$user= self::sendVmMail($view, $recipient,$noVendorMail);
if (isset($view->doVendor) && !$recipient) {
self::sendVmMail($view, $view->vendorEmail, TRUE);
}
return $user ;

}


But this does not work. I think I messed up somewhere :-)
The idea is that the vendor only gets the confirmation email on status 'U', but the customer of course needs to get all of the emails upon changes on the status order.


Thanks for any and all replies in this matter....
;)




Hi,
Any idea what is 'BT' in the code above ?
It also appears in the email sent to vendor after a user registration & if not needed I want to remove it.
Thanks - Drukman.
Title: Re: VM 2.0 and emails : confirmation emails
Post by: jenkinhill on July 17, 2013, 11:23:51 AM
BT = Billing address  (Bill To)
Title: Re: VM 2.0 and emails : confirmation emails
Post by: AH on July 17, 2013, 13:16:56 PM
QuoteI want to do disable the emails to the vendor when the status of an order is changed.
    I found this code on this page : http://www.artio.net/faqs/vm-invoice/how-to-disable-virtuemart-order-e-mails-and-invoices

An upgrade to 2.0.22b will allow you by configuration to determine by order status e-mail activity
vendor/customer - neither, either or both for each status
Title: Re: VM 2.0 and emails : confirmation emails
Post by: drukman2000 on July 18, 2013, 10:56:54 AM
Quote from: jenkinhill on July 17, 2013, 11:23:51 AM
BT = Billing address  (Bill To)
Thanks,
It appears in the email sent to vendor but I couldn't find it in any of the .ini files.
Is it possible to translate it & where should the translation go ?
Thanks - Drukman.