public function contactUs()
 {
     $member1 = Session::get('brand_userid');
     $member2 = Session::get('member_userid');
     if (!empty($member1)) {
         $memberdetail = Brandmember::find($member1);
     } elseif (!empty($member2)) {
         $memberdetail = Brandmember::find($member2);
     } else {
         $memberdetail = (object) array("email" => "", "fname" => "", "lname" => "");
     }
     if (Request::isMethod('post')) {
         $user_name = Request::input('contact_name');
         $user_email = Request::input('contact_email');
         $subject = Request::input('contact_subject');
         $cmessage = Request::input('message');
         $setting = DB::table('sitesettings')->where('name', 'email')->first();
         $admin_users_email = $setting->value;
         $sent = Mail::send('frontend.cms.contactemail', array('name' => $user_name, 'email' => $user_email, 'messages' => $cmessage), function ($message) use($admin_users_email, $user_email, $user_name) {
             $message->from($admin_users_email);
             $message->to($user_email, $user_name)->cc($admin_users_email)->subject(Request::input('contact_subject'));
         });
         if (!$sent) {
             Session::flash('error', 'something went wrong!! Mail not sent.');
             return redirect('contact-us');
         } else {
             Session::flash('success', 'Message is sent to admin successfully. We will getback to you shortly');
             return redirect('contact-us');
         }
     }
     return view('frontend.cms.contactus', compact('memberdetail'), array('title' => 'Miramix - Contact Us'));
 }
 public function store(Request $request)
 {
     $register = Request::all();
     //print_r($register);
     $obj = new helpers();
     if (Input::hasFile('image')) {
         $destinationPath = 'uploads/img/';
         // upload path
         $thumb_path = 'uploads/img/thumb/';
         $extension = Input::file('image')->getClientOriginalExtension();
         // getting image extension
         $fileName = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('image')->move($destinationPath, $fileName);
         // uploading file to given path
         $obj->createThumbnail($fileName, 300, 200, $destinationPath, $thumb_path);
     } else {
         $fileName = '';
     }
     $hashpassword = Hash::make($register['password']);
     $address = new Address();
     $brandmember = Brandmember::create(['fname' => $register['fname'], 'lname' => $register['lname'], 'email' => $register['email'], 'password' => $hashpassword, 'phone_no' => $register['phone_no'], 'pro_image' => $fileName, 'role' => 0, 'admin_status' => 1, 'updated_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s')]);
     $lastInsertedId = $brandmember->id;
     $address->mem_brand_id = $lastInsertedId;
     $address->address = $register['address'];
     $address->address2 = $register['address2'];
     $address->country_id = $register['country'];
     $address->zone_id = $register['state'];
     // State id
     $address->city = $register['city'];
     $address->postcode = $register['postcode'];
     if ($address->save()) {
         $addressId = $address->id;
         $dataUpdateAddress = DB::table('brandmembers')->where('id', $lastInsertedId)->update(['address' => $addressId]);
         $sitesettings = DB::table('sitesettings')->get();
         //exit;
         if (!empty($sitesettings)) {
             foreach ($sitesettings as $each_sitesetting) {
                 if ($each_sitesetting->name == 'email') {
                     $admin_users_email = $each_sitesetting->value;
                 }
             }
         }
         $user_name = $register['fname'] . ' ' . $register['lname'];
         $user_email = $register['email'];
         $activateLink = url() . '/activateLink/' . base64_encode($register['email']);
         $sent = Mail::send('frontend.register.activateLink', array('name' => $user_name, 'email' => $user_email, 'activate_link' => $activateLink), function ($message) use($admin_users_email, $user_email, $user_name) {
             $message->from($admin_users_email);
             $message->to($user_email, $user_name)->subject('Activate Profile Mail');
         });
         if (!$sent) {
             Session::flash('error', 'something went wrong!! Mail not sent.');
             return redirect('register');
         } else {
             Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.');
             return redirect('register');
         }
     }
 }
示例#3
0
 public function admin_inactive_status($id)
 {
     //echo $id;exit;
     $brandmember = Brandmember::find($id);
     $brandmember->admin_status = 0;
     $brandmember->update();
     //dd($brandmember);exit;
     Session::flash('success', 'Member status updated successfully');
     return redirect('admin/member');
 }
