Before merge for cart

This commit is contained in:
prashant-webkul 2018-09-27 15:37:54 +05:30
commit a794aa0b44
44 changed files with 1296 additions and 2871 deletions

View File

@ -8,6 +8,7 @@ use Webkul\Cart\Repositories\CartItemRepository;
use Webkul\Cart\Repositories\CartAddressRepository;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Product\Repositories\ProductRepository;
use Webkul\Cart\Models\CartPayment;
use Cookie;
/**
@ -301,6 +302,10 @@ class Cart {
*/
public function add($id, $data)
{
// session()->forget('cart');
// return redirect()->back();
$itemData = $this->prepareItemData($id, $data);
if(session()->has('cart')) {
@ -311,6 +316,7 @@ class Cart {
if(isset($cartItems)) {
foreach($cartItems as $cartItem) {
if($data['is_configurable'] == "false") {
if($cartItem->product_id == $id) {
$prevQty = $cartItem->quantity;
@ -323,6 +329,7 @@ class Cart {
return redirect()->back();
}
} else if($data['is_configurable'] == "true") {
//check the parent and child records that holds info abt this product.
if($cartItem->product_id == $data['selected_configurable_option']) {
$child = $cartItem;
@ -397,79 +404,66 @@ class Cart {
$customerCartItems = $this->cart->items($customerCart['id']);
if(isset($customerCart)) {
foreach($customerCartItems as $customerCartItem) {
foreach($cartItems as $cartItem) {
foreach($cartItems as $key => $cartItem) {
// foreach($customerCartItems as $customerCartItem) {
if($cartItem->type == "simple" && !isset($cartItem->parent_id)) {
// // dd($customerCartItems, $cartItems[0]->parent_id);
if($customerCartItem->type == "simple" && !isset($customerCartItem->parent_id)) {
// if($cartItem->type == "simple" && $cartItem->parent_id == "null") {
// if($customerCartItem->type == "simple" && $customerCartItem->parent_id == "null") {
// //update the customer cart item details and delete the guest instance
//update the customer cart item details and delete the guest instance
if($customerCartItem->product_id == $cartItem->productId) {
// if($customerCartItem->product_id == $cartItem->productId) {
$prevQty = $cartItem->quantity;
$newQty = $customerCartItem->quantity;
// $prevQty = $cartItem->quantity;
// $newQty = $customerCartItem->quantity;
$customerCartItem->update([
'quantity' => $prevQty + $newQty,
'item_total' => $customerCartItem->price * ($prevQty + $newQty),
'base_item_total' => $customerCartItem->price * ($prevQty + $newQty),
'item_total_weight' => $customerCartItem->weight * ($prevQty + $newQty),
'base_item_total_weight' => $customerCartItem->weight * ($prevQty + $newQty)
]);
}
}
} else if($cartItem->type == "simple" && isset($cartItem->parent_id)) {
if($customerCartItem->type == "simple" && isset($customerCartItem->parent_id)) {
}
}
}
// if($customerCartItem->type == "simple" && isset($customerCartItem->parent_id)) {
// //write the merge case whem the items exists with the customer cart also.
// $child = $customerCartItem;
// $parentId = $child->parent_id;
// $parent = $this->cartItem->findOneByField('id', $parentId);
// $parentPrice = $parent->price;
// $prevQty = $parent->quantity;
// foreach ($cartItems as $key => $cartItem) {
// if ($cartItem->type == "simple" && isset($cartItem->parent_id)) {
// $newQty = $data['quantity'];
// $parent->update(['quantity' => $prevQty + $newQty, 'item_total' => $parentPrice * ($prevQty + $newQty)]);
// } else if($cartItem->type == "simple" && is_null($cartItem->parent_id)){
// $customerCartItem->update([
// 'quantity' => $prevQty + $newQty,
// 'item_total' => $customerCartItem->price * ($prevQty + $newQty),
// 'base_item_total' => $customerCartItem->price * ($prevQty + $newQty),
// 'item_total_weight' => $customerCartItem->weight * ($prevQty + $newQty),
// 'base_item_total_weight' => $customerCartItem->weight * ($prevQty + $newQty)
// ]);
// $cartItems->forget($key);
// }
// }
// } elseif($customerCartItem->type == "simple" && !isset($customerCartItem->parent_id)) {
// foreach($cartItems as $key => $cartItem) {
// } else if($cartItem->type == "simple" && $cartItem->parent_id != "null") {
// if($customerCartItem->type == "simple" && $customerCartItem->parent_id != "null") {
// //guest cartParent
// $cartItemParentId = $cartItem->parent_id;
// $cartItemParent = $this->cartItem->findOneByField('id', $cartItemParentId);
// //customer cartParent
// $customerItemParentId = $customerCartItem->parent_id;
// $customerItemParent = $this->cartItem->findOneByField('id', $customerItemParentId);
// if($cartItem->product_id == $customerCartItem->product_id) {
// $cartItemQuantity = $cartItemParent->quantity;
// $customerItemQuantity = $customerCartItem->quantity;
// $customerCartItemQuantity = $customerItemParent->quantity;
// $cartItemQuantity = $cartItem->quantity;
// $customerCartItem->update(['cart_id' => $customerCart->id, 'quantity' => $cartItemQuantity + $customerItemQuantity]);
// $this->cartItem->delete($cartItem->id);
// $customerCartItem->update([
// 'quantity' => $cartItemQuantity + $customerCartItemQuantity,
// 'item_total' => $customerItemParent->price * ($cartItemQuantity + $customerCartItemQuantity),
// 'base_item_total' => $customerItemParent->price * ($cartItemQuantity + $customerCartItemQuantity),
// 'item_total_weight' => $customerItemParent->weight * ($cartItemQuantity + $customerCartItemQuantity),
// 'base_item_total_weight' => $customerItemParent->weight * ($cartItemQuantity + $customerCartItemQuantity),
// ]);
// $cartItems->forget($key);
// }
// }
// }
// }
}
foreach($cartItems as $cartItem) {
$cartItem->update(['cart_id' => $customerCart->id]);
$cartItem->update(['cart_id' => $customerCart['id']]);
}
$this->cart->delete($cart->id);
return redirect()->back();
@ -486,6 +480,20 @@ class Cart {
}
}
/**
* Destroys the session
* maintained for cart
* on customer logout.
*
* @return Mixed
*/
public function destroyCart() {
if(session()->has('cart')) {
session()->forget('cart');
return redirect()->back();
}
}
/**
* Returns cart
*
@ -496,7 +504,7 @@ class Cart {
if(!$cart = session()->get('cart'))
return false;
return $cart;
return $this->cart->find($cart->id);
}
/**
@ -553,12 +561,71 @@ class Cart {
if(!$cart = $this->getCart())
return false;
foreach($cart->shipping_rates as $rate) {
if($rate->method != $shippingMethodCode) {
$rate->delete();
}
}
$cart->shipping_method = $shippingMethodCode;
$cart->save();
// foreach($cart->shipping_rates as $rate) {
// if($rate->method != $shippingMethodCode) {
// $rate->delete();
// }
// }
return true;
}
/**
* Save payment method for cart
*
* @param string $payment
* @return Mixed
*/
public function savePaymentMethod($payment)
{
if(!$cart = $this->getCart())
return false;
if($cartPayment = $cart->payment)
$cartPayment->delete();
$cartPayment = new CartPayment;
$cartPayment->method = $payment['method'];
$cartPayment->cart_id = $cart->id;
$cartPayment->save();
return $cartPayment;
}
/**
* Updates cart totals
*
* @return void
*/
public function collectTotals()
{
if(!$cart = $this->getCart())
return false;
$cart->grand_total = 0;
$cart->base_grand_total = 0;
$cart->sub_total = 0;
$cart->base_sub_total = 0;
$cart->sub_total_with_discount = 0;
$cart->base_sub_total_with_discount = 0;
foreach ($cart->items()->get() as $item) {
$cart->grand_total = (float) $cart->grand_total + $item->price;
$cart->base_grand_total = (float) $cart->base_grand_total + $item->base_price;
$cart->sub_total = (float) $cart->sub_total + $item->price;
$cart->base_sub_total = (float) $cart->base_sub_total + $item->base_price;
}
if($shipping = $cart->selected_shipping_rate) {
$cart->grand_total = (float) $cart->grand_total + $shipping->price;
$cart->base_grand_total = (float) $cart->base_grand_total + $shipping->base_price;
}
$cart->save();
}
}

View File

@ -19,6 +19,7 @@ class CreateCartTable extends Migration
$table->foreign('customer_id')->references('id')->on('customers');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels');
$table->string('shipping_method')->nullable();
$table->string('coupon_code')->nullable();
$table->boolean('is_gift')->default(0);
$table->integer('items_count')->nullable();
@ -28,12 +29,12 @@ class CreateCartTable extends Migration
$table->string('base_currency_code')->nullable();
$table->string('store_currency_code')->nullable();
$table->string('quote_currency_code')->nullable();
$table->decimal('grand_total', 12, 4)->nullable();
$table->decimal('base_grand_total', 12, 4)->nullable();
$table->decimal('sub_total', 12, 4)->nullable();
$table->decimal('base_sub_total', 12, 4)->nullable();
$table->decimal('sub_total_with_discount', 12, 4)->nullable();
$table->decimal('base_sub_total_with_discount', 12, 4)->nullable();
$table->decimal('grand_total', 12, 4)->default(0)->nullable();
$table->decimal('base_grand_total', 12, 4)->default(0)->nullable();
$table->decimal('sub_total', 12, 4)->default(0)->nullable();
$table->decimal('base_sub_total', 12, 4)->default(0)->nullable();
$table->decimal('sub_total_with_discount', 12, 4)->default(0)->nullable();
$table->decimal('base_sub_total_with_discount', 12, 4)->default(0)->nullable();
$table->string('checkout_method')->nullable();
$table->boolean('is_guest')->nullable();
$table->boolean('is_active')->nullable()->default(0);

View File

@ -16,6 +16,7 @@ class CreateCartPayment extends Migration
Schema::create('cart_payment', function (Blueprint $table) {
$table->increments('id');
$table->string('method');
$table->string('method_title')->nullable();
$table->integer('cart_id')->nullable()->unsigned();
$table->foreign('cart_id')->references('id')->on('cart');
$table->timestamps();

View File

@ -20,7 +20,8 @@ class CreateCartShippingRatesTable extends Migration
$table->string('method');
$table->string('method_title');
$table->string('method_description')->nullable();
$table->double('price')->nullable();
$table->double('price')->default(0)->nullable();
$table->double('base_price')->default(0)->nullable();
$table->integer('cart_address_id')->nullable()->unsigned();
$table->foreign('cart_address_id')->references('id')->on('cart_address');
$table->timestamps();

View File

@ -0,0 +1,43 @@
<?php
namespace Webkul\Cart\Helpers;
use Webkul\Attribute\Repositories\AttributeOptionRepository as AttributeOption;
class Checkout
{
/**
* AttributeOptionRepository object
*
* @var array
*/
protected $attributeOption;
/**
* Create a new helper instance.
*
* @param Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOption
* @return void
*/
public function __construct(AttributeOption $attributeOption)
{
$this->attributeOption = $attributeOption;
}
/**
* Returns the allowed variants
*
* @param CartItem $item
* @return array
*/
public function getItemOptionDetails($item)
{
$data = [];
foreach ($item->product->super_attributes as $attribute) {
}
return $data;
}
}

View File

@ -140,4 +140,14 @@ class CartController extends Controller
}
dd($products);
}
public function mergeTest() {
$cartItems = $this->cart->findOneByField('customer_id', auth()->guard('customer')->user()->id)->items;
$tempId = 15;
foreach($cartItems as $cartItem) {
}
}
}

View File

@ -70,6 +70,13 @@ class CheckoutController extends Controller
*/
public function saveShipping()
{
$shippingMethod = request()->get('shipping_method');
if(!$shippingMethod || !Cart::saveShippingMethod($shippingMethod))
return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403);
Cart::collectTotals();
return response()->json(Payment::getSupportedPaymentMethods());
}
@ -80,5 +87,16 @@ class CheckoutController extends Controller
*/
public function savePayment()
{
$payment = request()->get('payment');
if(!$payment || !Cart::savePaymentMethod($payment))
return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403);
$cart = Cart::getCart();
return response()->json([
'jump_to_section' => 'review',
'html' => view('shop::checkout.onepage.review', compact('cart'))->render()
]);
}
}

View File

@ -5,6 +5,7 @@ namespace Webkul\Cart\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Product\Models\Product;
use Webkul\Cart\Models\CartAddress;
use Webkul\Cart\Models\CartPayment;
use Webkul\Cart\Models\CartShippingRate;
class Cart extends Model
@ -30,7 +31,7 @@ class Cart extends Model
/**
* Get the biling address for the cart.
*/
public function biling_address()
public function billing_address()
{
return $this->addresses()->where('address_type', 'billing');
}
@ -38,9 +39,9 @@ class Cart extends Model
/**
* Get all of the attributes for the attribute groups.
*/
public function getBilingAddressAttribute()
public function getBillingAddressAttribute()
{
return $this->biling_address()->first();
return $this->billing_address()->first();
}
/**
@ -66,4 +67,20 @@ class Cart extends Model
{
return $this->hasManyThrough(CartShippingRate::class, CartAddress::class, 'cart_id', 'cart_address_id');
}
/**
* Get all of the attributes for the attribute groups.
*/
public function getSelectedShippingRateAttribute()
{
return $this->shipping_rates()->where('method', $this->shipping_method)->first();
}
/**
* Get the payment associated with the cart.
*/
public function payment()
{
return $this->hasOne(CartPayment::class);
}
}

View File

@ -18,4 +18,12 @@ class CartAddress extends Model
{
return $this->hasMany(CartShippingRate::class);
}
/**
* Get all of the attributes for the attribute groups.
*/
public function getNameAttribute()
{
return $this->first_name . ' ' . $this->last_name;
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Cart\Models;
use Illuminate\Database\Eloquent\Model;
class CartPayment extends Model
{
protected $table = 'cart_payment';
}

View File

@ -8,6 +8,7 @@ use Webkul\Core\Models\Locale as LocaleModel;
use Webkul\Core\Models\Currency as CurrencyModel;
use Webkul\Core\Models\TaxCategory as TaxCategory;
use Webkul\Core\Models\TaxRate as TaxRate;
use Illuminate\Support\Facades\Config;
class Core
{
@ -127,6 +128,17 @@ class Core
return $currencySymbol = $this->getCurrentCurrency()->symbol;
}
/**
* Convert price with currency symbol
*
* @param float $price
* @return string
*/
public function convertPrice($price, $currencyCode = null)
{
return $price;
}
/**
* Format and convert price with currency symbol
*
@ -145,6 +157,17 @@ class Core
return currency($price, $currencyCode);
}
/**
* Format and convert price with currency symbol
*
* @param float $price
* @return string
*/
public function formatPrice($price, $currencyCode)
{
return currency($price, $currencyCode);
}
/**
* Checks if current date of the given channel (in the channel timezone) is within the range
*
@ -254,4 +277,21 @@ class Core
return $date->format($format);
}
/**
* Retrieve information from payment configuration
*
* @param string $field
* @param int|string|null $channelId
*
* @return mixed
*/
public function getConfigData($field, $channelId = null)
{
if (null === $channelId) {
$channelId = $this->getCurrentChannel()->id;
}
return Config::get($field);
}
}

View File

@ -21,7 +21,7 @@ class Payment
if($object->isAvailable()) {
$paymentMethods[] = [
'method' => $object->getCode(),
'title' => $object->getTitle(),
'method_title' => $object->getTitle(),
'description' => $object->getDescription(),
];
}

View File

@ -58,14 +58,8 @@ abstract class Payment
*
* @return mixed
*/
public function getConfigData($field, $channelId = null)
public function getConfigData($field)
{
if (null === $channelId) {
$channelId = core()->getCurrentChannel()->id;
}
$paymentConfig = Config::get('paymentmethods.' . $this->getCode());
return $paymentConfig[$field];
return core()->getConfigData('paymentmethods.' . $this->getCode() . '.' . $field);
}
}

View File

@ -67,16 +67,9 @@ abstract class AbstractShipping
*
* @return mixed
*/
public function getConfigData($field, $channelId = null)
public function getConfigData($field)
{
if (null === $channelId) {
$channelId = core()->getCurrentChannel()->id;
return core()->getConfigData('carriers.' . $this->getCode() . '.' . $field);
}
$shippingConfig = Config::get('carriers.' . $this->getCode());
return $shippingConfig[$field];
}
}
?>

View File

@ -36,7 +36,8 @@ class FlatRate extends AbstractShipping
$object->method = 'flatrate_flatrate';
$object->method_title = $this->getConfigData('title');
$object->method_description = $this->getConfigData('description');
$object->price = 10;
$object->price = core()->convertPrice($this->getConfigData('default_rate'));
$object->base_price = $this->getConfigData('default_rate');
return $object;
}

View File

@ -37,6 +37,7 @@ class Free extends AbstractShipping
$object->method_title = $this->getConfigData('title');
$object->method_description = $this->getConfigData('description');
$object->price = 0;
$object->base_price = 0;
return $object;
}

View File

@ -20,6 +20,8 @@ Route::group(['middleware' => ['web']], function () {
Route::get('test', 'Webkul\Cart\Http\Controllers\CartController@test');
Route::get('mtest', 'Webkul\Cart\Http\Controllers\CartController@mergeTest');
Route::post('/checkout/save-address', 'Webkul\Cart\Http\Controllers\CheckoutController@saveAddress')->name('shop.checkout.save-address');
Route::post('/checkout/save-shipping', 'Webkul\Cart\Http\Controllers\CheckoutController@saveShipping')->name('shop.checkout.save-shipping');

View File

@ -63,10 +63,10 @@ $(document).ready(function () {
const flashes = this.$refs.flashes;
flashMessages.forEach(function (flash) {
console.log(flash);
flashes.addFlash(flash);
}, this);
},
responsiveHeader: function () { }
}
});

View File

@ -1,32 +1,14 @@
//shop variables
$font-color: #242424;
$font-size-base: 16px;
$font-name: "Montserrat", sans-serif;
$background-color: #f2f2f2;
$footer-back: #f2f2f2;
$list-heading-color: rgba(165, 165, 165, 1);
$list-color: #242424;
$subscribe-btn-color: black;
$logo-color: #0031f0;
$border-color: #c7c7c7;
$offer-color: #ff6472;
$border-color: #E8E8E8;
$brand-color: #0031f0;
//shop variables ends here
//=======>Need to be removed
//customer variables
$sign-up-text-color: #5e5e5e;
$login-text: #3a3a3a;
$background-color: #ffffff;
$color-black : black;
$forgot-password-color: #0031f0;
$profile-content-color: #5e5e5e;
$horizontal-rule-color: #E8E8E8;
//customer variables ends here
//product
$real-price:#A5A5A5;
$product-font-color: #242424;
$product-special-price-color: #FF6472;
$product-price-color: #FF6472;
$dark-blue-shade: #0031F0;
$bar-color: #D8D8D8;
$gray-shade: #5E5E5E;
//<=======Need to be removed

