Exemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $obj = new helpers();
     $memberUpdate = Request::all();
     if ($memberUpdate['password'] == '') {
         unset($memberUpdate['password']);
     } else {
         $memberUpdate['password'] = Hash::make(Request::input('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 = '';
     }
     if ($fileName == '') {
         unset($memberUpdate['pro_image']);
     } else {
         $memberUpdate['pro_image'] = $fileName;
     }
     $member = Brandmember::find($id);
     $member->update($memberUpdate);
     Session::flash('success', 'Member updated successfully');
     return redirect('admin/member');
 }
Exemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $image = Input::file('image');
     $filename = time() . '.' . $image->getClientOriginalExtension();
     $path = public_path('uploads/img/' . $filename);
     Image::make($image->getRealPath())->resize(200, 200)->save($path);
     $user->image = $filename;
     $user->save();
     $obj = new helpers();
     echo "<pre>";
     print_r(Input::file('image'));
     exit;
     $book = Request::all();
     //echo "<pre>";print_r($_FILES['image']['name']);exit;
     $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);
     $book['image'] = $fileName;
     Book::create($book);
     Session::flash('success', 'Upload successfully');
     return redirect('image');
 }
 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');
         }
     }
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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');
     }
 }
Exemplo n.º 6
0
 public function productPost(Request $request)
 {
     $obj = new helpers();
     //echo "<pre>";print_r(Request::all());exit;
     if (Request::input('own_product') == 1) {
         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, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName1, 109, 89, $destinationPath, $medium);
         } else {
             $fileName1 = Request::input('hidden_image1');
         }
         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, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName2, 109, 89, $destinationPath, $medium);
         } else {
             $fileName2 = Request::input('hidden_image2');
         }
         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, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName3, 109, 89, $destinationPath, $medium);
         } else {
             $fileName3 = Request::input('hidden_image3');
         }
         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, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName4, 109, 89, $destinationPath, $medium);
         } else {
             $fileName4 = Request::input('hidden_image4');
         }
         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, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName5, 109, 89, $destinationPath, $medium);
         } else {
             $fileName5 = Request::input('hidden_image5') != '' ? Request::input('hidden_image5') : '';
         }
         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, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName6, 109, 89, $destinationPath, $medium);
         } else {
             $fileName6 = Request::input('hidden_image6');
         }
         $lastinsertedId = $id = Request::input('product_id');
         $product = Product::find(Request::input('product_id'));
         $product['id'] = Request::input('product_id');
         $product['own_product'] = Request::input('own_product');
         $product['product_name'] = Request::input('product_name');
         $product['product_slug'] = $obj->edit_slug($product['product_name'], 'products', 'product_slug', Request::input('product_id'));
         $product['image1'] = $fileName1;
         $product['image2'] = $fileName2;
         $product['image3'] = $fileName3;
         $product['image4'] = $fileName4;
         $product['image5'] = $fileName5;
         $product['image6'] = $fileName6;
         $product['description1'] = htmlentities(Request::input('description1'));
         $product['description2'] = htmlentities(Request::input('description2'));
         $product['description3'] = htmlentities(Request::input('description3'));
         $product['tags'] = Request::input('tags');
         $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");
         $product->save();
         // ++++++++++++++++++++++++++ Logic for insert brand name and tags in tag table +++++++++++++++++++++++++++++++++++++
         // Delete Search tags
         Searchtag::where('product_id', '=', $id)->delete();
         $allTags = array();
         $ii = 0;
         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($product['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' => $id, 'type' => $value['type'], 'name' => trim($value['value']));
             Searchtag::create($arr);
         }
         // ++++++++++++++++++++ Logic for insert brand name and tags in tag table +++++++++++++++++++++++++++++++++++++
         // Delete all ingredient before save new
         ProductIngredientGroup::where('product_id', '=', $id)->delete();
         // Delete ingredient group
         ProductIngredient::where('product_id', '=', $id)->delete();
         // Delete ingredient individual
         $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
         if (NULL != Request::input('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);
                 }
             }
         }
         //echo "<pre>";print_r(Request::input('formfactor') );exit;
         // Delete all Formfactor before save new
         ProductFormfactor::where('product_id', '=', $id)->delete();
         // Add Ingredient form factor
         foreach (Request::input('formfactor') as $key3 => $formfactor_value) {
             $arr_pro_fac = array('product_id' => $id, '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);
         }
     } else {
         // Update Old Product to discontinue product
         $product_update['id'] = Request::input('product_id');
         $product_update['discountinue'] = 1;
         $pro_result = Product::find($product_update['id']);
         $pro_result->update($product_update);
         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, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName1, 109, 89, $destinationPath, $medium);
             // Delete old image
             // @unlink('uploads/product/'.Request::input('hidden_image1'));
             // @unlink('uploads/product/thumb/'.Request::input('hidden_image1'));
             // @unlink('uploads/product/medium/'.Request::input('hidden_image1'));
         } else {
             $fileName1 = Request::input('hidden_image1');
         }
         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($fileName1, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName2, 109, 89, $destinationPath, $medium);
         } else {
             $fileName2 = Request::input('hidden_image2');
         }
         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($fileName1, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName3, 109, 89, $destinationPath, $medium);
         } else {
             $fileName3 = Request::input('hidden_image3');
         }
         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($fileName1, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName4, 109, 89, $destinationPath, $medium);
         } else {
             $fileName4 = Request::input('hidden_image4');
         }
         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($fileName1, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName5, 109, 89, $destinationPath, $medium);
         } else {
             $fileName5 = Request::input('hidden_image5') != '' ? Request::input('hidden_image5') : '';
         }
         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($fileName1, 580, 270, $destinationPath, $home_thumb_path);
             $obj->createThumbnail($fileName6, 109, 89, $destinationPath, $medium);
         } else {
             $fileName6 = Request::input('hidden_image6');
         }
         $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['description1'] = htmlentities(Request::input('description1'));
         $product['description2'] = htmlentities(Request::input('description2'));
         $product['description3'] = htmlentities(Request::input('description3'));
         $product['brandmember_id'] = Session::get('brand_userid');
         //$product['brandmember_id'] = 33;
         $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");
         //echo "<pre>";print_r($product);exit;
         // Create Product
         $product_row = Product::create($product);
         $lastinsertedId = $product_row->id;
         // ++++++++++++++++++++++++++ Logic for insert brand name and tags in tag table +++++++++++++++++++++++++++++++++++++
         if ($product['tags'] != "") {
             $allTags = explode(",", $product['tags']);
             $ii = 0;
             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(Session::get('brand_userid'));
         $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', '=', Session::get('brand_userid'))->first();
         $row1 = array();
         if (!empty($row)) {
             $count = $row->count + 1;
             MemberProfile::where('brandmember_id', '=', Session::get('brand_userid'))->update(['count' => $count]);
         } else {
             $count = 1;
             $row1['count'] = $count;
             $row1['brandmember_id'] = Session::get('brand_userid');
             MemberProfile::create($row1);
         }
     }
     Session::flash('success', 'Product updated successfully');
     return redirect('my-products');
     //exit;
 }