示例#4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function inventory()
 {
     $member1 = Session::get('brand_userid');
     if (!empty($member1)) {
         $memberdetail = Brandmember::find($member1);
     } else {
         $memberdetail = (object) array("email" => "", "fname" => "", "lname" => "");
     }
     if (Request::isMethod('post')) {
         $name = Request::input('name');
         $ingradient_name = Request::input('ingradient_name');
         $user_email = Request::input('contact_email');
         $subject = 'Request for ingredient';
         $cmessage = Request::input('request_ing');
         $setting = DB::table('sitesettings')->where('name', 'email')->first();
         $admin_users_email = $setting->value;
         $sent = Mail::send('frontend.inventory.ingredientemail', array('admin_users_email' => $admin_users_email, 'name' => $name, 'ingradient_name' => $ingradient_name, 'email' => $user_email, 'messages' => $cmessage), function ($message) use($admin_users_email, $user_email, $ingradient_name, $subject) {
             $message->from($admin_users_email);
             $message->to($user_email, $ingradient_name)->cc($admin_users_email)->subject($subject);
         });
         if (!$sent) {
             Session::flash('error', 'something went wrong!! Mail not sent.');
             return redirect('inventory');
         } else {
             Session::flash('success', 'Message is sent to admin successfully. We will getback to you shortly');
             return redirect('inventory');
         }
     }
     $start = 'a';
     $end = 'z';
     $pageindex = array();
     for ($i = $start; $i < $end; $i++) {
         $inv = DB::table('ingredients')->whereRaw(" name like '" . $i . "%'")->orderBy('name', 'ASC')->get();
         $pageindex[$i] = $inv;
     }
     $inv = DB::table('ingredients')->whereRaw(" name like 'z%'")->orderBy('name', 'ASC')->get();
     $pageindex['z'] = $inv;
     return view('frontend.inventory.inventory', compact('pageindex', 'memberdetail'), array('title' => 'Miramix Inventory'));
 }
示例#5
0
 public function productDetails($slug)
 {
     // Check if brand subscription expires show message
     $pro_dtls = DB::table('products')->where('product_slug', $slug)->first();
     if (!empty($pro_dtls)) {
         $pro_brand_memid = $pro_dtls->brandmember_id;
         $brand_details = Brandmember::find($pro_brand_memid);
         if ($brand_details->subscription_status != "active") {
             Session::flash('error', 'Subscription is over of this brand.');
             if (Session::has('brand_userid')) {
                 return redirect('my-products');
             } else {
                 return redirect('brand');
             }
         }
     }
     // echo $brand_details->subscription_status;exit;
     //$content = Cart::content();echo "<pre>";print_r($content);exit;
     $productdetails = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.business_name', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status', 'brandmembers.slug')->where('products.product_slug', '=', $slug)->where('products.active', 1)->where('products.is_deleted', 0)->where('brandmembers.status', 1)->where('brandmembers.admin_status', 1)->first();
     //echo "<pre/>";print_r($productdetails); exit;
     // Return to home page if the product is not active or deleted
     if (empty($productdetails)) {
         //return redirect('home');
         return view('frontend.product.restrictproductdetails', array('title' => 'Not Authorize Product Details'));
     }
     $productformfactor = DB::table('product_formfactors')->join('form_factors', 'form_factors.id', '=', 'product_formfactors.formfactor_id')->join('products', 'products.id', '=', 'product_formfactors.product_id')->select('product_formfactors.*', 'form_factors.name', 'form_factors.image', 'form_factors.price', 'form_factors.maximum_weight', 'form_factors.minimum_weight', 'products.product_name')->where('product_formfactors.product_id', '=', $productdetails->id)->where('product_formfactors.actual_price', '!=', 0)->where('products.active', 1)->orderBy('form_factors.name', 'asc')->get();
     // echo print_r(DB::enableQueryLog()); exit;
     //echo "<pre/>";print_r($productformfactor);exit;
     $timeduration = DB::table('time_durations')->where('status', 1)->get();
     $rating = DB::table('product_rating')->leftJoin('brandmembers', 'brandmembers.id', '=', 'product_rating.user_id')->select('product_rating.*', 'brandmembers.username')->where('product_rating.status', 1)->where('product_rating.product_id', $productdetails->id)->get();
     $product_id = $productdetails->id;
     // Get Related Product
     $related_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.active', 1)->where('product_formfactors.actual_price', '!=', 0)->where('products.is_deleted', 0)->where('products.related', 'yes')->groupBy('product_formfactors.product_id')->get();
     //echo "<pre/>";print_r($related_product); exit;
     return view('frontend.product.productdetails', compact('productdetails', 'productformfactor', 'timeduration', 'rating', 'product_id', 'related_product'), array('title' => 'Product Details'));
 }
示例#6
0
 public function editMemberShippingAddress()
 {
     $obj = new helpers();
     if (!$obj->checkMemberLogin()) {
         return redirect('memberLogin');
     }
     $id = Request::input('id');
     if (empty($id)) {
         return redirect('member-shipping-address');
     }
     $country = DB::table('countries')->orderBy('name', 'ASC')->get();
     $alldata = array();
     foreach ($country as $key => $value) {
         $alldata[$value->country_id] = $value->name;
     }
     if (Request::isMethod('post')) {
         $address = array();
         $address['mem_brand_id'] = Session::get('member_userid');
         $address['first_name'] = Request::input('first_name');
         $address['last_name'] = Request::input('last_name');
         $address['address'] = Request::input('address');
         $address['address2'] = Request::input('address2');
         $address['country_id'] = Request::input('country');
         $address['zone_id'] = Request::input('zone_id');
         // State id
         $address['city'] = Request::input('city');
         $address['postcode'] = Request::input('postcode');
         $address['phone'] = Request::input('phone');
         $address['email'] = Request::input('email');
         DB::table('addresses')->where('id', Request::input('id'))->update($address);
         if (Request::input('default_address') == '1') {
             $addressId = Request::input('id');
             $dataUpdateAddress = DB::table('brandmembers')->where('id', Session::get('member_userid'))->update(['address' => $addressId]);
         }
         Session::flash('success', 'Shipping Address successfully updated.');
         return redirect('member-shipping-address');
     }
     $address = DB::table('addresses')->find($id);
     $states = DB::table('zones')->where('country_id', $address->country_id)->orderBy('name', 'ASC')->get();
     $allstates = array();
     foreach ($states as $key => $value) {
         $allstates[$value->zone_id] = $value->name;
     }
     $member_details = Brandmember::find(Session::get('member_userid'));
     $total_add = DB::table('addresses')->where('mem_brand_id', Session::get('member_userid'))->where('id', '!=', $id)->count();
     return view('frontend.member.edit_member_shipping', compact('alldata', 'address', 'allstates', 'member_details', 'total_add'), array('title' => 'Edit Shipping Address'));
 }