File diff suppressed because it is too large Load Diff

View File

@ -54,3 +54,15 @@
width: 24px;
height: 24px;
}
.shipping-icon {
background-image: url('../images/shipping.svg');
width: 32px;
height: 32px;
}
.payment-icon {
background-image: url('../images/payment.svg');
width: 32px;
height: 32px;
}

View File

@ -87,7 +87,21 @@ return [
'use_for_shipping' => 'Ship to this address',
'continue' => 'Continue',
'shipping-method' => 'Shipping Method',
'payment-information' => 'Payment Information'
'payment-information' => 'Payment Information',
'summary' => 'Summary of Order',
'price' => 'Price',
'quantity' => 'Quantity',
'billing-address' => 'Billing Address',
'shipping-address' => 'Shipping Address',
'contact' => 'Contact',
'place-order' => 'Place Order'
],
'total' => [
'order-summary' => 'Order Summary',
'sub-total' => 'Sub Total',
'grand-total' => 'Grand Total',
'delivery-charges' => 'Delivery Charges'
]
]
];

View File

@ -20,6 +20,7 @@
<div class="left-side">
<div class="cart-item-list">
@foreach($cart->items as $item)
<?php
@ -66,6 +67,9 @@
</div>
@endforeach
</div>
<div class="misc-controls">
<span>Continue Shopping</span>
<button class="btn btn-lg btn-primary">PROCEED TO CHECKOUT</button>
@ -73,6 +77,7 @@
</div>
<div class="right-side">
<div class="price-section">
<div class="title">
Price Detail
@ -94,6 +99,7 @@
</div>
</div>
<div class="coupon-section">
<span class="title">Apply Coupon</span>

