final checkout and card
This commit is contained in:
parent
4bd21bd986
commit
1953c97cd0
33 changed files with 2131 additions and 1084 deletions
|
|
@ -5,8 +5,9 @@ namespace App\Http\Controllers\Web;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShippingCountry;
|
||||
use Util;
|
||||
use App\Models\ShoppingInstance;
|
||||
use Validator;
|
||||
use App\Services\Util;
|
||||
use Yard;
|
||||
use Input;
|
||||
|
||||
|
|
@ -33,8 +34,10 @@ class CardController extends Controller
|
|||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product_slug]);
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product_slug, 'weight' => $product->weight]);
|
||||
\Session()->flash('show-card-after-add', true);
|
||||
}
|
||||
|
||||
return back();
|
||||
|
||||
}
|
||||
|
|
@ -50,7 +53,8 @@ class CardController extends Controller
|
|||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$quantity = Input::get('quantity') ? Input::get('quantity') : 1;
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product->slug]);
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
\Session()->flash('show-card-after-add', true);
|
||||
}
|
||||
return back();
|
||||
|
||||
|
|
@ -60,12 +64,11 @@ class CardController extends Controller
|
|||
public function showCard(){
|
||||
|
||||
if(Input::get('selected_country')){
|
||||
$selected_country = Input::get('selected_country');
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Input::get('selected_country'));
|
||||
}else{
|
||||
$ShippingCountry = ShippingCountry::where('country_id', 1)->first();
|
||||
$selected_country = $ShippingCountry->id;
|
||||
// $ShippingCountry = ShippingCountry::where('country_id', 1)->first();
|
||||
// $selected_country = $ShippingCountry->id;
|
||||
}
|
||||
Yard::instance('shopping')->setShippingCountry($selected_country);
|
||||
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
|
|
@ -86,29 +89,31 @@ class CardController extends Controller
|
|||
return back();
|
||||
}
|
||||
|
||||
public function checkoutCard(){#
|
||||
if(Input::get('selected_country')){
|
||||
$selected_country = Input::get('selected_country');
|
||||
}else{
|
||||
$ShippingCountry = ShippingCountry::where('country_id', 1)->first();
|
||||
$selected_country = $ShippingCountry->id;
|
||||
}
|
||||
Yard::instance('shopping')->setShippingCountry($selected_country);
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.checkout', $data);
|
||||
public function checkoutServer(){
|
||||
|
||||
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
|
||||
]);
|
||||
Yard::instance('shopping')->store($identifier);
|
||||
|
||||
//add to DB
|
||||
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
|
||||
$path = str_replace('http', 'https', $path);
|
||||
return redirect()->secure($path);
|
||||
}
|
||||
|
||||
public function checkoutFinalCard(){
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.checkout-final', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function removeCard($rowId){
|
||||
|
||||
Yard::instance('shopping')->remove($rowId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue