This commit is contained in:
sriramv 2023-06-05 15:33:24 +05:30
parent 36c630e981
commit 815efbda6e
6 changed files with 37 additions and 13 deletions

View File

@ -54,6 +54,7 @@ class Member_controller extends BaseController
$token = $this->session->get("token");
$this->session->set('logged_user',$memberdata['id']);
$this->session->set('logged_user_name',$memberdata['name']);
$this->session->set('logged_user_email',$memberdata['email']);
if ($token)
{
$tokendata = $this->Cart_token_model->where('md5(token)', $token )->findAll();

View File

@ -264,7 +264,7 @@ class PaymentController extends BaseController
{
if( $transaction_id != null)
$memberCredits = $this->creditsModel->where('transaction_id', $transaction_id )
@ -273,6 +273,9 @@ class PaymentController extends BaseController
->selectSum('cost', 'cost')
->selectCount('package_name', 'pack_count')
->groupBy('package_name')->findAll();
$sendmail_controller = new Sendmail_controller();
$sendmail_controller->index(session()->get('logged_user_email') , null , 5);
$Subtotal = 0;
foreach ($memberCredits as $key => $ele) {
$Subtotal = $Subtotal + $ele['cost'];

View File

@ -9,6 +9,7 @@ use App\Models\Packages_and_pricing_model;
use App\Models\Credits_usage_tracking_model;
use App\Models\Email_template_model;
use App\Models\Member_model;
use App\Models\transaction_model;
class Sendmail_controller extends BaseController
{
@ -24,11 +25,13 @@ class Sendmail_controller extends BaseController
$this->PackagesModel = new Packages_and_pricing_model();
$this->CreditsUsageTrackingModel = new Credits_usage_tracking_model();
$this->MailModel = new Email_template_model();
$this->TransactionModel = new transaction_model();
helper(['form', 'url']);
}
public function index($to,$code,$return)
{
try{
$email = \Config\Services::email();
$email->setFrom('suseendhiran.1702117@srit.org', 'suseendhiran');
$email->setTo($to);
@ -147,17 +150,28 @@ class Sendmail_controller extends BaseController
// payment => type 5
else if($return == 5)
{
$user_data = $this->UserModel->where('email', $to)->find();
$data['id'] = '3';
$data['username'] = $to;
$data['password'] = $code;
$data['url'] = base_url()."admin";
$temp_data = $this->MailModel->where('type' , 2)->where('is_active' , 1)->find();
$TransactionData = $this->TransactionModel->where('member_id', session()->get('logged_user'))->orderBy('created_at', 'DESC')->first();
$Transaction_id = $TransactionData['transaction_id'];
$timestamp = strtotime($TransactionData['created_at']);
$Transaction_date = date('l, F j, Y', $timestamp);
$amount = json_decode($TransactionData['transaction'] , true)['payment']['amount_money']['amount'];
$payment_method = json_decode($TransactionData['transaction'] , true)['payment']['source_type'];
$data['id'] = $return;
$temp_data = $this->MailModel->where('type' , $return)->where('is_active' , 1)->find();
if ($temp_data[0]['to'])
$email->setCC($temp_data[0]['to']);
if ($temp_data)
$data['html'] = str_replace("%name%",$user_data[0]['name'],$temp_data[0]['html']);
if ($temp_data) {
$data['html'] = str_replace("%name%",session()->get('logged_user_name'),$temp_data[0]['html']);
$data['html'] = str_replace("%id%",$Transaction_id,$temp_data[0]['html']);
$data['html'] = str_replace("%method%",$payment_method,$temp_data[0]['html']);
$data['html'] = str_replace("%date%", $Transaction_date,$temp_data[0]['html']);
$data['html'] = str_replace("%amount%",$amount,$temp_data[0]['html']);
$message = view('verification_mail_temp',$data);
}
if ($temp_data[0]['is_active'] == 1)
$email->setSubject($temp_data[0]['subject']);
else
@ -174,9 +188,12 @@ class Sendmail_controller extends BaseController
}
else
{
echo 0;
$error = $email->printDebugger();
echo 'Email sending failed: ' . $error;
}
} catch (EmailException $e) {
echo 'Email sending failed: ' . $e->getMessage();
}
}
public function verify_email($verification_code)

View File

@ -12,6 +12,7 @@ use App\Models\Variable_model;
use App\Models\Rule_model;
use App\Models\Cart_token_model;
use App\Models\Cart_model;
use App\Models\transaction_model;
class Test_controller extends BaseController
{
public $session;
@ -29,11 +30,13 @@ class Test_controller extends BaseController
$this->RuleModel = new Rule_model();
$this->Cart_token_model = new Cart_token_model();
$this->cartModel = new Cart_model();
$this->TransactionModel = new transaction_model();
helper(['form', 'url']);
}
public function index($token = null)
{
$count = $this->request->getVar('count');
foreach ($count as $key => $value)
{

View File

@ -63,7 +63,7 @@
<div class="form-group mb-3">
<label for="emailaddress">Email address</label>
<input class="form-control" type="email" name="email" id="emailaddress" required="" value="gwm@gmail.com" placeholder="Enter your email">
<input class="form-control" type="email" name="email" id="emailaddress" required="" value="gowthamceline46@gmail.com" placeholder="Enter your email">
</div>
<div class="form-group mb-3">

View File

@ -123,7 +123,7 @@ bgcolor="#f6f6f6">
<td class="content-block"
style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;"
valign="top">
Your password changed successfully...
Dear Customer,Thank you for your payment. We are pleased to inform you that your payment has been successfully processed.
</td>
</tr>
<?php } ?>