View File

@ -55,7 +55,7 @@
<div class="step-content shipping" v-show="currentStep == 2">
<shipping-section v-if="currentStep == 2"></shipping-section>
<shipping-section v-if="currentStep == 2" @onShippingMethodSelected="shippingMethodSelected($event)"></shipping-section>
<div class="button-group">
@ -69,7 +69,7 @@
<div class="step-content payment" v-show="currentStep == 3">
<payment-section v-if="currentStep == 3"></payment-section>
<payment-section v-if="currentStep == 3" @onPaymentMethodSelected="paymentMethodSelected($event)"></payment-section>
<div class="button-group">
@ -83,21 +83,34 @@
<div class="step-content review" v-show="currentStep == 4">
@include('shop::checkout.onepage.review')
<review-section v-if="currentStep == 4"></review-section>
<div class="button-group">
<button type="button" class="btn btn-lg btn-primary" @click="placeOrder()">
{{ __('shop::app.checkout.onepage.place-order') }}
</button>
</div>
</div>
@include('shop::checkout.onepage.summary')
</div>
<div class="col-right" v-show="currentStep != 4">
<summary-section></summary-section>
</div>
</div>
</script>
<script>
var shippingHtml = '';
var paymentHtml = '';
var reviewHtml = '';
var summaryHtml = Vue.compile(`<?php echo view('shop::checkout.total.summary', ['cart' => $cart])->render(); ?>`);
Vue.component('checkout', {
@ -120,9 +133,7 @@
selected_shipping_method: '',
selected_payment: {
method: ''
},
selected_payment_method: '',
}),
methods: {
@ -167,7 +178,7 @@
this.$http.post("{{ route('shop.checkout.save-shipping') }}", {'shipping_method': this.selected_shipping_method})
.then(function(response) {
if(response.data.jump_to_section == 'payment') {
shippingHtml = Vue.compile(response.data.html)
paymentHtml = Vue.compile(response.data.html)
this_this.completedStep = 2;
this_this.currentStep = 3;
}
@ -179,10 +190,10 @@
savePayment () {
var this_this = this;
this.$http.post("{{ route('shop.checkout.save-payment') }}", {'shipping_method': this.selected_payment_method})
this.$http.post("{{ route('shop.checkout.save-payment') }}", {'payment': this.selected_payment_method})
.then(function(response) {
if(response.data.jump_to_section == 'payment') {
shippingHtml = Vue.compile(response.data.html)
if(response.data.jump_to_section == 'review') {
reviewHtml = Vue.compile(response.data.html)
this_this.completedStep = 3;
this_this.currentStep = 4;
}
@ -192,6 +203,10 @@
})
},
placeOrder () {
},
handleErrorResponse (response, scope) {
if(response.status == 422) {
serverErrors = response.data.errors;
@ -201,10 +216,46 @@
window.location.href = response.data.redirect_url;
}
}
},
shippingMethodSelected (shippingMethod) {
this.selected_shipping_method = shippingMethod;
},
paymentMethodSelected (paymentMethod) {
this.selected_payment_method = paymentMethod;
}
}
})
var summaryTemplateRenderFns = [];
Vue.component('summary-section', {
inject: ['$validator'],
data: () => ({
templateRender: null
}),
staticRenderFns: summaryTemplateRenderFns,
mounted() {
this.templateRender = summaryHtml.render;
for (var i in summaryHtml.staticRenderFns) {
summaryTemplateRenderFns.push(summaryHtml.staticRenderFns[i]);
}
},
render(h) {
return h('div', [
(this.templateRender ?
this.templateRender() :
'')
]);
}
})
var shippingTemplateRenderFns = [];
Vue.component('shipping-section', {
@ -221,7 +272,7 @@
mounted() {
this.templateRender = shippingHtml.render;
for (var i in shippingHtml.staticRenderFns) {
shippingTemplateRenderFns.push(shippingHtml.staticRenderFns[i]);
shippingTemplateRenderFns.unshift(shippingHtml.staticRenderFns[i]);
}
},
@ -231,6 +282,12 @@
this.templateRender() :
'')
]);
},
methods: {
methodSelected () {
this.$emit('onShippingMethodSelected', this.selected_shipping_method)
}
}
})
@ -242,16 +299,50 @@
data: () => ({
templateRender: null,
selected_payment_method: '',
payment: {
method: ""
},
}),
staticRenderFns: paymentTemplateRenderFns,
mounted() {
this.templateRender = shippingHtml.render;
this.templateRender = paymentHtml.render;
for (var i in shippingHtml.staticRenderFns) {
paymentTemplateRenderFns.push(shippingHtml.staticRenderFns[i]);
for (var i in paymentHtml.staticRenderFns) {
paymentTemplateRenderFns.unshift(paymentHtml.staticRenderFns[i]);
}
},
render(h) {
return h('div', [
(this.templateRender ?
this.templateRender() :
'')
]);
},
methods: {
methodSelected () {
this.$emit('onPaymentMethodSelected', this.payment)
}
}
})
var reviewTemplateRenderFns = [];
Vue.component('review-section', {
data: () => ({
templateRender: null
}),
staticRenderFns: reviewTemplateRenderFns,
mounted() {
this.templateRender = reviewHtml.render;
for (var i in reviewHtml.staticRenderFns) {
reviewTemplateRenderFns.unshift(reviewHtml.staticRenderFns[i]);
}
},

View File

@ -11,9 +11,9 @@
@foreach ($paymentMethods as $payment)
<span class="radio" >
<input v-validate="'required'" type="radio" id="{{ $payment['method'] }}" name="payment[method]" value="{{ $payment['method'] }}" v-model="selected_payment_method">
<input v-validate="'required'" type="radio" id="{{ $payment['method'] }}" name="payment[method]" value="{{ $payment['method'] }}" v-model="payment.method" @change="methodSelected()">
<label class="radio-view" for="{{ $payment['method'] }}"></label>
{{ $payment['title'] }}
{{ $payment['method_title'] }}
</span>
<span class="control-info">{{ $payment['description'] }}</span>

View File

@ -0,0 +1,140 @@
<div class="form-container">
<div class="form-header">
<h1>{{ __('shop::app.checkout.onepage.summary') }}</h1>
</div>
<div class="address">
@if ($billingAddress = $cart->billing_address)
<div class="address-card billing-address">
<div class="card-title">
<span>{{ __('shop::app.checkout.onepage.billing-address') }}</span>
</div>
<div class="card-content">
{{ $billingAddress->name }}</br>
{{ $billingAddress->address1 }}, {{ $billingAddress->address2 ? $billingAddress->address2 . ',' : '' }} {{ $billingAddress->state }}</br>
{{ country()->name($billingAddress->country) }} {{ $billingAddress->postcode }}</br>
<span class="horizontal-rule"></span>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $billingAddress->phone }}
</div>
</div>
@endif
@if ($shippingAddress = $cart->shipping_address)
<div class="address-card shipping-address">
<div class="card-title">
<span>{{ __('shop::app.checkout.onepage.shipping-address') }}</span>
</div>
<div class="card-content">
{{ $shippingAddress->name }}</br>
{{ $shippingAddress->address1 }}, {{ $shippingAddress->address2 ? $shippingAddress->address2 . ',' : '' }} , {{ $shippingAddress->state }}</br>
{{ country()->name($shippingAddress->country) }} {{ $shippingAddress->postcode }}</br>
<span class="horizontal-rule"></span>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $shippingAddress->phone }}
</div>
</div>
@endif
</div>
@inject ('productImageHelper', 'Webkul\Product\Product\ProductImage')
<div class="cart-item-list">
@foreach($cart->items as $item)
<?php
$product = $item->product;
$productBaseImage = $productImageHelper->getProductBaseImage($product);
?>
<div class="item">
<div style="margin-right: 15px;">
<img class="item-image" src="{{ $productBaseImage['medium_image_url'] }}" />
</div>
<div class="item-details">
<div class="item-title">
{{ $product->name }}
</div>
<div class="row">
<span class="title">
{{ __('shop::app.checkout.onepage.price') }}
</span>
<span class="value">
{{ core()->currency($item->base_price) }}
</span>
</div>
<div class="row">
<span class="title">
{{ __('shop::app.checkout.onepage.quantity') }}
</span>
<span class="value">
{{ $item->quantity }}
</span>
</div>
@if ($product->type == 'configurable')
<div class="summary" >
@foreach ($product->super_attributes as $attribute)
{{ $attribute->name . ' : ' . $product->{$attribute->code} }},
@endforeach
</div>
@endif
</div>
</div>
@endforeach
</div>
<div class="order-description">
<div class="pull-left" style="width: 50%;">
<div class="shipping">
<div class="decorator">
<i class="icon shipping-icon"></i>
</div>
<div class="text">
{{ core()->currency($cart->selected_shipping_rate->base_price) }}
<div class="info">
{{ $cart->selected_shipping_rate->method_title }}
</div>
</div>
</div>
<div class="payment">
<div class="decorator">
<i class="icon payment-icon"></i>
</div>
<div class="text">
{{ core()->getConfigData('paymentmethods.' . $cart->payment->method . '.title') }}
</div>
</div>
</div>
<div class="pull-right" style="width: 50%;">
@include('shop::checkout.total.summary', ['cart' => $cart])
</div>
</div>
</div>

View File

@ -13,10 +13,10 @@
@foreach ($rateGroup['rates'] as $rate)
<span class="radio" >
<input v-validate="'required'" type="radio" id="{{ $rate->method }}" name="shipping_method" value="{{ $rate->method }}" v-model="selected_shipping_method">
<input v-validate="'required'" type="radio" id="{{ $rate->method }}" name="shipping_method" value="{{ $rate->method }}" v-model="selected_shipping_method" @change="methodSelected()">
<label class="radio-view" for="{{ $rate->method }}"></label>
{{ $rate->method_title }}
<b>{{ core()->currency($rate->price) }}</b>
<b>{{ core()->currency($rate->base_price) }}</b>
</span>
@endforeach

View File

@ -1,37 +0,0 @@
<div class="col-right">
<div class="order-summary">
<div class="price">
<span>{{ __('shop::app.checkout.onepage.order-summary') }}</span>
</div>
<div class="item-detail">
<span>
<label>2 Items Price</label>
<label class="right">$ 2,506.00</label>
</span>
</div>
<div class="item-detail">
<span>
<label>Delivery Charges</label>
<label class="right">$ 40.00</label>
</span>
</div>
<div class="item-detail">
<span>
<label>Coupan Discount</label>
<label class="right">$ 25.00</label>
</span>
</div>
<div class="horizontal-rule">
</div>
<div class="payble-amount">
<span>
<label>Amount Payble</label>
<label class="right">$ 2571.00</label>
</span>
</div>
</div>
</div>

View File

@ -0,0 +1,20 @@
<div class="order-summary">
<h3>{{ __('shop::app.checkout.total.order-summary') }}</h3>
<div class="item-detail">
<label>{{ __('shop::app.checkout.total.sub-total') }}</label>
<label class="right">{{ core()->currency($cart->sub_total) }}</label>
</div>
@if ($cart->selected_shipping_rate)
<div class="item-detail">
<label>{{ __('shop::app.checkout.total.delivery-charges') }}</label>
<label class="right">{{ core()->currency($cart->selected_shipping_rate->price) }}</label>
</div>
@endif
<div class="payble-amount">
<label>{{ __('shop::app.checkout.total.grand-total') }}</label>
<label class="right">{{ core()->currency($cart->grand_total) }}</label>
</div>
</div>

View File

@ -1,8 +0,0 @@
<div class="checkout-process">
@include('shop::customers.checkout.common.nav-left')
@include('shop::customers.checkout.common.nav-right')
</div>

View File

@ -1,53 +0,0 @@
<div class="left-side">
<div class="checkout-menu">
<ul class="checkout-detail">
<li>
<div class="wrapper">
<div class="decorator" v-bind:class="{ active: isGuest }">
<img src="{{asset('themes/default/assets/images/address.svg')}}" />
</div>
<span>Information</span>
</div>
</li>
<li>
<div class="wrapper" >
<div class="decorator" v-bind:class="{ active: isShip }">
<img src="{{asset('themes/default/assets/images/shipping.svg')}}"/>
</div>
<span>Shipping</span>
</div>
</li>
<li>
<div class="wrapper">
<div class="decorator">
<img src="{{asset('themes/default/assets/images/payment.svg')}}" />
</div>
<span>Payment</span>
</div>
</li>
<li>
<div class="wrapper">
<div class="decorator">
<img src="{{asset('themes/default/assets/images/finish.svg')}}" />
</div>
<span>Complete</span>
</div>
</li>
</ul>
<div class="horizontal-rule">
</div>
</div>
</div>

View File

@ -1,3 +0,0 @@
<div class="right-side">
</div>

View File

