News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Notification on customer review

Started by flaterik, June 29, 2012, 15:00:07 PM

Previous topic - Next topic

flaterik

Hi people, i notice that after a customer review, no mail was sended to shop administrator.
Is possibile to receive email on every review?

Thanks

Maggy29

I ran into an older post where a fix was applied for the same problem in VM 1.1.8 http://forum.virtuemart.net/index.php?topic=82660.0).
Maybe a same sort of fix should be applied in components/com_virtuemart/controllers/productdetails.php?

I'm trying to solve the same problem.

alatak

Hello

QuoteHi people, i notice that after a customer review, no mail was sended to shop administrator.
Is possibile to receive email on every review?
Yes you are rigth it is a good idea.

Maggy29

Well, I think the change should be made in administrator/components/com_virtuemart/models/ratings.php.

The next problem I run into is that I can't find the Virtuemart/Joomla function to send the actual mail. Anyone?

Maggy29

Well, this is the code I included in administrator/components/com_virtuemart/models/ratings.php, after
$reviewTable = $this->getTable('rating_reviews');
      $reviewTable->bindChecknStore($data,true);


insert:
$mail_subject = "Product Review Notification";
$mail_body = "A customer just posted a review on one product. Go to " .$mosConfig_sitename. " > Components > VirtueMart > Produits > Customer Reviews to edit it or to moderate it,\n";
$mail_body .= "or if you are already logged in the back end, you can read it here: \n";
$mail_body .= $mosConfig_live_site. "/administrator/administrator/index.php?option=com_virtuemart&view=ratings";
$mail_body = html_entity_decode( $mail_body );

$mailer =& JFactory::getMailer();
$config =& JFactory::getConfig();
$sender = array(
    $config->getValue( 'config.mailfrom' ),
    $config->getValue( 'config.fromname' ) );

$mailer->setSender($sender);
$recipient = $sender[0];

$mailer->addRecipient($recipient);
$mailer->setSubject($mail_subject);
$mailer->setBody($mail_body);

$send =& $mailer->Send();
if ( $send !== true ) {
    echo 'Error sending email: ' . $send->message;
} else {
    echo 'Mail sent';
}


Remark: the sender and recipient are both the same: the administrator.

warningdang

Quote from: Maggy29 on July 19, 2012, 21:40:34 PM
Well, this is the code I included in administrator/components/com_virtuemart/models/ratings.php, after
$reviewTable = $this->getTable('rating_reviews');
      $reviewTable->bindChecknStore($data,true);


insert:
$mail_subject = "Product Review Notification";
$mail_body = "A customer just posted a review on one product. Go to " .$mosConfig_sitename. " > Components > VirtueMart > Produits > Customer Reviews to edit it or to moderate it,\n";
$mail_body .= "or if you are already logged in the back end, you can read it here: \n";
$mail_body .= $mosConfig_live_site. "/administrator/administrator/index.php?option=com_virtuemart&view=ratings";
$mail_body = html_entity_decode( $mail_body );

$mailer =& JFactory::getMailer();
$config =& JFactory::getConfig();
$sender = array(
    $config->getValue( 'config.mailfrom' ),
    $config->getValue( 'config.fromname' ) );

$mailer->setSender($sender);
$recipient = $sender[0];

$mailer->addRecipient($recipient);
$mailer->setSubject($mail_subject);
$mailer->setBody($mail_body);

$send =& $mailer->Send();
if ( $send !== true ) {
    echo 'Error sending email: ' . $send->message;
} else {
    echo 'Mail sent';
}


Remark: the sender and recipient are both the same: the administrator.

Worked for me with Virtuemart 2.0.8d

Thanks for this solution

4est

thanks, I just implemented this on vm2.0.18a, hope it works

4est

It does not appear to work on vm 2.0.18a
I get no errors when I add the review, but no email either

m.davide82

It works but how can I insert the name and the link of the product inside?

m.davide82


lindapowers

Oops just found there was another topic about an issue I just posted.

Was this ever developed or included in VM2? cause im not getting any e-mail in 2.024C

Regards