Issues fixed

This commit is contained in:
jitendra 2018-10-26 19:13:01 +05:30
parent fbe8f844e1
commit 27b1f1fad9
16 changed files with 52 additions and 22 deletions

View File

@ -51,7 +51,7 @@ return [
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/public/storage',
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],

View File

@ -52,7 +52,7 @@ class Order {
*/
public function updateProductInventory($order)
{
$productListener = app(Webkul\Admin\Listeners\Product::class);
$productListener = app(\Webkul\Admin\Listeners\Product::class);
foreach ($order->items as $item) {
$productListener->afterProductCreated($item->product);

View File

@ -97,7 +97,7 @@ class Product {
} else {
$qty = 0;
foreach($product->inventories->get() as $inventory_source) {
foreach($product->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}

View File

@ -41,7 +41,8 @@ class NewOrderNotification extends Mailable
*/
public function build()
{
return $this->to($this->order->customer_email, $this->order->customer_full_name)
if($this->order->customer_email)
return $this->to($this->order->customer_email, $this->order->customer_full_name)
->subject(trans('shop::app.mail.order.subject'))
->view('shop::emails.sales.new-order');
}

View File

@ -75,7 +75,7 @@
<div class="adjacent-center">
<div class="brand-logo">
<img src="{{ asset('vendor/webkul/admin/assets/images/logo.png') }}" alt="Bagisto"/>
<img src="{{ asset('vendor/webkul/ui/assets/images/logo.png') }}" alt="Bagisto"/>
</div>
@yield('content')

View File

@ -8,7 +8,7 @@ mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();
mix.js(__dirname + "/src/Resources/assets/js/app.js", "js/admin.js")
// .copyDirectory( __dirname + '/src/Resources/assets/images', publicPath + '/images')
.copyDirectory( __dirname + '/src/Resources/assets/images', publicPath + '/images')
.sass(__dirname + "/src/Resources/assets/sass/app.scss", "css/admin.css")
.options({
processCssUrls: false

View File

@ -708,11 +708,11 @@ class Cart {
if($billingAddressModel = $cart->billing_address) {
$this->cartAddress->update($billingAddress, $billingAddressModel->id);
if($shippingAddress = $cart->shipping_address) {
if($shippingAddressModel = $cart->shipping_address) {
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
$this->cartAddress->update($billingAddress, $shippingAddress->id);
$this->cartAddress->update($billingAddress, $shippingAddressModel->id);
} else {
$this->cartAddress->update($shippingAddress, $shippingAddress->id);
$this->cartAddress->update($shippingAddress, $shippingAddressModel->id);
}
} else {
if(isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
@ -731,7 +731,10 @@ class Cart {
}
}
// If customer is guest, than save shipping address's email and name in cart as customer details
$cart->customer_email = $cart->shipping_address->email;
$cart->customer_first_name = $cart->shipping_address->first_name;
$cart->customer_last_name = $cart->shipping_address->last_name;
$cart->save();
return true;
}

View File

@ -9,7 +9,7 @@ class CartAddress extends Model
{
protected $table = 'cart_address';
protected $fillable = ['first_name', 'last_name', 'email', 'address1', 'address2', 'city', 'state', 'postcode', 'country', 'email', 'phone', 'address_type', 'cart_id'];
protected $fillable = ['first_name', 'last_name', 'email', 'address1', 'address2', 'city', 'state', 'postcode', 'country', 'phone', 'address_type', 'cart_id'];
/**
* Get the shipping rates for the cart address.

View File

@ -16,7 +16,7 @@ class CreateCustomersTable extends Migration
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('SET NULL');
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('restrict');
$table->string('first_name');
$table->string('last_name');
$table->enum('gender', ['Male', 'Female']);
@ -26,7 +26,7 @@ class CreateCustomersTable extends Migration
$table->tinyInteger('status')->default(1);
$table->string('password');
$table->integer('customer_group_id')->unsigned()->nullable();
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('SET NULL');
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('set null');
$table->boolean('subscribed_to_news_letter')->default(0);
$table->rememberToken();
$table->timestamps();

View File

@ -46,4 +46,12 @@ class Customer extends Authenticatable
{
$this->notify(new CustomerResetPassword($token));
}
/**
* Get the customer address that owns the customer.
*/
public function address()
{
return $this->hasOne(CustomerAddress::class);
}
}

View File

@ -154,6 +154,8 @@ class InvoiceRepository extends Repository
$this->order->collectTotals($order);
$this->order->updateOrderStatus($order);
Event::fire('sales.invoice.save.after', $invoice);
} catch (\Exception $e) {
DB::rollBack();
@ -162,8 +164,6 @@ class InvoiceRepository extends Repository
DB::commit();
Event::fire('sales.invoice.save.after', $invoice);
return $invoice;
}

View File

@ -109,6 +109,8 @@ class OrderRepository extends Repository
$this->orderItemInventory->create(['orderItem' => $orderItem]);
}
Event::fire('checkout.order.save.after', $order);
} catch (\Exception $e) {
DB::rollBack();
@ -117,8 +119,6 @@ class OrderRepository extends Repository
DB::commit();
Event::fire('checkout.order.save.after', $order);
return $order;
}

View File

@ -128,6 +128,8 @@ class ShipmentRepository extends Repository
}
$this->order->updateOrderStatus($order);
Event::fire('sales.shipment.save.after', $shipment);
} catch (\Exception $e) {
DB::rollBack();
@ -136,8 +138,6 @@ class ShipmentRepository extends Repository
DB::commit();
Event::fire('sales.shipment.save.after', $shipment);
return $shipment;
}
}

View File

@ -117,6 +117,17 @@
var paymentHtml = '';
var reviewHtml = '';
var summaryHtml = Vue.compile(`<?php echo view('shop::checkout.total.summary', ['cart' => $cart])->render(); ?>`);
var customerAddress = null;
@auth('customer')
@if(auth('customer')->user()->address)
customerAddress = @json(auth('customer')->user()->address);
@else
customerAddress = {};
@endif
customerAddress.email = "{{ auth('customer')->user()->email }}";
customerAddress.first_name = "{{ auth('customer')->user()->first_name }}";
customerAddress.last_name = "{{ auth('customer')->user()->last_name }}";
@endauth
Vue.component('checkout', {
@ -146,6 +157,13 @@
countryStates: @json(core()->groupedStatesByCountries())
}),
created() {
if(customerAddress) {
this.address.billing = customerAddress;
this.address.use_for_shipping = true;
}
},
methods: {
navigateToStep (step) {
if(step <= this.completedStep) {

View File

@ -100,7 +100,7 @@
<div class="order-description">
<div class="pull-left" style="width: 50%;">
<div class="pull-left" style="width: 50%;float: left;">
<div class="shipping">
<div class="decorator">
@ -128,7 +128,7 @@
</div>
<div class="pull-right" style="width: 50%;">
<div class="pull-right" style="width: 50%;float: left;">
@include('shop::checkout.total.summary', ['cart' => $cart])

View File

@ -12,7 +12,7 @@ class AdminsTableSeeder extends Seeder
{
$role = Role::first();
$admin = new Admin();
$admin->name = str_random(8);
$admin->name = 'Example';
$admin->email = 'admin@example.com';
$admin->password = bcrypt('admin123');
$admin->status = 1;