Browse Source

Paiement en ligne : adaptation emails

refactoring
Guillaume 3 years ago
parent
commit
c46cd6d206
2 changed files with 39 additions and 3 deletions
  1. +12
    -0
      common/mail/paymentError-html.php
  2. +27
    -3
      producer/controllers/CreditController.php

+ 12
- 0
common/mail/paymentError-html.php View File

@@ -46,5 +46,17 @@ termes.

<p>Vous pouvez retrouver le lien de paiement dans votre <a href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['credit/history','slug_producer' => $producer->slug]) ?>">historique de commandes</a>.</p>

<?php $payment_infos = Producer::getConfig('option_payment_info') ; ?>
<?php if($payment_infos && strlen($payment_infos) > 0): ?>
<p><strong>Informations de paiement :</strong><br />
<?= nl2br(Html::encode($payment_infos)); ?></p>
<?php endif; ?>

<?php $order_infos = Producer::getConfig('order_infos') ; ?>
<?php if($order_infos && strlen($order_infos) > 0): ?>
<p><strong>Informations générales :</strong><br />
<?= nl2br(Html::encode($order_infos)); ?></p>
<?php endif; ?>

<p>À bientôt,<br />
<?= Html::encode($producer->name); ?></p>

+ 27
- 3
producer/controllers/CreditController.php View File

@@ -42,7 +42,9 @@ use common\helpers\GlobalParam;
use common\helpers\Mailjet;
use common\helpers\MeanPayment;
use common\models\CreditHistory;
use common\models\Distribution;
use common\models\Order;
use common\models\PointSale;
use common\models\UserProducer;
use producer\models\CreditForm;
use common\models\User;
@@ -250,8 +252,8 @@ class CreditController extends ProducerBaseController
$order->id_user
);

// envoi d'un email de confirmation de paiement
$paramsEmail = [
// client : envoi d'un email de confirmation de paiement
/*$paramsEmail = [
'from_email' => $producer->getEmailOpendistrib(),
'from_name' => $producer->name,
'to_email' => $user->email,
@@ -265,8 +267,30 @@ class CreditController extends ProducerBaseController
'producer' => $producer,
]
] ;
Mailjet::sendMail($paramsEmail);
Mailjet::sendMail($paramsEmail);*/

// producteur : mail de confirmation
$contactProducer = $producer->getMainContact();
$pointSale = PointSale::searchOne(['id' => $order->id_point_sale]);
$distribution = Distribution::find()->where(['id' => $order->id_distribution])->one();

$paramsEmail = [
'from_email' => $producer->getEmailOpendistrib(),
'from_name' => $producer->name,
'to_email' => $contactProducer->email,
'to_name' => $contactProducer->name,
'subject' => '[' . $producer->name . '] Confirmation de commande',
'content_view_text' => '@common/mail/orderConfirmProducer-text.php',
'content_view_html' => '@common/mail/orderConfirmProducer-html.php',
'content_params' => [
'order' => $order,
'pointSale' => $pointSale,
'distribution' => $distribution,
'user' => $user,
'producer' => $producer
]
];
Mailjet::sendMail($paramsEmail);
}
}
else {

Loading…
Cancel
Save