示例#7
0
 public function sendpasswordmail()
 {
     //return false;
     $members = DB::table('brandmembers')->whereRaw('CHAR_LENGTH(password)<1')->get();
     foreach ($members as $member) {
         $brand = array();
         $fname = explode(" ", $member->fname);
         if (isset($fname[0]) && isset($fname[1])) {
             $brand = array("fname" => trim($fname[0]), "lname" => trim($fname[1]));
         }
         //echo $member->id;exit;
         $brandresult = Brandmember::find($member->id);
         $orgpass = uniqid();
         $password = Hash::make($orgpass);
         $brand["password"] = $password;
         $brand["status"] = '1';
         $brand["admin_status"] = '1';
         $brandresult->update($brand);
         $sitesettings = DB::table('sitesettings')->where("name", "email")->first();
         $admin_users_email = $sitesettings->value;
         $user_name = $member->fname . ' ' . $member->lname;
         $user_email = $member->email;
         if ($member->role == 0) {
             $activateLink = 'http://www.miramix.com/memberLogin/';
             $changepass_link = 'http://www.miramix.com/member-changepass/';
         } else {
             $activateLink = 'http://www.miramix.com/brandlogin/';
             $changepass_link = 'http://www.miramix.com/change-password/';
         }
         $pass = $orgpass;
         $userid = $member->email;
         $sent = Mail::send('frontend.register.newPassword', array('name' => $user_name, 'email' => $user_email, 'activate_link' => $activateLink, 'userid' => $userid, 'admin_users_email' => $admin_users_email, 'password' => $pass, 'changepass_link' => $changepass_link), function ($message) use($admin_users_email, $user_email, $user_name) {
             $message->from($admin_users_email);
             $message->to($user_email, $user_name)->subject('New password generated for site migration');
         });
         if (!$sent) {
             echo 'Unable to send email' . $member->id . ' <br />';
         } else {
             echo 'mail sent to ->' . $member->id . $member->email . "<br />";
         }
     }
     echo count($members);
 }
示例#8
0
 public function admin_inactive_status($id)
 {
     $brandmember = Brandmember::find($id);
     $brandmember->admin_status = 0;
     $brandmember->update();
     $sitesettings = DB::table('sitesettings')->where("name", "email")->first();
     $admin_users_email = $sitesettings->value;
     if ($brandmember->fname != '') {
         $user_name = $brandmember->fname . ' ' . $brandmember->lname;
     } else {
         $user_name = $brandmember->username;
     }
     $user_email = $brandmember->email;
     $msg = "Your account has been de-activated by admin.Please contact with miramix support.";
     $sent = Mail::send('admin.brands.activate_brand', array('name' => $user_name, 'email' => $user_email, 'admin_users_email' => $admin_users_email, 'msg' => $msg), function ($message) use($admin_users_email, $user_email, $user_name, $msg) {
         $message->from($admin_users_email);
         $message->to($user_email, $user_name)->subject('Miramix Brand Account Now Deactivated');
     });
     if (!$sent) {
         Session::flash('error', 'something went wrong!! Mail not sent.');
         return redirect('admin/brand');
     } else {
         Session::flash('success', 'Brand status updated successfully');
         return redirect('admin/brand');
     }
 }
示例#9
0
 public function checkoutStep4()
 {
     $obj = new helpers();
     $shp_address = array();
     $sitesettings = DB::table('sitesettings')->get();
     if (!empty($sitesettings)) {
         foreach ($sitesettings as $each_sitesetting) {
             if ($each_sitesetting->name == 'shipping_rate') {
                 $shipping_rate = (double) $each_sitesetting->value;
             }
             if ($each_sitesetting->name == 'free_discount_rate') {
                 $free_discount_rate = (double) $each_sitesetting->value;
             }
         }
     }
     if (Request::isMethod('post')) {
         Session::put('name_card', Input::get('name_card'));
         //Input::get('name_card');
         Session::put('card_number', Input::get('card_number'));
         //Input::get('card_number'); //"4042760173301988";//
         Session::put('card_exp_month', Input::get('card_exp_month'));
         // "03"; //
         Session::put('card_exp_year', Input::get('card_exp_year'));
         // "19"; //
         //checkout as guest
         if (!Session::has('member_userid')) {
             $guestdata = Session::get('guest_array');
             $shiping_address = array('address_title' => 'default address', 'first_name' => $guestdata["guest_fname"], 'last_name' => $guestdata["guest_lname"], 'email' => $guestdata["guest_email"], 'phone' => $guestdata["guest_phone"], 'address' => $guestdata["guest_address"], 'address2' => $guestdata["guest_address2"], 'city' => $guestdata["guest_city"], 'zone_id' => $guestdata["guest_state"], 'country_id' => $guestdata["guest_country_id"], 'postcode' => $guestdata["guest_zip_code"]);
             $want_reg = Request::input('register_user');
             if ($want_reg == 'register') {
                 //register the member
                 Session::put('guest_username_sess', Request::input('guest_username'));
                 $brandmember = Brandmember::create(['fname' => $guestdata['guest_fname'], 'lname' => $guestdata['guest_lname'], 'email' => $guestdata['guest_email'], 'username' => Request::input('guest_username'), 'password' => Hash::make(Request::input('guest_password')), 'role' => 0, 'admin_status' => 1, 'status' => 1, 'updated_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s')]);
                 $lastInsertedId = $brandmember->id;
                 $shiping_address['mem_brand_id'] = $brandmember->id;
                 $shp_address = Address::create($shiping_address);
                 $lastAddressId = DB::getPdo()->lastInsertId();
                 $user_id = $brandmember->id;
                 // Update Address id in brandmember table
                 $addressId = $shp_address->id;
                 $dataUpdateAddress = DB::table('brandmembers')->where('id', $brandmember->id)->update(['address' => $addressId]);
             } else {
                 //set userid for not loggedin users to pass the order
                 $user_id = NULL;
                 $shp_address['id'] = NULL;
                 $shp_address = (object) $shp_address;
                 //print_r($shp_address); exit;
             }
             // End of registration ==================================================
             /* To get the country code And Zone code */
             $shp_country = DB::table('countries')->where('country_id', $guestdata["guest_country_id"])->first();
             $shp_zone = DB::table('zones')->where('zone_id', $guestdata["guest_state"])->first();
             $shiping_address = array('address_title' => 'default address', 'first_name' => $guestdata["guest_fname"], 'last_name' => $guestdata["guest_lname"], 'email' => $guestdata["guest_email"], 'phone' => $guestdata["guest_phone"], 'address' => $guestdata["guest_address"], 'address2' => $guestdata["guest_address2"], 'city' => $guestdata["guest_city"], 'zone_id' => $shp_zone->code, 'country_id' => $shp_country->iso_code_3, 'postcode' => $guestdata["guest_zip_code"]);
             //print_r($shiping_address); exit;
             $shiping_address_serial = serialize($shiping_address);
         } else {
             //for logged-in users
             $shp_address = DB::table('addresses')->leftjoin('countries', 'countries.country_id', '=', 'addresses.country_id')->leftjoin('zones', 'zones.zone_id', '=', 'addresses.zone_id')->select('addresses.*', 'countries.name as country_name', 'countries.iso_code_3 as country_code', 'zones.name as zone_name', 'zones.code as zone_code')->where('mem_brand_id', Session::get('member_userid'))->where('id', Session::get('selected_address_id'))->first();
             //echo "<pre>111111";print_r($shp_address); exit;
             // 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_code, 'country_id' => $shp_address->country_code, 'postcode' => $shp_address->postcode);
             $shiping_address_serial = serialize($shiping_address);
             //echo "pm= ".Session::get('payment_method'); exit;
             $user_id = Session::get('member_userid');
         }
         $order = Order::create(['order_total' => Request::input('grand_total'), 'sub_total' => Request::input('sub_total'), 'discount' => Request::input('discount'), 'redeem_amount' => Request::input('redeem_amount'), 'order_status' => 'pending', 'shipping_address_id' => $shp_address->id, 'shipping_cost' => Request::input('shipping_rate'), 'shipping_type' => 'flat', 'user_id' => $user_id, '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;
         $obj = new helpers();
         $order_number = 'ORD-' . $obj->random_string(5) . '-' . $last_order_id;
         // Generate random String for order number
         $update_order_number = DB::table('orders')->where('id', $last_order_id)->update(['order_number' => $order_number]);
         Session::put('order_number', $order_number);
         Session::put('order_id', $last_order_id);
         ///we are not storing new registered cart in cart table as it will be destroyed soon
         if (Session::has('member_userid')) {
             $allCart = DB::table('carts')->where('user_id', Session::get('member_userid'))->get();
         } else {
             $allCart = $obj->content();
             foreach ($allCart as $each_content) {
                 $each_content->product_id = $each_content->id;
                 $each_content->form_factor = $each_content->options->form_factor;
                 $each_content->row_id = $each_content->rowid;
                 $each_content->product_name = $each_content->name;
                 $each_content->quantity = $each_content->qty;
                 $each_content->amount = $each_content->price;
                 $each_content->duration = $each_content->options->duration;
                 $each_content->sub_total = $each_content->subtotal;
                 $each_content->no_of_days = $each_content->options->no_of_days;
             }
         }
         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.email', '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, 'brand_email' => $brandmember_deatils->email, '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, 'duration' => $eachCart->duration, 'no_of_days' => $eachCart->no_of_days]);
             //All Cart deleted from cart table after inserting all data to order and order_item table.
             if (Session::has('member_userid')) {
                 $deleteCart = DB::table('carts')->where('user_id', '=', Session::get('member_userid'))->delete();
             }
             Cart::destroy();
             // After inserting all cart data into Order and Order_item Table database
         }
         //set points for users on purchase
         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);
         }
     }
     //end of post
     /*
     		
     
     // 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'));
     */
 }
示例#10
0
 public function google()
 {
     $obj = new helpers();
     $name = Request::input('name');
     $checkout = Request::input('checkout');
     $email = Request::input('email');
     $membertype = Session::get('member_type');
     $name = explode(" ", $name);
     if (count($name) > 0) {
         $fname = $name[0];
         $lname = end($name);
     } else {
         $fname = $name;
         $lname = $name;
     }
     $username = strtolower($fname);
     $count = DB::table('brandmembers')->where('email', $email)->count();
     if ($count > 0) {
         $member = DB::table('brandmembers')->where('email', $email)->first();
         //brand member
         if ($member->role == 1 && empty($checkout) && $membertype == '1') {
             //redirect if admin deactivated account
             $user_cnt = DB::table('brandmembers')->where('email', $email)->where('status', 1)->where('admin_status', 1)->count();
             if ($user_cnt <= 0) {
                 $site = DB::table('sitesettings')->where('name', 'email')->first();
                 Session::put('error', 'Your Status is inactive. Contact Admin at ' . $site->value . ' to get your account activated!');
                 echo url() . '/brandLogin';
                 exit;
             }
             $this->check_subscription($member);
             Session::put('brand_userid', $member->id);
             Session::put('brand_user_email', $member->email);
             Session::put('member_username', $member->username);
             Session::put('social_login', 1);
             echo url() . "/brand-dashboard";
         } elseif ($member->role == 1 && $membertype != '1') {
             Session::put('error', 'You are already registered as brand!');
             echo url() . '/brandLogin';
         } elseif ($member->role == 1 && !empty($checkout)) {
             Session::put('error', 'You are unable to login as brand!');
             echo url();
         } elseif ($member->role == 0 && $membertype == '1') {
             Session::put('error', 'You are already registered as member!');
             echo url() . '/memberLogin';
             exit;
         } elseif ($member->role == 0 && ($membertype == '0' || !empty($checkout))) {
             //redirect if admin deactivated account
             $user_cnt = DB::table('brandmembers')->where('email', $email)->where('status', 1)->where('admin_status', 1)->count();
             if ($user_cnt <= 0) {
                 $site = DB::table('sitesettings')->where('name', 'email')->first();
                 Session::put('error', 'Your Status is inactive. Contact Admin at ' . $site->value . ' to get your account activated!');
                 echo url() . '/memberLogin';
                 exit;
             }
             Session::put('member_userid', $member->id);
             Session::put('member_user_email', $member->email);
             Session::put('member_username', $member->username);
             Session::put('social_login', 1);
             $this->update_cart($member->id);
             if (!empty($checkout)) {
                 echo url() . "/checkout";
             } else {
                 echo url() . "/member-dashboard";
             }
         }
     } else {
         //create social users
         $checkout = Request::input('checkout');
         if (!empty($checkout)) {
             Session::put('member_type', 0);
         }
         $membertype = Session::get('member_type');
         if ($membertype == '1') {
             Session::put('error', 'Please register as brand for login!');
             echo url() . '/brandregister';
             exit;
         }
         $hashpassword = Hash::make(uniqid());
         $slug = $obj->create_slug($fname . "-" . $lname, 'brandmembers', 'slug');
         $brandmember = Brandmember::create(['email' => $email, 'fname' => $fname, 'lname' => $lname, 'username' => $username, 'password' => '', 'role' => Session::get('member_type'), 'admin_status' => 1, 'status' => 1, 'google_id' => Request::input('id'), 'slug' => $slug, 'business_name' => $fname . " " . $lname, 'updated_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s')]);
         $member = DB::table('brandmembers')->where('email', $email)->first();
         $reg_brand_id = $member->id;
         $address = new Address();
         $address->mem_brand_id = $reg_brand_id;
         $address->first_name = $fname;
         $address->last_name = $lname;
         $address->address = '';
         $address->address2 = '';
         $address->country_id = '';
         $address->zone_id = '';
         // State id
         $address->city = '';
         $address->postcode = '';
         $address->serialize_val = '';
         if ($address->save()) {
             $addressId = $address->id;
             $dataUpdateAddress = DB::table('brandmembers')->where('id', $reg_brand_id)->update(['address' => $addressId]);
         }
         if ($member->role == 1) {
             $this->check_subscription($member);
             Session::put('brand_userid', $member->id);
             Session::put('brand_user_email', $member->email);
             Session::put('member_username', $member->username);
             Session::put('social_login', 1);
             echo url() . "/brand-dashboard";
         } else {
             Session::put('member_userid', $member->id);
             Session::put('member_user_email', $member->email);
             Session::put('member_username', $member->username);
             Session::put('social_login', 1);
             $this->update_cart($member->id);
             if (!empty($checkout)) {
                 echo url() . "/checkout";
             } else {
                 echo url() . "/member-dashboard";
             }
         }
     }
 }
示例#11
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'));
 }
