Example #1
0
 public function checkoutMemberLogin()
 {
     $obj = new helpers();
     if ($obj->checkMemberLogin()) {
         return redirect('member-dashboard');
     }
     if ($obj->checkBrandLogin()) {
         return redirect('brand-dashboard');
     }
     if (Request::isMethod('post')) {
         $email = Request::input('email');
         $password = Request::input('password');
         $encrypt_pass = Hash::make($password);
         $login_arr = array('email' => $email, 'password' => $encrypt_pass);
         $users = DB::table('brandmembers')->where('email', $email)->where('role', 0)->first();
         // Only member Can Login here
         // print_r($_POST);exit;
         if ($users != "") {
             $user_pass = $users->password;
             // check for password
             if (Hash::check($password, $user_pass)) {
                 // Check for active
                 $user_cnt = DB::table('brandmembers')->where('email', $email)->where('status', 1)->where('admin_status', 1)->count();
                 //echo $user_cnt;exit;
                 //echo DB::enableQueryLog();exit;
                 if ($user_cnt) {
                     Session::put('member_userid', $users->id);
                     Session::put('member_user_email', $users->email);
                     Session::put('member_username', ucfirst($users->username));
                     Session::forget('step1');
                     Session::forget('guest_array');
                     Session::forget('guest');
                     Session::forget('step3');
                     //Set the user cart
                     $this->update_cart($users->id);
                     return redirect('/checkout');
                 } else {
                     $site = DB::table('sitesettings')->where('name', 'email')->first();
                     Session::flash('error', 'Your Status is inactive. Contact Admin at ' . $site->value . ' to get your account activated!');
                     return redirect('/checkout');
                 }
             } else {
                 Session::flash('error', 'Email and password does not match.');
                 return redirect('/checkout');
             }
         } else {
             Session::flash('error', 'This email-id is not register as a member.');
             return redirect('/checkout');
         }
     }
     return view('frontend.checkout.checkout_setp1', compact('body_class'), array('title' => 'MIRAMIX | checkout'));
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $obj = new helpers();
     if (!$obj->checkBrandLogin()) {
         $brandlogin = 0;
         // Logged as a member
     } else {
         $brandlogin = 1;
         // Logged as a brand
     }
     view()->share('brandlogin', $brandlogin);
 }
Example #3
0
 public function soldProducts()
 {
     $obj = new helpers();
     if (!$obj->checkBrandLogin()) {
         return redirect('brandLogin');
     }
     $brand_details = Brandmember::find(Session::get('brand_userid'));
     $limit = 2;
     $products = DB::table('products')->select(DB::raw('products.id,products.brandmember_id,products.product_name,products.product_slug,products.image1, SUM(order_items.`quantity`) as `sale_qty`,SUM(order_items.`price`) as `total_sale`'))->leftJoin('order_items', 'products.id', '=', 'order_items.product_id')->where('products.brandmember_id', '=', Session::get('brand_userid'))->whereRaw('products.active="1"')->where('products.is_deleted', 0)->where('products.discountinue', 0)->whereRaw('(order_items.`quantity`)>0')->groupBy('products.id')->paginate($limit);
     $products->setPath('sold-products');
     return view('frontend.brand.sold_product_history', compact('products', 'brand_details'), array('title' => 'Sold Product History'));
 }
Example #4
0
 public function checkoutStep4()
 {
     $obj = new helpers();
     if ($obj->checkMemberLogin() && !$obj->checkBrandLogin()) {
         $sitesettings = DB::table('sitesettings')->get();
         if (!empty($sitesettings)) {
             foreach ($sitesettings as $each_sitesetting) {
                 if ($each_sitesetting->name == 'shipping_rate') {
                     $shipping_rate = (int) $each_sitesetting->value;
                 }
             }
         }
         if (Request::isMethod('post')) {
             $shp_address = DB::table('addresses')->where('mem_brand_id', Session::get('member_userid'))->where('id', Session::get('selected_address_id'))->first();
             // Serialize the Shipping Address because If user delete there address from "addresses" table,After that the address also store in the "order" table for  getting order history//
             $shiping_address = array('address_title' => $shp_address->address_title, 'mem_brand_id' => $shp_address->mem_brand_id, 'first_name' => $shp_address->first_name, 'last_name' => $shp_address->last_name, 'email' => $shp_address->email, 'phone' => $shp_address->phone, 'address' => $shp_address->address, 'address2' => $shp_address->address2, 'city' => $shp_address->city, 'zone_id' => $shp_address->zone_id, 'country_id' => $shp_address->country_id, 'postcode' => $shp_address->postcode);
             $shiping_address_serial = serialize($shiping_address);
             $order = Order::create(['order_total' => Request::input('grand_total'), 'sub_total' => Request::input('sub_total'), 'order_status' => 'pending', 'shipping_address_id' => Session::get('selected_address_id'), 'shipping_cost' => $shipping_rate, 'shipping_type' => 'flat', 'user_id' => Session::get('member_userid'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_method' => Session::get('payment_method'), 'transaction_id' => '', 'transaction_status' => '', 'shiping_address_serialize' => $shiping_address_serial, 'created_at' => date('Y-m-d H:s:i'), 'updated_at' => date('Y-m-d H:s:i')]);
             $last_order_id = $order->id;
             $allCart = DB::table('carts')->where('user_id', Session::get('member_userid'))->get();
             foreach ($allCart as $eachCart) {
                 $product_details = DB::table('products')->where('id', $eachCart->product_id)->first();
                 // echo $each_content->brandmember_id; exit;
                 $brandmember_deatils = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $eachCart->product_id)->first();
                 //echo "<pre>";print_r($brandmember_deatils); exit;
                 //echo $brandmember->slug ; exit;
                 $brand_member_name = $brandmember_deatils->fname ? $brandmember_deatils->fname . ' ' . $brandmember_deatils->lname : $brandmember_deatils->username;
                 $formfactor = DB::table('form_factors')->where('id', '=', $eachCart->form_factor)->first();
                 $order_item = OrderItems::create(['order_id' => $last_order_id, 'brand_id' => $brandmember_deatils->brandmember_id, 'brand_name' => $brand_member_name, 'product_id' => $eachCart->product_id, 'product_name' => $eachCart->product_name, 'product_image' => $product_details->image1, 'quantity' => $eachCart->quantity, 'price' => $eachCart->amount, 'form_factor_id' => $formfactor->id, 'form_factor_name' => $formfactor->name]);
                 // All Cart deleted from cart table after inserting all data to order and order_item table.
                 //$deleteCart =  Cart::where('user_id', '=', Session::get('member_userid'))->delete();
             }
             if (Session::get('payment_method') == 'creditcard') {
                 return redirect('/checkout-authorize/' . $last_order_id);
             } elseif (Session::get('payment_method') == 'paypal') {
                 return redirect('/checkout-paypal/' . $last_order_id);
             }
         }
         // All Cart Contain  In Session Will Display Here //
         $content = DB::table('carts')->where('user_id', Session::get('member_userid'))->get();
         //echo "<pre>";print_r($content); exit;
         foreach ($content as $each_content) {
             $product_res = DB::table('products')->where('id', $each_content->product_id)->first();
             // echo $each_content->brandmember_id; exit;
             $brandmember = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $each_content->product_id)->first();
             //echo "<pre>";print_r($brandmember);
             //echo $brandmember->slug ; exit;
             $brand_name = $brandmember->fname ? $brandmember->fname . ' ' . $brandmember->lname : $brandmember->username;
             $formfactor = DB::table('form_factors')->where('id', '=', $each_content->form_factor)->first();
             $formfactor_name = $formfactor->name;
             $formfactor_id = $formfactor->id;
             $cart_result[] = array('rowid' => $each_content->row_id, 'product_name' => $each_content->product_name, 'product_slug' => $brandmember->product_slug, 'product_image' => $product_res->image1, 'qty' => $each_content->quantity, 'price' => $each_content->amount, 'duration' => $each_content->duration, 'formfactor_name' => $formfactor_name, 'formfactor_id' => $formfactor_id, 'brand_name' => $brand_name, 'brand_slug' => $brandmember->slug, 'subtotal' => $each_content->sub_total);
         }
         //echo "sph= ".$shipping_rate; exit;
         return view('frontend.checkout.checkout_setp4', compact('body_class', 'cart_result', 'shipping_rate'), array('title' => 'MIRAMIX | Checkout-Step4'));
     } else {
         redirect('/checkout-step1');
     }
 }
Example #5
0
 public function allProductByBrand()
 {
     $obj = new helpers();
     if (!$obj->checkBrandLogin()) {
         return redirect('brandLogin');
     }
     // Check if brand subscription expires show message
     $subscription_status = 'active';
     $brand_details = Brandmember::find(Session::get('brand_userid'));
     if ($brand_details->subscription_status != "active") {
         $subscription_status = 'inactive';
     }
     $limit = 10;
     //echo "hello= " . Session::get('brand_userid');
     $product = DB::table('products')->select(DB::raw('products.id,products.brandmember_id,products.script_generated,products.product_name,products.product_slug,products.image1, MIN(`actual_price`) as `min_price`,MAX(`actual_price`) as `max_price`'))->leftJoin('product_formfactors', 'products.id', '=', 'product_formfactors.product_id')->where('products.brandmember_id', '=', Session::get('brand_userid'))->where('products.active', 1)->where('product_formfactors.actual_price', '!=', 0)->where('products.is_deleted', 0)->where('products.discountinue', 0)->groupBy('product_formfactors.product_id')->paginate($limit);
     // echo "<pre>";print_r($product); exit;
     return view('frontend.product.my_product', compact('product', 'subscription_status'), array('title' => 'MIRAMIX | Brand Listing'));
 }
Example #6
0
 public function subscriptionHistory()
 {
     $obj = new helpers();
     if (!$obj->checkBrandLogin()) {
         return redirect('brandLogin');
     }
     $limit = 5;
     // $subscription = DB::table('subscription_history')->where('member_id', Session::get('brand_userid'))->orderBy('end_date','DESC')->get();
     $subscription = Subscription::with('getSubMembers')->where("member_id", Session::get('brand_userid'))->orderBy('end_date', 'DESC')->paginate($limit);
     $brand = Brandmember::find(Session::get('brand_userid'));
     return view('frontend.brand.subscription_history', compact('brand', 'subscription'), array('title' => 'Subscription History'));
 }
Example #7
0
 public function showAllCart()
 {
     /*----- Only Member Will Access This Page ----*/
     $obj = new helpers();
     if (!$obj->checkMemberLogin() && $obj->checkBrandLogin()) {
         return redirect('home');
     }
     //$content = Cart::content();
     $content = $obj->content();
     //echo "<pre>";print_r($content);exit;
     /* Site Setting Start */
     $sitesettings = DB::table('sitesettings')->get();
     $all_sitesetting = array();
     foreach ($sitesettings as $each_sitesetting) {
         $all_sitesetting[$each_sitesetting->name] = $each_sitesetting->value;
     }
     foreach ($content as $each_content) {
         $product_res = DB::table('products')->where('id', $each_content->id)->first();
         // echo $each_content->brandmember_id; exi
         $brandmember = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $each_content->id)->first();
         //echo "<pre>";print_r($brandmember);
         //echo $brandmember->slug ; exit;
         $brand_name = $brandmember->fname ? $brandmember->fname . ' ' . $brandmember->lname : $brandmember->username;
         $formfactor = DB::table('form_factors')->where('id', '=', $each_content->options->form_factor)->first();
         $formfactor_name = $formfactor->name;
         $formfactor_id = $formfactor->id;
         /* Discount Share Start */
         // $user_share = DB::table('product_shares')
         //                     ->where('user_email','=',Session::get('member_user_email'))
         //                     ->where('product_id','=',$each_content->id)
         //                     ->count();
         //print_r($user_share); exit;
         if (Session::has('product_id')) {
             $share_discount = $all_sitesetting['discount_share'];
         } else {
             $share_discount = '';
         }
         /* Discount Share End */
         $cart_result[] = array('rowid' => $each_content->rowid, 'product_name' => $each_content->name, 'product_slug' => $brandmember->product_slug, 'product_image' => $product_res->image1, 'qty' => $each_content->qty, 'price' => $each_content->price, 'duration' => $each_content->options->duration, 'formfactor_name' => $formfactor_name, 'formfactor_id' => $formfactor_id, 'brand_name' => $brand_name, 'brand_slug' => $brandmember->slug, 'share_discount' => $share_discount, 'subtotal' => $each_content->subtotal);
     }
     $cartcontent = Cart::content();
     $member = array();
     $redemctrl = array("min" => 5, "max" => 100, "step" => 5);
     if (Session::has('member_userid')) {
         $member = DB::table('brandmembers')->where("id", Session::get('member_userid'))->first();
         $setting_point = DB::table('sitesettings')->where('name', 'points_for_price')->first();
         $step = $member->user_points;
         $redemctrl = array("min" => $setting_point->value, "max" => $step, "step" => $setting_point->value);
     }
     return view('frontend.product.showAllCart', compact('cart_result', 'cartcontent', 'member', 'redemctrl'), array('title' => 'cart product'));
 }
Example #8
0
 public function brand_login()
 {
     //echo Hash::make(123456); exit;
     $obj = new helpers();
     if ($obj->checkMemberLogin()) {
         return redirect('member-dashboard');
     }
     if ($obj->checkBrandLogin()) {
         return redirect('brand-dashboard');
     }
     if (Request::isMethod('post')) {
         $email = Request::input('email');
         $password = Request::input('password');
         $users = DB::table('brandmembers')->where('email', $email)->where('role', 1)->first();
         if ($users != "") {
             $user_pass = $users->password;
             // check for password
             if (Hash::check($password, $user_pass)) {
                 // Check for active
                 $user_cnt = DB::table('brandmembers')->where('email', $email)->where('status', 1)->count();
                 if ($user_cnt) {
                     // Check for remember me
                     if (Request::input('remember_me') == 1) {
                         Cookie::queue(Cookie::make('brand_email', Request::input('email'), 60 * 24 * 30));
                     }
                     Session::put('brand_userid', $users->id);
                     Session::put('brand_user_email', $users->email);
                     return redirect('brand-dashboard');
                 } else {
                     Session::flash('error', 'Your Status is inactive. Contact Admin to activated your account');
                     return redirect('brandLogin');
                 }
             } else {
                 Session::flash('error', 'Email and password does not match.');
                 return redirect('brandLogin');
             }
         } else {
             Session::flash('error', 'Email and password does not match.');
             return redirect('brandLogin');
         }
     }
     // check for remenber me cookie
     $brand_email = '';
     $brand_email = Cookie::get('brand_email');
     return view('frontend.home.brand_login', compact('brand_email'), array('title' => 'MIRAMIX | Brand Login'));
 }
Example #9
0
 public function brand_login()
 {
     if (substr($_SERVER['SERVER_NAME'], 0, 4) != "www." && $_SERVER['SERVER_NAME'] != '192.168.1.112' && $_SERVER['SERVER_NAME'] != 'localhost') {
         header('Location: http://www.' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
     }
     /*if( ! Request::secure() )
     	{
     	    return Redirect::secure( Request::path() );
     	}*/
     $obj = new helpers();
     if ($obj->checkMemberLogin()) {
         return redirect('member-dashboard');
     }
     if ($obj->checkBrandLogin()) {
         return redirect('brand-dashboard');
     }
     Session::put('member_type', 1);
     if (Request::isMethod('post')) {
         $email = Request::input('email');
         $password = Request::input('password');
         $users = DB::table('brandmembers')->where('email', $email)->where('role', 1)->first();
         if ($users != "") {
             $user_pass = $users->password;
             // check for password
             if (Hash::check($password, $user_pass)) {
                 // Check for active
                 $user_cnt = DB::table('brandmembers')->where('email', $email)->where('status', 1)->count();
                 if ($user_cnt) {
                     $this->check_subscription($users);
                     // Check for remember me
                     if (Request::input('remember_me') == 1) {
                         Cookie::queue(Cookie::make('brand_email', Request::input('email'), 60 * 24 * 30));
                     }
                     Session::put('brand_userid', $users->id);
                     Session::put('brand_user_email', $users->email);
                     Session::put('brand_username', ucfirst($users->username));
                     return redirect('brand-dashboard');
                 } else {
                     Session::flash('error', 'Your Status is inactive. Contact Admin to activated your account');
                     return redirect('brandLogin');
                 }
             } else {
                 Session::flash('error', 'Email and password does not match.');
                 return redirect('brandLogin');
             }
         } else {
             Session::flash('error', 'Email and password does not match.');
             return redirect('brandLogin');
         }
     }
     // check for remenber me cookie
     $brand_email = '';
     $brand_email = Cookie::get('brand_email');
     $subfee = DB::table('sitesettings')->where('name', 'brand_fee')->first();
     $subprofee = DB::table('sitesettings')->where('name', 'brand_perproduct_fee')->first();
     return view('frontend.home.brand_login', compact('brand_email', 'subfee', 'subprofee'), array('title' => 'MIRAMIX | Brand Login'));
 }