@ -1,265 +0,0 @@
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="checkout-process">
<div class="left-side">
<div class="checkout-menu">
<ul class="checkout-detail">
<li>
<div class="wrapper">
<div class="decorator active">
<img src="{{asset('themes/default/assets/images/completed.svg')}}" />
</div>
<span>Information</span>
</div>
</li>
<li>
<div class="wrapper">
<div class="decorator">
<img src="{{asset('themes/default/assets/images/completed.svg')}}" />
</div>
<span>Shipping</span>
</div>
</li>
<li>
<div class="wrapper">
<div class="decorator">
<img src="{{asset('themes/default/assets/images/completed.svg')}}" />
</div>
<span>Payment</span>
</div>
</li>
<li>
<div class="wrapper">
<div class="decorator">
<img src="{{asset('themes/default/assets/images/finish.svg')}}" />
</div>
<span>Complete</span>
</div>
</li>
</ul>
<div class="horizontal-rule">
</div>
</div>
</div>
</div>
<div class="complete-page">
<div class="order-summary">
<span>Summary of Order<span>
</div>
<div class="address">
<div class="shipping-address">
<div class="shipping-title">
<span>Shipping address</span>
</div>
<div class="shipping-content">
<div class="name">
<span>John Doe </span>
</div>
<div class="addr">
<span>
25 , Washington USA 5751434
</span>
</div>
<div class="horizontal-rule">
</div>
<div class="contact">
<span>Contact : 9876543210 </span>
</div>
</div>
</div>
<div class="billing-address">
<div class="shipping-title">
<span>Billing address</span>
</div>
<div class="shipping-content">
<div class="name">
<span>John Doe </span>
</div>
<div class="addr">
<span>
25 , Washington USA 5751434
</span>
</div>
<div class="horizontal-rule">
</div>
<div class="contact">
<span>Contact : 9876543210 </span>
</div>
</div>
</div>
</div>
<div class="product-detail">
<div class="product-image">
<img src="{{asset('themes/default/assets/images/1.png')}}" />
</div>
<div class="product-desc">
<div class="product-title">
<span>
Rainbow creation Embroidered
</span>
</div>
<div class="price">
<span>
<label>Price </label>
<label class="bold"> $40.00 </label>
<span>
</div>
<div class="quantity">
<span>
<label>Quantity</label>
<label class="quat-bold"> 1 </label>
<span>
</div>
<div class="pro-attribute">
<span>
Color : Grey, Size : S,Sleeve Type : Puffed Sleeves,Occasion : Birthday ,Marriage Anniversary
</span>
</div>
</div>
</div>
<div class="product-detail">
<div class="product-image">
<img src="{{asset('themes/default/assets/images/1.png')}}" />
</div>
<div class="product-desc">
<div class="product-title">
<span>
Rainbow creation Embroidered
</span>
</div>
<div class="price">
<span>
<label>Price </label>
<label class="bold"> $40.00 </label>
</span>
</div>
<div class="quantity">
<span>
<label>Quantity</label>
<label class="quat-bold"> 1 </label>
</span>
</div>
<div class="pro-attribute">
<span>
Color : Grey, Size : S,Sleeve Type : Puffed Sleeves,Occasion : Birthday ,Marriage Anniversary
</span>
</div>
</div>
</div>
<div class="order-description">
<div class="payment">
<div class="shipping">
<div class="pay-icon">
<img src="{{asset('themes/default/assets/images/shipping.svg')}}" />
</div>
<div class="shipping-text">
<div class="price">
<span>
$ 25.00
</span>
</div>
<div class="fedex-shipping">
<span>
FedEx Shipping
</span>
</div>
</div>
</div>
<div class="net-banking">
<div class="pay-icon">
<img src="{{asset('themes/default/assets/images/payment.svg')}}" />
</div>
<span>Net banking </span>
</div>
</div>
<div class="product-bill">
<div class="sub-total">
<span>
Subtotal
</span>
<span class="right">
$ 2,506.00
</span>
</div>
<div class="charge-discount">
<span>
Delivery Charges
</span>
<span class="right">
$ 40.00
</span>
</div>
<div class="charge-discount">
<span>
Coupan discount
</span>
<span class="right">
$ 25.00
</span>
</div>
<div class="horizontal-rule">
</div>
<div class="amount-pay">
<span>
Amount payable
</span>
<span class="right">
$ 2,571.00
</span>
</div>
</div>
</div>
<div class="horizontal-rule">
</div>
<div class="palce-order-button">
<button>PLACE ORDER </button>
</div>
</div>
@endsection

View File

@ -1,73 +0,0 @@
<div class="order-info">
<div class="order-guest">
<span class="order-text">
Order as Guest
</span>
<button class="btn btn-lg btn-primary sign-in">
SIGN IN
</button>
</div>
<div class="control-group">
<label for="first_name">Email address <span>*</span></label>
<input type="text" class="control" name="email_address">
</div>
<div class="control-group">
<label for="first_name">First Name <span>*</span> </label>
<input type="text" class="control" name="first_name">
</div>
<div class="control-group">
<label for="first_name">Last Name <span>*</span> </label>
<input type="text" class="control" name="last_name">
</div>
<div class="control-group">
<label for="first_name">Company Name <span>*</span> </label>
<input type="text" class="control" name="company_name">
</div>
<div class="control-group">
<label for="first_name">Street address <span>*</span> </label>
<input type="text" class="control" name="street_address">
</div>
<div class="control-group">
<label for="first_name">City <span>*</span> </label>
<input type="text" class="control" name="city">
</div>
<div class="control-group">
<label for="first_name">Country <span>*</span> </label>
<input type="text" class="control" name="country">
</div>
<div class="control-group">
<label for="first_name">Provinces <span>*</span> </label>
<input type="text" class="control" name="provinces">
</div>
<div class="control-group">
<label for="first_name">Zip code <span>*</span> </label>
<input type="text" class="control" name="zip_code">
</div>
<div class="control-group">
<label for="first_name">Phone number <span>*</span> </label>
<input type="text" class="control" name="phone_number">
</div>
<div class="different-billing-addr">
<span>qwdevf</span>
<span>Usedifferent address for billing?</span>
</div>
<div class="horizontal-rule">
</div>
<div class="countinue-button">
<button class="btn btn-lg btn-primary" @click="count()">CONTINUE</button>
</div>
</div>