Exemplo n.º 7
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'));
 }
Exemplo n.º 8
0
 public function productPost(Request $request)
 {
     $obj = new helpers();
     //echo "<pre>";print_r(Request::all());exit;
     // Update Old Product to discontinue product
     $product_update['id'] = Request::input('product_id');
     $product_update['discountinue'] = 1;
     $pro_result = Product::find($product_update['id']);
     $pro_result->update($product_update);
     if (Input::hasFile('image1')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/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, 109, 89, $destinationPath, $medium);
         // Delete old image
         // @unlink('uploads/product/'.Request::input('hidden_image1'));
         // @unlink('uploads/product/thumb/'.Request::input('hidden_image1'));
         // @unlink('uploads/product/medium/'.Request::input('hidden_image1'));
     } else {
         $fileName1 = Request::input('hidden_image1');
     }
     if (Input::hasFile('image2')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/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, 109, 89, $destinationPath, $medium);
     } else {
         $fileName2 = Request::input('hidden_image2');
     }
     if (Input::hasFile('image3')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/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, 109, 89, $destinationPath, $medium);
     } else {
         $fileName3 = Request::input('hidden_image3');
     }
     if (Input::hasFile('image4')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/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, 109, 89, $destinationPath, $medium);
     } else {
         $fileName4 = Request::input('hidden_image4');
     }
     if (Input::hasFile('image5')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/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, 109, 89, $destinationPath, $medium);
     } else {
         $fileName5 = Request::input('hidden_image5') != '' ? Request::input('hidden_image5') : '';
     }
     if (Input::hasFile('image6')) {
         $destinationPath = 'uploads/product/';
         // upload path
         $thumb_path = 'uploads/product/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, 109, 89, $destinationPath, $medium);
     } else {
         $fileName6 = Request::input('hidden_image6');
     }
     $product['product_name'] = Request::input('product_name');
     $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['description1'] = htmlentities(Request::input('description1'));
     $product['description2'] = htmlentities(Request::input('description2'));
     $product['description3'] = htmlentities(Request::input('description3'));
     $product['brandmember_id'] = Session::get('brand_userid');
     //$product['brandmember_id'] = 33;
     $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");
     //echo "<pre>";print_r($product);exit;
     // Create Product
     $product_row = Product::create($product);
     $lastinsertedId = $product_row->id;
     // Create Product Ingredient group
     if (NULL != Request::input('ingredient_group')) {
         foreach (Request::input('ingredient_group') as $key => $value) {
             $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) {
                     $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);
                 }
             }
         }
     }
     // Create Product Ingredient
     foreach (Request::input('ingredient') as $key2 => $ing_value) {
         $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);
         }
     }
     Session::flash('success', 'Product updated successfully');
     return redirect('my-products');
     //exit;
 }
Exemplo n.º 9
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'));
 }
Exemplo n.º 10
0
 public function deleteCart()
 {
     $obj = new helpers();
     $rowid = Input::get('rowid');
     Cart::remove($rowid);
     // Delete cart product from SESSION respect with cart rowid.
     if ($obj->checkMemberLogin()) {
         DB::table('carts')->where('row_id', '=', $rowid)->where('user_id', '=', Session::get('member_userid'))->delete();
         // Delete cart product from DB respect with cart rowid.
     }
     echo 1;
     // Remove from  cart
 }
Exemplo n.º 11
0
 public function brand_forgotPassword()
 {
     $obj = new helpers();
     if ($obj->checkUserLogin()) {
         return redirect('brand-dashboard');
     }
     if (Request::isMethod('post')) {
         $email = Request::input('email');
         $brandmembers = DB::table('brandmembers')->where('email', '=', $email)->where('role', '=', 1)->first();
         $random_code = mt_rand();
         $updateWithCode = DB::table('brandmembers')->where('email', '=', $email)->update(array('code_number' => $random_code));
         $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;
                 }
             }
         }
         if (!empty($brandmembers)) {
             $user_name = $brandmembers->fname . ' ' . $brandmembers->lname;
             $user_email = $brandmembers->email;
             $resetpassword_link = url() . '/brand-reset-password/' . base64_encode($user_email) . '-' . base64_encode($random_code);
             //echo $resetpassword_link; exit;
             $sent = Mail::send('frontend.home.reset_password_link', array('name' => $user_name, 'email' => $user_email, 'reset_password_link' => $resetpassword_link), function ($message) use($admin_users_email, $user_email, $user_name) {
                 $message->from($admin_users_email);
                 $message->to($user_email, $user_name)->subject('Forgot Password Email!');
             });
             if (!$sent) {
                 Session::flash('error', 'something went wrong!! Mail not sent.');
                 return redirect('brand-forgot-password');
             } else {
                 Session::flash('success', 'Please check your email to reset your password.');
                 return redirect('brandLogin');
             }
         } else {
             Session::flash('error', 'Email Id not matched.');
             return redirect('brand-forgot-password');
         }
     }
     return view('frontend.home.brandforgotpassword');
 }
Exemplo n.º 12
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";
             }
         }
     }
 }
Exemplo n.º 13
0
<?php

use App\Helper\helpers;
$obj = new helpers();
$shipping_address = unserialize($order_list[0]->shiping_address_serialize);
?>
<!doctype html>
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta charset="utf-8">
<title>Miramix Order Mail</title>

</head>

<body>
<center>
  <style>
@import url('http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic');
</style>
  <table width="620" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td background="<?php 
echo url();
?>
/public/frontend/images/account/acct_back.jpg" style="background-repeat:no-repeat;background-position:0 0;background-size:cover;padding-left:30px;padding-top:30px;padding-right:30px;" bgcolor="#017a95"><table width="560" border="0" cellpadding="0" cellspacing="0" style="">
          <thead>
            <tr>
              <td align="center" colspan="2" style="padding-bottom:22px;"><a href="" target="_blank"><img src="<?php 
echo url();
?>
/public/frontend/images/logo.png" alt=""></a></td>
Exemplo n.º 14
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $obj = new helpers();
     $brandUpdate = Request::all();
     $brand = Brandmember::find($id);
     if ($brandUpdate['password'] == '') {
         unset($brandUpdate['password']);
     } else {
         $brandUpdate['password'] = Hash::make(Request::input('password'));
     }
     /*  
            if($brandUpdate['slug']==''){
     	unset($brandUpdate['slug']);
            }else{
     	$brandUpdate['slug']=$obj->edit_slug(Request::input('slug'),'brandmembers','slug',$id);
     	
            }*/
     $brandUpdate['slug'] = $obj->edit_slug(Request::input('slug'), 'brandmembers', 'slug', $id);
     $address['first_name'] = Request::input('first_name');
     $address['last_name'] = Request::input('last_name');
     $address['address'] = Request::input('address1');
     $address['address2'] = Request::input('address2');
     $address['country_id'] = Request::input('country_id');
     $address['zone_id'] = Request::input('zone_id');
     // State id
     $address['city'] = Request::input('city');
     $address['postcode'] = Request::input('postcode');
     Address::where('id', '=', Request::input('address'))->update($address);
     unset($brandUpdate['first_name']);
     unset($brandUpdate['last_name']);
     unset($brandUpdate['address1']);
     unset($brandUpdate['address2']);
     unset($brandUpdate['country_id']);
     unset($brandUpdate['zone_id']);
     unset($brandUpdate['city']);
     unset($brandUpdate['postcode']);
     if (isset($_FILES['pro_image']['name']) && $_FILES['pro_image']['name'] != "") {
         $destinationPath = 'uploads/brandmember/';
         // upload path
         $thumb_path = 'uploads/brandmember/thumb/';
         $medium = 'uploads/brandmember/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 = '';
     }
     if ($fileName == '') {
         unset($brandUpdate['pro_image']);
     } else {
         $brandUpdate['pro_image'] = $fileName;
     }
     if (isset($_FILES['government_issue']['name']) && $_FILES['government_issue']['name'] != "") {
         $destinationPath = 'uploads/brand_government_issue_id/';
         // upload path
         $extension = Input::file('government_issue')->getClientOriginalExtension();
         $government_issue = rand(111111111, 999999999) . '.' . $extension;
         Input::file('government_issue')->move($destinationPath, $government_issue);
         // uploading file to given path
     } else {
         $government_issue = '';
     }
     if ($government_issue == '') {
         unset($brandUpdate['government_issue']);
     } else {
         $brandUpdate['government_issue'] = $government_issue;
     }
     if (isset($_FILES['business_doc']['name']) && $_FILES['business_doc']['name'] != "") {
         $destinationPath = 'uploads/brandmember/business_doc/';
         // upload path
         $extension = Input::file('business_doc')->getClientOriginalExtension();
         $business_doc = rand(111111111, 999999999) . '.' . $extension;
         Input::file('business_doc')->move($destinationPath, $business_doc);
     } else {
         $business_doc = '';
     }
     if ($business_doc == '') {
         unset($brandUpdate['business_doc']);
     } else {
         $brandUpdate['business_doc'] = $business_doc;
     }
     $brand->update($brandUpdate);
     Session::flash('success', 'Brand updated successfully');
     return redirect('admin/brand');
 }
Exemplo n.º 15
0
@extends('admin/layout/admin_template')

@section('content')
<?php 
use App\Helper\helpers;
$obj = new helpers();
$serialize_address = unserialize($order_list->shiping_address_serialize);
?>

<div class="inner_page_container nomar_bottom">
     <!--my_acct_sec-->
     <div class="my_acct_sec">           
      <div class="container-fluid">
        <div class="col-sm-12">
         <div class="row">
         <div class="form_dashboardacct">
            
            <div class="custom_addedlater clearfix">

            <h3 class="pull-left">Order History</h3>
              
                  </div>
                
              <div class="bottom_dash clearfix">
                  
                  <div class="row">
                    <div class="col-sm-6">
                      <div class="order_box">

                  <h6>Order Information</h6>
                  
@extends('frontend/layout/frontend_template')
@section('content')

<?php 
use App\Helper\helpers;
$obj = new helpers();
$serialize_address = unserialize($order_list->shiping_address_serialize);
?>



  <div class="inner_page_container nomar_bottom">
  
  <div class="top_menu_port">
    	<div class="acct_box blue_acct front">
                	<div class="acct_box_inn">
                    	<div class="acct_box_inn_inn">
                        <a href="<?php 
echo url();
?>
/member-account"><img src="<?php 
echo url();
?>
/public/frontend/images/account/pers_info.png" alt=""></a>
                        <a href="<?php 
echo url();
?>
/member-account" class="link_wholediv">Personal Information</a>
                        </div>                    	
                    </div>
                </div> 
Exemplo n.º 17
0
 public function push_order_process($param = false)
 {
     //echo $param;exit;
     $usps_obj = new Usps();
     $obj = new helpers();
     $all_process_orders = DB::table('add_process_order_labels')->get();
     $all_filename = array();
     $flag = 0;
     if (!empty($all_process_orders)) {
         foreach ($all_process_orders as $key => $value) {
             // Get details for each order
             $ord_dtls = Order::find($value->order_id);
             $serialize_add = unserialize($ord_dtls['shiping_address_serialize']);
             $user_email = $serialize_add['email'];
             $user_name = $serialize_add['first_name'] . " " . $serialize_add['last_name'];
             $phone = $serialize_add['phone'];
             $address = $serialize_add['address'];
             $address2 = $serialize_add['address2'];
             $city = $serialize_add['city'];
             $zone_id = $serialize_add['zone_id'];
             $country_id = $serialize_add['country_id'];
             $postcode = $serialize_add['postcode'];
             $ToState = '';
             if (is_numeric($zone_id)) {
                 $ToState = $obj->get_statecode($zone_id);
             } else {
                 $ToState = $obj->get_statecode_by_name($zone_id);
             }
             // Call USPS API
             $parameters_array = array('ToName' => $user_name, 'ToFirm' => '', 'ToAddress1' => $address2, 'ToAddress2' => $address, 'ToCity' => $city, 'ToState' => $ToState, 'ToZip5' => $postcode, 'order_id' => $value->order_id);
             $ret_array = $usps_obj->USPSLabel($parameters_array);
             //echo "<pre>";print_r($ret_array);exit;
             if ($ret_array['filename'] != "") {
                 $flag = 1;
             }
             $all_filename[] = $filename = $ret_array['filename'];
             $tracking_number = $ret_array['tracking_no'];
             // Update label name in DB
             Order::where('id', $value->order_id)->update(['tracking_number' => $tracking_number, 'shipping_carrier' => 'USPS', 'usps_label' => $filename, 'order_status' => 'shipped']);
             // change order status and send mail
             $order = Order::find($value->order_id);
             $subject = 'Order status change of : #' . $order->order_number;
             $cmessage = 'Your order status is changed to ' . $order->order_status . '. Please visit your account for details.';
             $tracking = '';
             $shipping = '';
             if ($order->order_status == 'shipped') {
                 $tracking = 'Tracking Number is : ' . $tracking_number;
                 $shipping = 'Shipping Method is : USPS<br />Please visit your account for details';
             }
             $setting = DB::table('sitesettings')->where('name', 'email')->first();
             $admin_users_email = $setting->value;
             /*$sent = Mail::send('admin.order.statusemail', array('name'=>$user_name,'email'=>$user_email,'messages'=>$cmessage,'admin_users_email'=>$admin_users_email,'tracking'=>$tracking,'shipping'=>$shipping), 
             		
             		function($message) use ($admin_users_email, $user_email,$user_name,$subject)
             		{
             			$message->from($admin_users_email);
             			$message->to($user_email, $user_name)->cc($admin_users_email)->subject($subject);
             			//$message->to('*****@*****.**', $user_name)->cc($admin_users_email)->subject($subject);
             			
             		});*/
         }
     }
     // Delete from add_process_order_labels
     DB::table('add_process_order_labels')->delete();
     if ($param == 1) {
         $full_path = array();
         if (!empty($all_filename)) {
             foreach ($all_filename as $file) {
                 if ($file != "") {
                     $full_path[] = './uploads/pdf/' . $file;
                 }
             }
         }
         if (!empty($full_path)) {
             $usps_obj->new_printPdf($full_path);
         }
     }
     //echo $flag;print_r($all_filename);exit;
     if ($flag == 1) {
         Session::flash('success', 'Message is sent to user and order status is updated successfully.');
     } else {
         Session::flash('error', 'No label is created.');
     }
     return redirect('admin/orders');
 }
Exemplo n.º 18
0
 public function brandRegister()
 {
     $obj = new helpers();
     if ($obj->checkUserLogin()) {
         return redirect('home');
     }
     $country = DB::table('countries')->orderBy('name', 'ASC')->get();
     $alldata = array();
     foreach ($country as $key => $value) {
         $alldata[$value->country_id] = $value->name;
     }
     //echo "<pre>";print_r($alldata); exit;
     $reg_brand_id = '';
     // No register brand id for first time.
     if (Request::isMethod('post')) {
         $country = DB::table('countries')->where('country_id', '=', Request::input('card_country_id'))->first();
         $shipping_card_addr = array('card_holder_fname' => Request::input('card_holder_fname'), 'card_holder_lname' => Request::input('card_holder_lname'), 'company_name' => Request::input('company_name'), 'expiry_month' => Request::input('expiry_month'), 'expiry_year' => Request::input('expiry_year'), 'cvv' => Request::input('cvv'), 'card_shiping_name' => Request::input('card_shiping_name'), 'card_shiping_address' => Request::input('card_shiping_address'), 'card_country_id' => Request::input('card_country_id'), 'card_shiping_city' => Request::input('card_shiping_city'), 'card_shipping_phone_no' => Request::input('card_shipping_phone_no'), 'card_shipping_fax' => Request::input('card_shipping_fax'), 'card_state' => Request::input('card_state'), 'card_shipping_postcode' => Request::input('card_shipping_postcode'), 'email' => Request::input('email'), 'card_number' => Request::input('card_number'), 'country' => $country->name);
         $res = Authorizenet::createprofile($shipping_card_addr);
         // echo $res['status'];
         // echo $res['customer']['payment_profile_id'];
         //print_r($res);exit;
         if ($res['status'] == 'fail') {
             Session::flash('error', 'something went wrong with creditcard details!!' . $res[message] . ' Please try again.');
             return redirect('brandregister');
         }
         //echo $_FILES['image']['name']."<pre>";print_r($_FILES);exit;
         //if(Input::hasFile('government_issue'))
         if ($_FILES['government_issue']['name'] != "") {
             $destinationPath = 'uploads/brand_government_issue_id/';
             // upload path
             $extension = Input::file('government_issue')->getClientOriginalExtension();
             // getting image extension
             $government_issue = rand(111111111, 999999999) . '.' . $extension;
             // renameing image
             Input::file('government_issue')->move($destinationPath, $government_issue);
             // uploading file to given path
         } else {
             $government_issue = '';
         }
         //if(Input::hasFile('image'))
         if ($_FILES['image']['name'] != "") {
             $destinationPath = 'uploads/brandmember/';
             // upload path
             $thumb_path = 'uploads/brandmember/thumb/';
             $medium = 'uploads/brandmember/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, 661, 440, $destinationPath, $thumb_path);
             $obj->createThumbnail($fileName, 116, 116, $destinationPath, $medium);
         } else {
             $fileName = '';
         }
         $slug = $obj->create_slug(Request::input('fname') . " " . Request::input('lname'), 'brandmembers', 'slug');
         $hashpassword = Hash::make(Request::input('password'));
         $address = new Address();
         $time = Request::input('calltime');
         $date = Request::input('calldate');
         $given_date = strtotime($date . " " . $time);
         $given_date = date("Y-m-d H:s:i", $given_date);
         $brandmember = Brandmember::create(['fname' => Request::input('fname'), 'lname' => Request::input('lname'), 'email' => Request::input('email'), 'username' => strtolower(Request::input('fname')), 'password' => $hashpassword, 'government_issue' => $government_issue, 'phone_no' => Request::input('phone_no'), 'routing_number' => Request::input('routing_number'), 'account_number' => Request::input('account_number'), 'mailing_name' => Request::input('mailing_name'), 'mailing_address' => Request::input('mailing_address'), 'mailing_country_id' => Request::input('mailing_country_id'), 'mailing_city' => Request::input('mailing_city'), 'mailing_lastname' => Request::input('mailing_lastname'), 'mailing_address2' => Request::input('mailing_address2'), 'mailing_state' => Request::input('mailing_state'), 'mailing_postcode' => Request::input('mailing_postcode'), 'call_datetime' => $given_date, 'paypal_email' => Request::input('paypal_email'), 'mailing_address' => Request::input('mailing_address'), 'default_band_preference' => Request::input('default_band_preference'), 'pro_image' => $fileName, 'role' => 1, 'admin_status' => 0, 'auth_profile_id' => $res['customer']['profile_id'], 'auth_payment_profile_id' => $res['customer']['payment_profile_id'], 'auth_address_id' => $res['customer']['address_id'], 'slug' => $slug]);
         $shipping_card_addr = array('card_holder_name' => Request::input('card_holder_name'), 'card_number' => Request::input('card_number'), 'card_name' => Request::input('card_name'), 'expiry_month' => Request::input('expiry_month'), 'expiry_year' => Request::input('expiry_year'), 'card_shiping_name' => Request::input('card_shiping_name'), 'card_shiping_address' => Request::input('card_shiping_address'), 'card_country_id' => Request::input('card_country_id'), 'card_shiping_city' => Request::input('card_shiping_city'), 'card_shipping_phone_no' => Request::input('card_shipping_phone_no'), 'card_shipping_address2' => Request::input('card_shipping_address2'), 'card_state' => Request::input('card_state'), 'card_shipping_postcode' => Request::input('card_shipping_postcode'));
         $shipping_card_addr_serial = serialize($shipping_card_addr);
         $lastInsertedId = $brandmember->id;
         $reg_brand_id = $lastInsertedId;
         //base64_encode ($lastInsertedId); // encrypted last register brand member id
         $address->mem_brand_id = $lastInsertedId;
         $address->first_name = Request::input('shiping_fname');
         $address->last_name = Request::input('shiping_lname');
         $address->address = Request::input('shiping_address');
         $address->address2 = Request::input('shipping_address2');
         $address->country_id = Request::input('country');
         $address->zone_id = Request::input('state');
         // State id
         $address->city = Request::input('city');
         $address->postcode = Request::input('shipping_postcode');
         $address->serialize_val = '';
         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;
                     }
                 }
             }
             //Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.');
             //return redirect('brandregister');
             $user_name = Request::input('fname') . ' ' . Request::input('lname');
             $user_email = Request::input('email');
             $activateLink = url() . '/activateLink/' . base64_encode(Request::input('email')) . '/brand';
             $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('brandregister');
             } else {
                 Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.');
                 Session::flash('flush_reg_brand_id', 'open_modal');
                 Session::put('reg_brand_id', $reg_brand_id);
                 return redirect('brandregister');
             }
         }
     }
     return view('frontend.register.registerbrand', compact('alldata'), array('reg_brand_id' => $reg_brand_id));
 }
Exemplo n.º 19
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'));
     */
 }
Exemplo n.º 20
0
    public function getallrate()
    {
        $obj = new helpers();
        $resultsPerPage = 3;
        $paged = Input::get('page');
        $product_id = Input::get('product_id');
        if ($paged > 0) {
            $page_limit = $resultsPerPage * $paged;
            $next_check_page = $page_limit + 3;
        } else {
            $page_limit = 0;
            $next_check_page = 1;
        }
        $rating = DB::table('product_rating')->leftJoin('brandmembers', 'brandmembers.id', '=', 'product_rating.user_id')->select('product_rating.*', 'brandmembers.username as buser')->where('product_rating.status', 1)->where('product_rating.product_id', $product_id)->orderBy('product_rating.created_on', 'DESC')->skip($page_limit)->take($resultsPerPage)->get();
        // For Next load more
        $rating_count_arr = DB::table('product_rating')->leftJoin('brandmembers', 'brandmembers.id', '=', 'product_rating.user_id')->select('product_rating.*')->where('product_rating.status', 1)->where('product_rating.product_id', $product_id)->skip($next_check_page)->take($resultsPerPage)->get();
        foreach ($rating as $prate) {
            ?>
        <div class="rating_block clearfix">
          <h5 class="text-capitalize"><?php 
            echo $prate->rating_title;
            ?>
</h5>
              <div class="total_rev"><p> &ldquo; <?php 
            echo $prate->comment;
            ?>
  &rdquo;</p>
                <div class="ratn_box">
                  <div id="rate<?php 
            echo $prate->rating_id;
            ?>
"></div>
                </div>
              </div>
              <div class="bot_rev">
                <p class="author pull-left">Authored by <a href=""><?php 
            echo !empty($prate->username) ? $prate->username : $prate->buser;
            ?>
</a> </p>
                <p class="date pull-left"><?php 
            echo $obj->time_elapsed_string(strtotime($prate->created_on));
            ?>
</p>
              </div>
         </div>
          <script>
            $(document).ready(function(){
              $('#rate<?php 
            echo $prate->rating_id;
            ?>
').raty({
              readOnly: true,
              score: <?php 
            echo $prate->rating_value;
            ?>
,
              starHalf    : '<?php 
            echo url();
            ?>
/public/frontend/css/images/star-half.png',
              starOff     : '<?php 
            echo url();
            ?>
/public/frontend/css/images/star-off.png',
              starOn      : '<?php 
            echo url();
            ?>
/public/frontend/css/images/star-on.png'  , 
              });
            });
          </script>
        <?php 
        }
        // if(count($rating) == $resultsPerPage){
        if (count($rating_count_arr) > 0) {
            ?>

		 	<!-- <button class="loadmore" data-page="<?php 
            echo $paged + 1;
            ?>
">Load More</button> -->
            <div class="wrap_load">
		 	<a href="javascript:void(0);" class="btn btn-special loadmore" data-page="<?php 
            echo $paged + 1;
            ?>
">View More Reviews</a><span class="disable_click"></span>
            </div>
		 <?php 
        }
        //        else{
        //  	echo "<h3>No More Rating</h3>";
        // }
    }
Exemplo n.º 21
0
 public function delAddress()
 {
     $obj = new helpers();
     if (!$obj->checkMemberLogin()) {
         return redirect('memberLogin');
     }
     $id = Request::input('id');
     if (empty($id)) {
         return redirect('member-shipping-address');
     }
     $address = Address::find($id);
     try {
         if ($address->delete()) {
             Session::flash('success', 'Shipping Address successfully deleted.');
             return redirect('member-shipping-address');
         } else {
             Session::flash('error', 'Unable to delete record.');
             return redirect('member-shipping-address');
         }
     } catch (PDOException $e) {
     }
 }
Exemplo n.º 22
0
 public function redeem_cart()
 {
     $obj = new helpers();
     $points = Request::input('user_points');
     $member = DB::table('brandmembers')->where("id", Session::get('member_userid'))->first();
     if ($points > $member->user_points) {
         Session::flash('error', "You don't have enough points to redeem.");
         return redirect('show-cart');
     }
     $setting_point_price = DB::table('sitesettings')->where('name', 'price_for_point')->first();
     $setting_point = DB::table('sitesettings')->where('name', 'points_for_price')->first();
     $amount = $points * $setting_point_price->value;
     $total_amount = Cart::total();
     if ($amount > $total_amount) {
         Session::flash('error', "Your redeem value is higher than total amount.");
         return redirect('show-cart');
     }
     $obj->demandredeem($points, $amount);
     Session::flash('success', '$' . $amount . ' Is applied as redeem amount in your cart.');
     return redirect('show-cart');
 }