VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: conejo on March 10, 2014, 14:54:59 PM

Title: recommend form: How to Add an additional email recipient
Post by: conejo on March 10, 2014, 14:54:59 PM
Hello together!
I´m working with Joomla! 2.5.11 / VM2.0.24c
on file ..//mytemplate/html/com_virtuemart/recommend/form.php

I want to add a custom field like in topic  "How to add Custom Fields to "Ask A Question../Call for Price" ??"
but in my case must be an additional email recipient.
This field must be optional. It is for example to send to my self or any body else a copy of the recommendation.

Many thanks for a replay,
Alejandro

Title: Re: recommend form: override controllers/productdetails.php
Post by: conejo on March 19, 2014, 11:13:51 AM
its me again:

I found out that the "recommend" email will be send in components/com_virtuemart/controllers/productdetails.php controller:
I thing that the solution is to override the file and send a second mail after following code:
Line 199:
      $toMail = JRequest::getVar ('email'); //is sanitized then
      $toMail = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $toMail);

      if (shopFunctionsF::renderMail ('recommend', $toMail, $vars, 'productdetails', TRUE)) {
         $string = 'COM_VIRTUEMART_MAIL_SEND_SUCCESSFULLY';
      } else {
         $string = 'COM_VIRTUEMART_MAIL_NOT_SEND_SUCCESSFULLY';
      }

For example adding following code...
        $tocopymail = JRequest::getVar ('tocopymail'); //is sanitized then
   $tocopymail = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $tocopymail);
   shopFunctionsF::renderMail ('recommend', $tocopymail, $vars, 'productdetails', TRUE)

My problem is that I can´t override the controller and I´m not sure if this is the correct solution of this problem:
I tried following:
//My-template/html/com_virtuemart/controllers/productdetails.php
//My-template/code/com_virtuemart/controllers/productdetails.php
And some others but there change nothing.

Many thanks in advance for any help,

Alejandro

Note:
See the example in my page in http://cristinaloewy.de/werke/aktuelle-werke/415/fields-of-joy-detail (http://cristinaloewy.de/werke/aktuelle-werke/415/fields-of-joy-detail)
"Als E-Postkarte schicken" -> "Kopie an mein E-Mail (optional):" .

Thanks and regards

Alejandro


QuoteI need to do this before I update to the newest version!
Please help me!!

Thanks in advance,

Alejandro