Merge branch 'master' of github.com:franknstayn/crewsportswear
This commit is contained in:
@@ -307,24 +307,44 @@ class PaypalController extends Controller {
|
|||||||
$array_payment_details = $newUserModel->selectPaymentDetails('CartKey', $cartKey);
|
$array_payment_details = $newUserModel->selectPaymentDetails('CartKey', $cartKey);
|
||||||
$array_storename = $newUserModel->selectTeamStoreName($cartKey); // email subject
|
$array_storename = $newUserModel->selectTeamStoreName($cartKey); // email subject
|
||||||
|
|
||||||
|
|
||||||
foreach($array_storename as $storname){
|
foreach($array_storename as $storname){
|
||||||
|
|
||||||
$sName[] = $storname->StoreName;
|
$sName[] = $storname->StoreName;
|
||||||
|
$sid[] = $storname->Id;
|
||||||
}
|
}
|
||||||
$sName = implode (", ", $sName);
|
$sName = implode (", ", $sName);
|
||||||
|
|
||||||
|
|
||||||
|
$user_loginsArray = $newUserModel->selectUserLoginsWhereIn($sid);
|
||||||
|
|
||||||
|
foreach($user_loginsArray as $userdata){
|
||||||
|
|
||||||
|
$other_email[] = $userdata->other_email;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($other_email[0] != null){
|
||||||
|
$other_email = implode (", ", $other_email);
|
||||||
|
$email_cc = "orders@crewsportswear.com" . "," . $other_email;
|
||||||
|
}else{
|
||||||
|
$email_cc = "orders@crewsportswear.com";
|
||||||
|
}
|
||||||
|
|
||||||
|
$explode_other_email = explode(",", $email_cc);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'order_item_array' => $order_item_array,
|
'order_item_array' => $order_item_array,
|
||||||
'item_goup_array' => $item_goup_array,
|
'item_goup_array' => $item_goup_array,
|
||||||
'img_thumb' => $item_thumbs,
|
'img_thumb' => $item_thumbs,
|
||||||
'array_payment_details' => $array_payment_details,
|
'array_payment_details' => $array_payment_details,
|
||||||
'receiver' => $user_email,
|
'receiver' => $user_email,
|
||||||
|
'email_cc' => $explode_other_email,
|
||||||
'subject' => $sName . ' ORDERS',
|
'subject' => $sName . ' ORDERS',
|
||||||
);
|
);
|
||||||
|
|
||||||
Mail::send('emails.orders', $data, function($message) use ($data) {
|
Mail::send('emails.orders', $data, function($message) use ($data) {
|
||||||
$message->from('no-reply@crewsportswear.com', 'CREW Sportswear');
|
$message->from('no-reply@crewsportswear.com', 'CREW Sportswear');
|
||||||
$message->cc('orders@crewsportswear.com', 'Orders From CREW Sportswear');
|
$message->bcc($data['email_cc'], 'Orders From CREW Sportswear');
|
||||||
$message->to($data['receiver'])->subject($data['subject']);
|
$message->to($data['receiver'])->subject($data['subject']);
|
||||||
});
|
});
|
||||||
// end email sending
|
// end email sending
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class UserModel extends Model {
|
|||||||
|
|
||||||
function selectProfileInfo($id){
|
function selectProfileInfo($id){
|
||||||
|
|
||||||
$i = DB::table('user_logins')->select('user_logins.name', 'user_logins.username', 'user_logins.email', 'user_logins.email_is_verified', 'user_logins.role', 'user_logins.store_id', 'user_info.ContactNumber', 'user_info.Gender', 'user_info.Birthday')
|
$i = DB::table('user_logins')->select('user_logins.name', 'user_logins.username', 'user_logins.email', 'user_logins.email_is_verified','user_logins.other_email', 'user_logins.role', 'user_logins.store_id', 'user_info.ContactNumber', 'user_info.Gender', 'user_info.Birthday')
|
||||||
->leftjoin('user_info', 'user_info.UserId','=','user_logins.id')
|
->leftjoin('user_info', 'user_info.UserId','=','user_logins.id')
|
||||||
->where('user_logins.id','=',$id)
|
->where('user_logins.id','=',$id)
|
||||||
->get();
|
->get();
|
||||||
@@ -254,12 +254,14 @@ class UserModel extends Model {
|
|||||||
|
|
||||||
function selectTeamStoreName($ck){
|
function selectTeamStoreName($ck){
|
||||||
$pdo = DB::connection()->getPdo();
|
$pdo = DB::connection()->getPdo();
|
||||||
$query = $pdo->prepare("SELECT t.StoreName FROM orders AS o INNER JOIN teamstores AS t ON t.Id = o.StoreId WHERE o.CartKey = :ck GROUP BY o.StoreId ORDER BY t.StoreName ASC");
|
$query = $pdo->prepare("SELECT t.Id, t.StoreName FROM orders AS o INNER JOIN teamstores AS t ON t.Id = o.StoreId WHERE o.CartKey = :ck GROUP BY o.StoreId ORDER BY t.StoreName ASC");
|
||||||
$query->execute(array(':ck'=>$ck));
|
$query->execute(array(':ck'=>$ck));
|
||||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function updateActiveThumb($id, $product_id){
|
function updateActiveThumb($id, $product_id){
|
||||||
DB::table('teamstore_product_thumbnails')->where('ProductId', $product_id)
|
DB::table('teamstore_product_thumbnails')->where('ProductId', $product_id)
|
||||||
->update(['ImageClass' => null]);
|
->update(['ImageClass' => null]);
|
||||||
@@ -292,4 +294,11 @@ class UserModel extends Model {
|
|||||||
->get();
|
->get();
|
||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectUserLoginsWhereIn($ids){
|
||||||
|
$i = DB::table('user_logins')
|
||||||
|
->whereIn('store_id', $ids)
|
||||||
|
->get();
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user