示例#12
0
 public function delete_product($id)
 {
     // Check if brand subscription expires show message
     $brand_details = Brandmember::find(Session::get('brand_userid'));
     if ($brand_details->subscription_status != "active") {
         Session::flash('error', 'Your subscription is over. Subscribe to delete products.');
         return redirect('my-products');
     }
     $product_update['id'] = $id;
     $product_update['discountinue'] = 1;
     $pro_result = Product::find($product_update['id']);
     $pro_result->update($product_update);
     Session::flash('success', 'Product deleted successfully');
     return redirect('my-products');
 }
示例#13
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'));
 }
示例#14
0
 public function store(Request $request)
 {
     $obj = new helpers();
     //echo "<pre>";print_r(Request::all());exit;
     if (Input::hasFile('image1')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/thumb/';
         $home_thumb_path = 'uploads/product/home_thumb/';
         $medium = 'uploads/product/medium/';
         $extension = Input::file('image1')->getClientOriginalExtension();
         // getting image extension
         $fileName1 = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('image1')->move($destinationPath, $fileName1);
         // uploading file to given path
         $obj->createThumbnail($fileName1, 771, 517, $destinationPath, $thumb_path);
         $obj->createThumbnail($fileName1, 380, 270, $destinationPath, $home_thumb_path);
         $obj->createThumbnail($fileName1, 109, 89, $destinationPath, $medium);
     } else {
         $fileName1 = '';
     }
     if (Input::hasFile('image2')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/thumb/';
         $home_thumb_path = 'uploads/product/home_thumb/';
         $medium = 'uploads/product/medium/';
         $extension = Input::file('image2')->getClientOriginalExtension();
         // getting image extension
         $fileName2 = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('image2')->move($destinationPath, $fileName2);
         // uploading file to given path
         $obj->createThumbnail($fileName2, 771, 517, $destinationPath, $thumb_path);
         $obj->createThumbnail($fileName2, 380, 270, $destinationPath, $home_thumb_path);
         $obj->createThumbnail($fileName2, 109, 89, $destinationPath, $medium);
     } else {
         $fileName2 = '';
     }
     if (Input::hasFile('image3')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/thumb/';
         $home_thumb_path = 'uploads/product/home_thumb/';
         $medium = 'uploads/product/medium/';
         $extension = Input::file('image3')->getClientOriginalExtension();
         // getting image extension
         $fileName3 = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('image3')->move($destinationPath, $fileName3);
         // uploading file to given path
         $obj->createThumbnail($fileName3, 771, 517, $destinationPath, $thumb_path);
         $obj->createThumbnail($fileName3, 380, 270, $destinationPath, $home_thumb_path);
         $obj->createThumbnail($fileName3, 109, 89, $destinationPath, $medium);
     } else {
         $fileName3 = '';
     }
     if (Input::hasFile('image4')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/thumb/';
         $home_thumb_path = 'uploads/product/home_thumb/';
         $medium = 'uploads/product/medium/';
         $extension = Input::file('image4')->getClientOriginalExtension();
         // getting image extension
         $fileName4 = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('image4')->move($destinationPath, $fileName4);
         // uploading file to given path
         $obj->createThumbnail($fileName4, 771, 517, $destinationPath, $thumb_path);
         $obj->createThumbnail($fileName4, 380, 270, $destinationPath, $home_thumb_path);
         $obj->createThumbnail($fileName4, 109, 89, $destinationPath, $medium);
     } else {
         $fileName4 = '';
     }
     if (Input::hasFile('image5')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/thumb/';
         $home_thumb_path = 'uploads/product/home_thumb/';
         $medium = 'uploads/product/medium/';
         $extension = Input::file('image5')->getClientOriginalExtension();
         // getting image extension
         $fileName5 = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('image5')->move($destinationPath, $fileName5);
         // uploading file to given path
         $obj->createThumbnail($fileName5, 771, 517, $destinationPath, $thumb_path);
         $obj->createThumbnail($fileName5, 380, 270, $destinationPath, $home_thumb_path);
         $obj->createThumbnail($fileName5, 109, 89, $destinationPath, $medium);
     } else {
         $fileName5 = '';
     }
     if (Input::hasFile('image6')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/thumb/';
         $home_thumb_path = 'uploads/product/home_thumb/';
         $medium = 'uploads/product/medium/';
         $extension = Input::file('image6')->getClientOriginalExtension();
         // getting image extension
         $fileName6 = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('image6')->move($destinationPath, $fileName6);
         // uploading file to given path
         $obj->createThumbnail($fileName6, 771, 517, $destinationPath, $thumb_path);
         $obj->createThumbnail($fileName6, 380, 270, $destinationPath, $home_thumb_path);
         $obj->createThumbnail($fileName6, 109, 89, $destinationPath, $medium);
     } else {
         $fileName6 = '';
     }
     if (Input::hasFile('label')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/thumb/';
         $medium = 'uploads/product/medium/';
         $extension = Input::file('label')->getClientOriginalExtension();
         // getting image extension
         $label = rand(111111111, 999999999) . '.' . $extension;
         // renameing image
         Input::file('label')->move($destinationPath, $label);
         // uploading file to given path
         $this->obj->createThumbnail($label, 600, 650, $destinationPath, $thumb_path);
         $this->obj->createThumbnail($label, 109, 89, $destinationPath, $medium);
     } else {
         $label = Request::input('hidden_label');
     }
     $product['product_name'] = Request::input('product_name');
     $product['own_product'] = Request::input('own_product');
     $product['product_slug'] = $obj->create_slug(Request::input('product_name'), 'products', 'product_slug');
     $product['image1'] = $fileName1;
     $product['image2'] = $fileName2;
     $product['image3'] = $fileName3;
     $product['image4'] = $fileName4;
     $product['image5'] = $fileName5;
     $product['image6'] = $fileName6;
     $product['label'] = $label;
     $product['description1'] = htmlentities(Request::input('description1'));
     $product['description2'] = htmlentities(Request::input('description2'));
     $product['description3'] = htmlentities(Request::input('description3'));
     $product['brandmember_id'] = Request::input('brandmember_id');
     $product['tags'] = Request::input('tags');
     $product['sku'] = $obj->random_string(9);
     $product['script_generated'] = '<a href="' . url() . '/product-details/' . $product['product_slug'] . '" style="color: #FFF;background: #78d5e5 none repeat scroll 0% 0%;padding: 10px 20px;font-weight: 400;font-size: 12px;line-height: 25px;text-shadow: none;border: 0px none;text-transform: uppercase;font-weight: 200;vertical-align: middle;box-shadow: none;display: block;float: left;" onMouseOver="this.style.backgroundColor=\'#afc149\'" onMouseOut="this.style.backgroundColor=\'#78d5e5\'">Buy Now</a>';
     $product['created_at'] = date("Y-m-d H:i:s");
     // Create Product
     $product_row = Product::create($product);
     $lastinsertedId = $product_row->id;
     // ++++++++++++++++++++++++++ Logic for insert brand name and tags in tag table +++++++++++++++++++++++++++++++++++++
     $ii = 0;
     $allTags = array();
     if ($product['tags'] != "") {
         $allTags = explode(",", $product['tags']);
         foreach ($allTags as $key => $value) {
             $all_data_arr[$ii]['value'] = $value;
             $all_data_arr[$ii]['type'] = 'tags';
             $ii++;
         }
     }
     // get Brand Name from brand id
     $ii = $ii + 1;
     $brand_dtls = Brandmember::find(Request::input('brandmember_id'));
     $brand_name = $brand_dtls['fname'] . ' ' . $brand_dtls['lname'];
     $all_data_arr[$ii]['value'] = $brand_name;
     $all_data_arr[$ii]['type'] = 'brand_name';
     //Insert Into searchtags table
     foreach ($all_data_arr as $key => $value) {
         $arr = array('product_id' => $lastinsertedId, 'type' => $value['type'], 'name' => trim($value['value']));
         Searchtag::create($arr);
     }
     // ++++++++++++++++++++ Logic for insert brand name and tags in tag table +++++++++++++++++++++++++++++++++++++
     // Create Product Ingredient group
     $flag = 0;
     if (NULL != Request::input('ingredient_group')) {
         foreach (Request::input('ingredient_group') as $key => $value) {
             // Check if that group contain atleast one ingredient
             if (isset($value['ingredient']) && NULL != $value['ingredient']) {
                 foreach ($value['ingredient'] as $key1 => $next_value) {
                     if ($next_value['ingredient_id'] != "" && $next_value['weight'] != "") {
                         $flag = 1;
                         break;
                     }
                 }
             }
             // ========================  Insert If flag==1 =====================
             if ($flag == 1) {
                 $arr = array('product_id' => $lastinsertedId, 'group_name' => $value['group_name']);
                 $pro_ing_grp = ProductIngredientGroup::create($arr);
                 $group_id = $pro_ing_grp->id;
                 if (NULL != $value['ingredient']) {
                     foreach ($value['ingredient'] as $key1 => $next_value) {
                         if ($next_value['ingredient_id'] != "" && $next_value['weight'] != "") {
                             $arr_next = array('product_id' => $lastinsertedId, 'ingredient_id' => $next_value['ingredient_id'], 'weight' => $next_value['weight'], 'ingredient_price' => $next_value['ingredient_price'], 'ingredient_group_id' => $group_id);
                             ProductIngredient::create($arr_next);
                         }
                     }
                 }
             }
             //  ========================  Insert If flag==1 =====================
         }
     }
     // Create Product Ingredient
     foreach (Request::input('ingredient') as $key2 => $ing_value) {
         if ($ing_value['id'] != "" && $ing_value['weight'] != "") {
             $arr_next = array('product_id' => $lastinsertedId, 'ingredient_id' => $ing_value['id'], 'weight' => $ing_value['weight'], 'ingredient_price' => $ing_value['ingredient_price'], 'ingredient_group_id' => 0);
             ProductIngredient::create($arr_next);
         }
     }
     // Add Ingredient form factor
     foreach (Request::input('formfactor') as $key3 => $formfactor_value) {
         $arr_pro_fac = array('product_id' => $lastinsertedId, 'formfactor_id' => $formfactor_value['formfactor_id'], 'servings' => $formfactor_value['servings'], 'min_price' => $formfactor_value['min_price'], 'recomended_price' => $formfactor_value['recomended_price'], 'actual_price' => $formfactor_value['actual_price']);
         ProductFormfactor::create($arr_pro_fac);
     }
     // Add Ingredient form factor for available form factor
     if (Request::input('excluded_val') != "") {
         $all_form_factor_ids = rtrim(Request::input('excluded_val'), ",");
         $all_ids = explode(",", $all_form_factor_ids);
         foreach ($all_ids as $key => $value) {
             $arr_pro_factor = array('product_id' => $lastinsertedId, 'formfactor_id' => $value);
             ProductFormfactor::create($arr_pro_factor);
         }
     }
     //Add count to MemberProfile
     $row = MemberProfile::where('brandmember_id', '=', Request::input('brandmember_id'))->first();
     $row1 = array();
     if (!empty($row)) {
         $count = $row->count + 1;
         MemberProfile::where('brandmember_id', '=', Request::input('brandmember_id'))->update(['count' => $count]);
     } else {
         $count = 1;
         $row1['count'] = $count;
         $row1['brandmember_id'] = Request::input('brandmember_id');
         MemberProfile::create($row1);
     }
     Session::flash('success', 'Product added successfully');
     return redirect('admin/product-list/0');
 }
 public function admin_inactive_status($id)
 {
     $brandmember = Brandmember::find($id);
     $brandmember->admin_status = 0;
     $brandmember->update();
     Session::flash('success', 'Brand status updated successfully');
     return redirect('admin/brand');
 }
