final checkout and card
This commit is contained in:
parent
4bd21bd986
commit
1953c97cd0
33 changed files with 2131 additions and 1084 deletions
|
|
@ -10,7 +10,7 @@ use App\Services\Util;
|
|||
use Yard;
|
||||
use Input;
|
||||
|
||||
class CardController extends Controller
|
||||
class CheckoutController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
|
@ -23,72 +23,12 @@ class CardController extends Controller
|
|||
|
||||
|
||||
|
||||
//Cart::instance('wishlist')->add('sdjk922', 'Product 2', 1, 19.95, ['size' => 'medium']);
|
||||
public function addToCardGet($id, $quantity = 1, $product_slug = false)
|
||||
{
|
||||
public function checkout(){
|
||||
|
||||
$product = Product::find($id);
|
||||
if($product){
|
||||
$image = "";
|
||||
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, 'weight' => $product->weight]);
|
||||
\Session()->flash('show-card-after-add', true);
|
||||
}
|
||||
|
||||
return back();
|
||||
|
||||
}
|
||||
|
||||
public function addToCardPost($id)
|
||||
{
|
||||
|
||||
$product = Product::find($id);
|
||||
|
||||
if($product){
|
||||
$image = "";
|
||||
if($product->images->count()){
|
||||
$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, 'weight' => $product->weight]);
|
||||
\Session()->flash('show-card-after-add', true);
|
||||
}
|
||||
return back();
|
||||
$user_shop = Util::getUserShop();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function showCard(){
|
||||
|
||||
if(Input::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Input::get('selected_country'));
|
||||
}else{
|
||||
// $ShippingCountry = ShippingCountry::where('country_id', 1)->first();
|
||||
// $selected_country = $ShippingCountry->id;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user_shop' => Util::getUserShop(),
|
||||
];
|
||||
return view('web.templates.card', $data);
|
||||
}
|
||||
|
||||
public function updateCard(){
|
||||
|
||||
$data = Input::all();
|
||||
if(isset($data['quantity'])){
|
||||
foreach ($data['quantity'] as $rowId => $qty){
|
||||
Yard::instance('shopping')->update($rowId, $qty);
|
||||
}
|
||||
}else{
|
||||
$this->deleteCard();
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
public function checkoutCard(){#
|
||||
if(Input::get('selected_country')){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice(Input::get('selected_country'));
|
||||
}else{
|
||||
|
|
@ -101,7 +41,7 @@ class CardController extends Controller
|
|||
return view('web.templates.checkout', $data);
|
||||
}
|
||||
|
||||
public function checkoutFinalCard(){
|
||||
public function checkoutFinal(){
|
||||
|
||||
$rules = array(
|
||||
'billing.firstname'=>'required',
|
||||
|
|
@ -136,7 +76,6 @@ class CardController extends Controller
|
|||
|
||||
|
||||
public function removeCard($rowId){
|
||||
|
||||
Yard::instance('shopping')->remove($rowId);
|
||||
return back();
|
||||
}
|
||||
|
|
@ -147,8 +86,4 @@ class CardController extends Controller
|
|||
return back();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue