Exemplo n.º 1
0
 public function populateRecentPurchasesAndReviews($p_id, $u_id)
 {
     $recent_purchases = array();
     $d_arr = MpFeedbackItem::whereRaw('feedback_item_id = ? AND feedback_user_id != ? AND item_type = ?', array($p_id, $u_id, 'product'))->get(array('feedback_comment', 'feedback_status', 'feedback_user_id', DB::raw('DATE_FORMAT(date_added, "%b %d, %Y") AS date_added')));
     $inc = 0;
     foreach ($d_arr as $data) {
         $posted_user_details = CUtil::getUserDetails($data['feedback_user_id']);
         $recent_purchases[$inc]['posted_by'] = $posted_user_details['display_name'];
         $recent_purchases[$inc]['date_added'] = $data['date_added'] != '' ? $data['date_added'] : '-';
         $recent_purchases[$inc]['profile_url'] = $posted_user_details['profile_url'];
         $recent_purchases[$inc]['icon'] = CUtil::getUserPersonalImage($data['feedback_user_id']);
         $recent_purchases[$inc]['feedback_comment'] = $data['feedback_comment'];
         $recent_purchases[$inc]['show_more_notes'] = 0;
         $recent_purchases[$inc]['feedback_comment_full'] = CUtil::makeClickableLinks(nl2br($data['feedback_comment']));
         if (strlen($data['feedback_comment']) > 250) {
             $recent_purchases[$inc]['feedback_comment'] = CUtil::wordWrap($data['feedback_comment'], 250);
             $recent_purchases[$inc]['show_more_notes'] = 1;
         }
         $recent_purchases[$inc]['feedback_status'] = $data['feedback_status'];
         $inc++;
     }
     return $recent_purchases;
 }
Exemplo n.º 2
0
 public function sendProductMailToUserAndAdmin($p_id, $user_notes = '')
 {
     $product_details = Product::where('id', $p_id)->first();
     $user_details = CUtil::getUserDetails($product_details->product_user_id);
     $product_code = $product_details->product_code;
     $url_slug = $product_details->url_slug;
     $view_url = $this->getProductViewURL($p_id, $product_details);
     $subject = trans('webshoppack::product.product_created_published');
     if ($product_details['product_status'] == 'ToActivate') {
         $subject = trans('webshoppack::product.product_created_to_activate');
     } elseif ($product_details['product_status'] == 'NotApproved') {
         $subject = trans('webshoppack::product.product_created_disapprove');
     }
     $data = array('product_code' => $product_details['product_code'], 'product_name' => $product_details['product_name'], 'url_slug' => $product_details['url_slug'], 'product_description' => CUtil::wordWrap($product_details['product_description'], 300), 'product_user_id' => $product_details['product_user_id'], 'is_free_product' => $product_details['is_free_product'], 'product_status' => $product_details['product_status'], 'product_status_lang' => $this->getProductStatusLang($product_details['product_status']), 'product_tags' => $product_details['product_tags'], 'display_name' => $user_details['display_name'], 'user_email' => $user_details['email'], 'view_url' => $view_url, 'subject' => $subject, 'user_notes' => $user_notes);
     //Mail to User
     \Mail::send('webshoppack::emails.productCreated', $data, function ($m) use($data) {
         $m->to($data['user_email']);
         $m->subject($data['subject']);
     });
     $this->sendNotificationMailForAdmin($p_id, compact('product_details', 'user_details'));
 }