示例#16
0
 public function store(Request $request)
 {
     $register = Request::all();
     //print_r($register);
     $hashpassword = Hash::make($register['password']);
     $brandmember = Brandmember::create(['email' => $register['email'], 'username' => $register['user_name'], 'password' => $hashpassword, 'role' => 0, 'admin_status' => 1, 'updated_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s')]);
     $lastInsertedId = $brandmember->id;
     $sitesettings = DB::table('sitesettings')->get();
     //exit;
     if (!empty($sitesettings)) {
         foreach ($sitesettings as $each_sitesetting) {
             if ($each_sitesetting->name == 'email') {
                 $admin_users_email = $each_sitesetting->value;
             }
         }
     }
     $user_name = $register['user_name'];
     $user_email = $register['email'];
     $activateLink = url() . '/activateLink/' . base64_encode($register['email']) . '/member';
     $sent = Mail::send('frontend.register.activateLink', array('name' => $user_name, 'email' => $user_email, 'activate_link' => $activateLink), function ($message) use($admin_users_email, $user_email, $user_name) {
         $message->from($admin_users_email);
         $message->to($user_email, $user_name)->subject('Activate Profile Mail');
     });
     if (!$sent) {
         Session::flash('error', 'something went wrong!! Mail not sent.');
         return redirect('register');
     } else {
         Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.');
         return redirect('register');
     }
 }
示例#17
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function add_member()
 {
     if (Request::isMethod('post')) {
         $register = Request::all();
         //print_r($register);
         $hashpassword = Hash::make($register['password']);
         if (isset($_FILES['pro_image']['name']) && $_FILES['pro_image']['name'] != "") {
             $destinationPath = 'uploads/member/';
             // upload path
             $thumb_path = 'uploads/member/thumb/';
             $medium = 'uploads/member/thumb/';
             $extension = Input::file('pro_image')->getClientOriginalExtension();
             // getting image extension
             $fileName = rand(111111111, 999999999) . '.' . $extension;
             // renameing image
             Input::file('pro_image')->move($destinationPath, $fileName);
             // uploading file to given path
             $obj->createThumbnail($fileName, 661, 440, $destinationPath, $thumb_path);
             $obj->createThumbnail($fileName, 116, 116, $destinationPath, $medium);
         } else {
             $fileName = '';
         }
         $brandmember = Brandmember::create(['email' => $register['email'], 'username' => $register['username'], 'fname' => $register['fname'], 'lname' => $register['lname'], 'phone_no' => $register['phone_no'], 'pro_image' => $fileName, 'password' => $hashpassword, 'role' => 0, 'admin_status' => 1, 'status' => 1, 'updated_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s')]);
         $lastInsertedId = $brandmember->id;
         $sitesettings = DB::table('sitesettings')->get();
         //exit;
         if (!empty($sitesettings)) {
             foreach ($sitesettings as $each_sitesetting) {
                 if ($each_sitesetting->name == 'email') {
                     $admin_users_email = $each_sitesetting->value;
                 }
             }
         }
         $user_name = $register['username'];
         $user_email = $register['email'];
         $activateLink = url() . '/memberLogin';
         $sent = Mail::send('frontend.register.activateLink', array('name' => $user_name, 'email' => $user_email, 'activate_link' => $activateLink, 'admin_users_email' => $admin_users_email), function ($message) use($admin_users_email, $user_email, $user_name) {
             $message->from($admin_users_email);
             $message->to($user_email, $user_name)->subject('Welcome to Miramix');
         });
         if (!$sent) {
             Session::flash('error', 'something went wrong!! Mail not sent.');
             return redirect('admin/add-member');
         } else {
             Session::flash('success', 'Member created successfully.');
             return redirect('admin/member');
         }
     }
     return view('admin.members.add', array('title' => 'Add Member', 'module_head' => 'Members'));
 }