View File

@ -1,66 +0,0 @@
@extends('shop::layouts.master')
@section('content-wrapper')
<checkout customer="{{$customer_id}}"> </checkout>
@endsection
@push('scripts')
<script type="text/x-template" id="checkout-template">
<div>
@include('shop::customers.checkout.common.common')
<div v-if="customer">
@include('shop::customers.checkout.ship-method')
</div>
<div v-if="!customer">
@include('shop::customers.checkout.guest')
</div>
</div>
</script>
<script>
Vue.component('checkout', {
props: ['customer'],
data: () => ({
isGuest:true,
isShip:false,
disabled: 0,
isShipMethod:false
}),
template: '#checkout-template',
mounted () {
if(this.customer){
this.isShip=true;
}else{
this.isGuest=true;
this.disabled=1;
}
} ,
methods: {
count () {
this.isShipMethod=true;
}
}
})
</script>
@endpush

View File

@ -1,57 +0,0 @@
@extends('shop::layouts.master')
@section('content-wrapper')
@include('shop::customers.checkout.common.common')
<div class="payment-method">
<div class="payment-info">
<span class="payment-text">
Payment Method
</span>
</div>
<div class="payment-price">
<div class="payment-checkbox">
<img src="{{asset('themes/default/assets/images/unselected.svg')}}" />
<span> Cash on Delivery</span>
</div>
<div class="payment-checkbox-text">
<b>Fadex - </b>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut.</span>
</div>
</div>
<div class="payment-price">
<div class="payment-checkbox">
<img src="{{asset('themes/default/assets/images/selected.svg')}}" />
<span> Net Banking</span>
</div>
<div class="payment-checkbox-text">
<b>Fadex - </b>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut.</span>
</div>
</div>
<div class="payment-price">
<div class="payment-checkbox">
<img src="{{asset('themes/default/assets/images/unselected.svg')}}" />
<span> Debit / Credit Card</span>
</div>
<div class="payment-checkbox-text">
<b>Fadex - </b>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut.</span>
</div>
</div>
<div class="horizontal-rule">
</div>
<div class="countinue-button">
<button>CONTINUE</button>
</div>
</div>
@endsection

View File

@ -1,52 +0,0 @@
<div class="ship-method">
<div class="ship-info">
<span class="ship-text">
Shipment Method
</span>
</div>
<div class="ship-price">
<div class="price-checkbox">
{{-- <img src="{{asset('themes/default/assets/images/selected.svg')}}" /> --}}
<input type="radio" name="gender" value="male" checked>
<span> $ 25.00 </span>
</div>
<div class="price-checkbox-text">
<b>Fadex - </b>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut.</span>
</div>
</div>
<div class="ship-price">
<div class="price-checkbox">
<img src="{{asset('themes/default/assets/images/unselected.svg')}}" />
<span> $ 25.00 </span>
</div>
<div class="price-checkbox-text">
<b>Fadex - </b>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut.</span>
</div>
</div>
<div class="ship-price">
<div class="price-checkbox">
<img src="{{asset('themes/default/assets/images/unselected.svg')}}" />
<span> $ 25.00 </span>
</div>
<div class="price-checkbox-text">
<b>Fadex - </b>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut.</span>
</div>
</div>
<div class="horizontal-rule">
</div>
<div class="countinue-button">
<button>CONTINUE</button>
</div>
</div>

View File

@ -1,40 +0,0 @@
@extends('shop::layouts.master')
@section('content-wrapper')
@include('shop::customers.checkout.common')
<div class="signin-form">
<div class="signin-guest">
<span class="signin-text">
Sign In
</span>
<button class="order-button">
ORDER AS GUEST
</button>
</div>
<div class="control-group">
<label for="first_name">Email </label>
<input type="text" class="control" name="email_address">
</div>
<div class="control-group">
<label for="first_name">Password </label>
<input type="text" class="control" name="first_name">
</div>
<div class="forgot-pass">
<span>Forgot Password</span>
</div>
<div class="horizontal-rule">
</div>
<div class="countinue-button">
<button>CONTINUE</button>
</div>
</div>
@endsection

View File

@ -21,6 +21,8 @@
<div id="app">
<flash-wrapper ref='flashes'></flash-wrapper>
<div class="main-container-wrapper">
@include('shop::layouts.header.index')

View File

@ -11,7 +11,7 @@
<span class="breadcrumb">Home</span> > <span class="breadcrumb">Men</span> > <span class="breadcrumb">Slit Open Jeans</span>
</div>
<div class="layouter">
<form method="POST" action="{{ route('cart.add', $product->id) }}">
<form method="POST" action="{{ route('cart.add', $product->id) }}" @submit.prevent="onSubmit">
@csrf()
<input type="hidden" name="product" value="{{ $product->id }}">

View File

@ -49,6 +49,8 @@
template: '#product-options-template',
inject: ['$validator'],
data: () => ({
config: @json($config),

View File

@ -1,3 +1,4 @@
{
"/js/app.js": "/js/app.js"
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}

File diff suppressed because it is too large Load Diff

View File

@ -1460,10 +1460,10 @@ $(document).ready(function () {
var flashes = this.$refs.flashes;
flashMessages.forEach(function (flash) {
console.log(flash);
flashes.addFlash(flash);
}, this);
},
responsiveHeader: function responsiveHeader() {}
}
});