cart responsive, Checkout from cart
This commit is contained in:
parent
bde1095014
commit
fb27009339
17 changed files with 501 additions and 319 deletions
|
|
@ -5,8 +5,11 @@ namespace App\Http\Controllers\User;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\UserHistory;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Request;
|
||||
|
|
@ -113,7 +116,6 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
public function payment($for, $id=null){
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
$user = User::find(Auth::user()->id);
|
||||
|
|
@ -131,79 +133,39 @@ class OrderController extends Controller
|
|||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
if($for === 'me'){
|
||||
if(Request::get('switchers-comp-product')) {
|
||||
$product = Product::find(Request::get('switchers-comp-product'));
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, ['image' => '', 'slug' => $product->slug, 'weight' => 0]);
|
||||
}
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
$data['is_from'] = 'user_order';
|
||||
$data['is_for'] = $for;
|
||||
$data['shopping_user_id'] = $id;
|
||||
unset($data['quantity']);
|
||||
unset($data['_token']);
|
||||
|
||||
}
|
||||
// Yard::instance('shopping')->destroy();
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for buy intern
|
||||
'auth_user_id' => Auth::user()->id,
|
||||
'payment' => 2, //Berater Shop
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'shopping_data' => $data,
|
||||
'back' => url()->previous(),
|
||||
|
||||
return back()->withInput(Request::all());
|
||||
|
||||
if($for === 'ot' && $id){
|
||||
dd($data);
|
||||
|
||||
}
|
||||
]);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
|
||||
Yard::instance('shopping')->destroy();
|
||||
$product = Product::find(Request::get('switchers-package-wizard'));
|
||||
$showAboOptions = false;
|
||||
if(Request::get('abo_options')){
|
||||
$showAboOptions = true;
|
||||
$user->abo_options = true;
|
||||
$user->save();
|
||||
}
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'abo_options'=>0]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
|
||||
if($product && $product->active && $product->show_at == 3){
|
||||
//set membership product
|
||||
$image = "";
|
||||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
|
||||
|
||||
//set onboarding products
|
||||
if(Request::get('products_on_board')){
|
||||
foreach (Request::get('products_on_board') as $product_on_board_id){
|
||||
$product_on_board = Product::find($product_on_board_id);
|
||||
$image = "";
|
||||
if($product_on_board->images->count()){
|
||||
$image = $product_on_board->images->first()->slug;
|
||||
}
|
||||
Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->price, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight]);
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => 1, //is first faker shop for buy intern
|
||||
'auth_user_id' => Auth::user()->id,
|
||||
'payment' => 4, //Berater Wizard
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
|
||||
]);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'wizard_payment', 'status'=>1, 'product_id'=>$product->id, 'identifier'=>$identifier, 'abo_options'=>$showAboOptions]);
|
||||
//$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
|
||||
}
|
||||
|
||||
\Session()->flash('alert-error', "Fehler beim Produkt");
|
||||
return back();
|
||||
}
|
||||
|
||||
private function checkShoppingCountry($for, $id=null){
|
||||
|
||||
$country_id = null;
|
||||
if($for === 'me'){
|
||||
$user = User::find(\Auth::user()->id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue