review issues

This commit is contained in:
rahul shukla 2018-09-21 19:13:41 +05:30
commit 335f27e1f6
63 changed files with 3464 additions and 2430 deletions

View File

@ -40,7 +40,8 @@
"webkul/laravel-product": "self.version",
"webkul/laravel-shop": "self.version",
"webkul/laravel-theme": "self.version",
"webkul/laravel-shipping": "self.version"
"webkul/laravel-shipping": "self.version",
"webkul/laravel-payment": "self.version"
},
"autoload": {
"classmap": [
@ -61,7 +62,8 @@
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
"Webkul\\Product\\": "packages/Webkul/Product/src",
"Webkul\\Theme\\": "packages/Webkul/Theme/src",
"Webkul\\Shipping\\": "packages/Webkul/Shipping/src"
"Webkul\\Shipping\\": "packages/Webkul/Shipping/src",
"Webkul\\Payment\\": "packages/Webkul/Payment/src"
}
},
"autoload-dev": {

View File

@ -192,6 +192,7 @@ return [
Webkul\Theme\Providers\ThemeServiceProvider::class,
Webkul\Cart\Providers\CartServiceProvider::class,
Webkul\Shipping\Providers\ShippingServiceProvider::class,
Webkul\Payment\Providers\PaymentServiceProvider::class,
],
/*

View File

@ -5,12 +5,9 @@ return [
'code' => 'flatrate',
'title' => 'Flatrate',
'description' => 'This is a flat rate',
'status' => '1',
'active' => true,
'default_rate' => '10',
'type' => [
'per_unit' => 'Per Unit',
'per order' => 'Per Order',
],
'type' => 'per_unit',
'class' => 'Webkul\Shipping\Carriers\FlatRate',
]
];

13
config/paymentmethods.php Normal file
View File

@ -0,0 +1,13 @@
<?php
return [
'cashondelivery' => [
'code' => 'cashondelivery',
'title' => 'Cash On Delivery',
'class' => 'Webkul\Payment\Payment\Payment',
'order_status' => 'Pending',
'active' => true
]
];
?>

View File

@ -49,7 +49,7 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::customers.orders.index'
])->name('admin.customer.orders.index');
Route::get('customer/reviews', 'Webkul\Shop\Http\Controllers\ReviewController@index')->defaults('_config',[
Route::get('customer/reviews', 'Webkul\Product\Http\Controllers\ReviewController@index')->defaults('_config',[
'view' => 'admin::customers.review.index'
])->name('admin.customer.review.index');
@ -61,11 +61,11 @@ Route::group(['middleware' => ['web']], function () {
'redirect' => 'admin.customer.index'
])->name('admin.customer.store');
Route::get('customer/reviews/edit/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@edit')->defaults('_config',[
Route::get('customer/reviews/edit/{id}', 'Webkul\Product\Http\Controllers\ReviewController@edit')->defaults('_config',[
'view' => 'admin::customers.review.edit'
])->name('admin.customer.review.edit');
Route::put('customer/reviews/edit/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@update')->defaults('_config', [
Route::put('customer/reviews/edit/{id}', 'Webkul\Product\Http\Controllers\ReviewController@update')->defaults('_config', [
'redirect' => 'admin.customer.review.index'
])->name('admin.customer.review.update');
@ -73,9 +73,9 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::customers.edit'
])->name('admin.customer.edit');
Route::put('customer/reviews/edit/{id}', 'Webkul\Core\Http\Controllers\CustomerController@update')->defaults('_config', [
'redirect' => 'admin.customer.index'
])->name('admin.customer.update');
// Route::put('customer/reviews/edit/{id}', 'Webkul\Core\Http\Controllers\CustomerController@update')->defaults('_config', [
// 'redirect' => 'admin.customer.index'
// ])->name('admin.customer.update');
// dummy number i.e-1 is used for creating view only

View File

@ -113,7 +113,7 @@ class EventServiceProvider extends ServiceProvider
$acl->add('catalog.products', 'Products', 'admin.catalog.products.index', 1);
$acl->add('catalog.categories', 'Categories', 'admin.catalog.categories.index', 1);
$acl->add('configuration', 'Configure', 'admin.account.edit', 5);
$acl->add('settings', 'Settings', 'admin.users.index', 6);

View File

@ -45,11 +45,11 @@
<div class="control-group">
<label for="name" >{{ __('admin::app.customers.reviews.status') }}</label>
<select class="control" name="status">
<option value="1">
1
<option value="pending" {{ $review->status == "pending" ? 'selected' : ''}}>
pending
</option>
<option value="2">
2
<option value="approved" {{ $review->status == "approved" ? 'selected' : '' }}>
approved
</option>
</select>
</div>

View File

@ -6,7 +6,7 @@ use Carbon\Carbon;
//Cart repositories
use Webkul\Cart\Repositories\CartRepository;
use Webkul\Cart\Repositories\CartProductRepository;
use Webkul\Cart\Repositories\CartItemRepository;
//Customer repositories
use Webkul\Customer\Repositories\CustomerRepository;
@ -14,9 +14,9 @@ use Webkul\Customer\Repositories\CustomerRepository;
use Cookie;
/**
* Cart facade for all
* Facade for all
* the methods to be
* implemented for Cart.
* implemented in Cart.
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
@ -24,67 +24,74 @@ use Cookie;
class Cart {
protected $_config;
protected $cart;
protected $cartProduct;
protected $cartItem;
protected $customer;
//Cookie expiry limit in minutes
protected $minutes = 150;
protected $minutes;
public function __construct(CartRepository $cart, CartProductRepository $cartProduct, CustomerRepository $customer ,$minutes = 150) {
public function __construct(CartRepository $cart, CartItemRepository $cartItem, CustomerRepository $customer, $minutes = 150) {
$this->customer = $customer;
$this->cart = $cart;
$this->cartProduct = $cartProduct;
$this->cartItem = $cartItem;
$this->minutes = $minutes;
}
public function guestUnitAdd($id) {
public function guestUnitAdd($id, $data) {
//empty array for storing the products
//empty array for storing the products.
$products = array();
if(Cookie::has('cart_session_id')) {
//getting the cart session id from cookie
//getting the cart session id from cookie.
$cart_session_id = Cookie::get('cart_session_id');
//finding current cart instance in the database table.
$current_cart = $this->cart->findOneByField('session_id', $cart_session_id);
//check there is any cart or not
//check there is any cart or not.
if(isset($current_cart)) {
$current_cart_id = $current_cart['id'] ?? $current_cart->id;
$current_cart_session_id = $current_cart['session_id'] ?? $current_cart->session_id;
} else {
//if someone deleted then take the flow to the normal
//if someone deleted handle flow to the normal.
$this->repairCart($cart_session_id, $id);
}
//matching the session id present in the cookie and database are same or not.
//Matching the session id present in the cookie and database are same or not.
if((session()->get('cart_session_id') == Cookie::get('cart_session_id')) && ($current_cart_session_id == session()->get('cart_session_id'))) {
$current_cart_items = $this->cart->items($current_cart_id);
$current_cart_products = array();
$current_cart_products = $this->cart->getProducts($current_cart_id);
foreach($current_cart_items as $current_cart_item) {
array_push($current_cart_products, $this->cartItem->getProduct($current_cart_item->id));
}
//checking new product coming in the cart is new or previously added item.
foreach($current_cart_products as $key => $value) {
$product_id = $value['id'] ?? $value->id;
$product_id = $value;
if($product_id == $id) {
//create status code to communicate with session flash
//create status code to communicate with session flash.
$cartItemId = $this->cartItem->findOneByField('product_id', $id)->id;
$cartItemQuantity = $this->cartItem->findOneByField('product_id', $id)->quantity;
$this->cartItem->update(['quantity' => $cartItemQuantity + $data['quantity']], $cartItemId);
session()->flash('error', 'Item Already In Cart');
//remove this its temporary
//remove this its temporary.
dump('Item Already In Cart');
return redirect()->back();
@ -92,29 +99,27 @@ class Cart {
}
//cart data being attached to the instace.
$cart_data = $this->cart->attach($current_cart_id, $id, 1);
$cart_data = $this->cart->attach($current_cart_id, $id, $data['quantity'], $data['price']);
//getting the products after being attached to cart instance
$cart_products = $this->cart->getProducts($current_cart_id);
//getting the products after being attached to cart instance.
$cart_products = $this->cart->items($current_cart_id);
//storing the information in session.
session()->put('cart_data', [$current_cart, $cart_products]);
session()->flash('Success', 'Item Added To Cart Successfully');
dump($cart_products);
//return the control to the controller
//return the control to the controller.
return redirect()->back();
} else {
//repair the cart, will remake the session
//repair the cart, will remake the session.
//and add the product in the new cart instance.
$this->repairCart($cart_session_id, $id);
}
} else {
//function call
$this->createNewCart($id);
$this->createNewCart($id, $data);
}
}
@ -128,11 +133,12 @@ class Cart {
* @return mixed
*/
public function createNewCart($id) {
public function createNewCart($id, $data) {
$fresh_cart_session_id = session()->getId();
$data['session_id'] = $fresh_cart_session_id;
if(!auth()->guard('customer')->check())
$data['session_id'] = $fresh_cart_session_id;
$data['channel_id'] = core()->getCurrentChannel()->id;
@ -144,11 +150,13 @@ class Cart {
$cart_product['product_id'] = $id;
$cart_product['quantity'] = 1;
$cart_product['quantity'] = $data['quantity'];
$cart_product['cart_id'] = $new_cart_id;
if($cart_product = $this->cart->attach($new_cart_id, $cart_product['product_id'], $cart_product['quantity'])) {
$cart_product['price'] = $data['price'];
if($cart_product = $this->cart->attach($new_cart_id, $cart_product['product_id'], $cart_product['quantity'], $cart_product['price'])) {
session()->put('cart_data', [$cart, $cart_product]);
@ -248,7 +256,7 @@ class Cart {
of the logged in user.
*/
public function add($id) {
public function add($id, $itemdata) {
$products = array();
@ -272,24 +280,32 @@ class Cart {
* table.
*/
if(isset($customer_cart)) {
$customer_cart_products = $this->cart->getProducts($customer_cart_id);
$customer_cart_items = $this->cart->items($customer_cart_id);
$customer_cart_products = array();
foreach($customer_cart_items as $customer_cart_item) {
array_push($customer_cart_products, $this->cartItem->getProduct($customer_cart_item->id));
}
if (isset($customer_cart_products)) {
foreach ($customer_cart_products as $customer_cart_product) {
if($customer_cart_product->id == $id) {
dump('Item already exists in cart');
if($customer_cart_product == $id) {
$cartItemId = $this->cartItem->findOneByField('product_id', $id)->id;
$cartItemQuantity = $this->cartItem->findOneByField('product_id', $id)->quantity;
$this->cartItem->update(['quantity' => $cartItemQuantity + $itemdata['quantity']], $cartItemId);
session()->flash('error', 'Item already exists in cart');
return redirect()->back();
//maybe increase the quantity in here
}
}
//add the product in the cart
$this->cart->attach($customer_cart_id, $id, 1);
$this->cart->attach($customer_cart_id, $id, $itemdata['quantity'], $itemdata['price']);
session()->flash('success', 'Item Added To Cart Successfully');
@ -315,7 +331,7 @@ class Cart {
if($new_cart = $this->cart->create($data)) {
$new_cart_id = $new_cart->id ?? $new_cart['id'];
$this->cart->attach($new_cart_id, $id, 1);
$this->cart->attach($new_cart_id, $id, $itemdata['quantity'], $itemdata['price']);
session()->flash('success', 'Item Added To Cart Successfully');
@ -370,46 +386,60 @@ class Cart {
$guest_cart = $this->cart->findOneByField('session_id', $cart_session_id);
if(!isset($guest_cart)) {
dd('Some One Deleted Cart or it wasn\'t there from the start');
dd('Some One Deleted Cart');
return redirect()->back();
}
$guest_cart_items = $this->cart->items($guest_cart->id);
$guest_cart_products = $this->cart->getProducts($guest_cart->id);
$guest_cart_products = array();
foreach($guest_cart_items as $guest_cart_item) {
array_push($guest_cart_products, $this->cartItem->getProduct($guest_cart_item->id));
}
//check if the current logged in customer is also
//having any previously saved cart instances.
$customer_cart = $this->cart->findOneByField('customer_id', $customer_id);
if(isset($customer_cart)) {
$customer_cart_products = $this->cart->getProducts($customer_cart->id);
$customer_cart_items = $this->cart->items($customer_cart->id);
$customer_cart_products = array();
foreach($customer_cart_items as $customer_cart_item) {
array_push($customer_cart_products, $this->cartItem->getProduct($customer_cart_item->id));
}
foreach($guest_cart_products as $key => $guest_cart_product) {
foreach($customer_cart_products as $customer_cart_product) {
if($guest_cart_product == $customer_cart_product) {
$cartItemId = $this->cartItem->findWhere(['cart_id'=> $guest_cart->id, 'product_id' => $guest_cart_product])[0]->id;
if($guest_cart_product->id == $customer_cart_product->id) {
$cartItemQuantity = $this->cartItem->findWhere(['cart_id'=> $guest_cart->id, 'product_id' => $guest_cart_product])[0]->quantity;
$quantity = $guest_cart_product->toArray()['pivot']['quantity'] + 1;
$customerItemId = $this->cartItem->findWhere(['cart_id'=> $customer_cart->id, 'product_id' => $customer_cart_product])[0]->id;
$pivot = $guest_cart_product->toArray()['pivot'];
$customerItemQuantity = $this->cartItem->findWhere(['cart_id'=> $customer_cart->id, 'product_id' => $customer_cart_product])[0]->quantity;
$saveQuantity = $this->cart->updateRelatedForMerge($pivot, 'quantity', $quantity);
$this->cartItem->delete($cartItemId);
$this->cartItem->update(['quantity' => $cartItemQuantity + $customerItemQuantity], $customerItemId);
unset($guest_cart_products[$key]);
}
}
}
//insert the new products here.
foreach ($guest_cart_products as $key => $guest_cart_product) {
$product = $guest_cart_product->toArray();
// dd($this->cartItem->findWhere(['cart_id'=> $guest_cart->id, 'product_id' => $guest_cart_product])[0]);
$cartItemId = $this->cartItem->findWhere(['cart_id'=> $guest_cart->id, 'product_id' => $guest_cart_product])[0]->id;
$this->cart->updateRelatedForMerge($product['pivot'], 'cart_id', $customer_cart->id);
$this->cartItem->update(['cart_id' => $customer_cart->id], $cartItemId);
}
//detach with guest cart records
$this->cart->detachAndDeleteParent($guest_cart->id);
$this->cart->deleteParent($guest_cart->id);
Cookie::queue(Cookie::forget('cart_session_id'));

View File

@ -13,7 +13,7 @@ class CreateCartProductsTable extends Migration
*/
public function up()
{
Schema::create('cart_products', function (Blueprint $table) {
Schema::create('cart_items', function (Blueprint $table) {
$table->increments('id');
$table->integer('product_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products');

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCartAddress extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cart_address', function (Blueprint $table) {
$table->increments('id');
$table->string('address1');
$table->string('address2')->nullable();
$table->string('country');
$table->string('state');
$table->string('city');
$table->integer('postcode');
$table->string('phone');
$table->string('address_type');
$table->integer('cart_id')->nullable()->unsigned();
$table->foreign('cart_id')->references('id')->on('cart');
$table->integer('customer_id')->nullable()->unsigned();
$table->foreign('customer_id')->references('id')->on('customers');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cart_address');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCartPayment extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cart_payment', function (Blueprint $table) {
$table->increments('id');
$table->string('method');
$table->integer('cart_id')->nullable()->unsigned();
$table->foreign('cart_id')->references('id')->on('cart');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cart_payment');
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCartShipping extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cart_shipping', function (Blueprint $table) {
$table->increments('id');
$table->string('carrier');
$table->string('carrier_title');
$table->string('method');
$table->string('method_title');
$table->string('method_description')->nullable();
$table->double('price')->nullable();
$table->integer('cart_id')->nullable()->unsigned();
$table->foreign('cart_id')->references('id')->on('cart');
$table->integer('cart_address_id')->nullable()->unsigned();
$table->foreign('cart_address_id')->references('id')->on('cart_address');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cart_shipping');
}
}

View File

@ -7,7 +7,10 @@ use Illuminate\Http\Response;
//Cart repositories
use Webkul\Cart\Repositories\CartRepository;
use Webkul\Cart\Repositories\CartProductRepository;
use Webkul\Cart\Repositories\CartItemRepository;
//Product Repository
use Webkul\Product\Repositories\ProductRepository;
//Customer repositories
use Webkul\Customer\Repositories\CustomerRepository;
@ -36,11 +39,13 @@ class CartController extends Controller
protected $cart;
protected $cartProduct;
protected $cartItem;
protected $customer;
public function __construct(CartRepository $cart, CartProductRepository $cartProduct, CustomerRepository $customer) {
protected $product;
public function __construct(CartRepository $cart, CartItemRepository $cartItem, CustomerRepository $customer, ProductRepository $product) {
$this->middleware('customer')->except(['add', 'remove', 'test']);
@ -48,7 +53,9 @@ class CartController extends Controller
$this->cart = $cart;
$this->cartProduct = $cartProduct;
$this->cartItem = $cartItem;
$this->product = $product;
}
/**
@ -60,11 +67,26 @@ class CartController extends Controller
*/
public function add($id) {
$data = request()->input();
// dd($data);
if(!isset($data['is_configurable']) || !isset($data['product']) ||!isset($data['quantity'])) {
session()->flash('error', 'Cannot Product Due to User\'s miscreancy in system\'s integrity');
return redirect()->back();
}
if($data['is_configurable'] == "false") {
$data['price'] = $this->product->findOneByField('id', $data['product'])->price;
} else {
$id = $data['selected_configurable_option'];
$data['price'] = $this->product->findOneByField('id', $data['selected_configurable_option'])->price;
}
if(auth()->guard('customer')->check()) {
Cart::add($id);
Cart::add($id, $data);
} else {
Cart::guestUnitAdd($id);
Cart::guestUnitAdd($id, $data);
}
return redirect()->back();
@ -81,20 +103,26 @@ class CartController extends Controller
return redirect()->back();
}
// public function test() {
// $cookie = Cookie::get('cart_session_id');
/**
* This is a test for
* relationship existence
* from cart item to product
*
* @return Array
*/
public function test() {
$cartItems = $this->cart->items(75);
// $cart = $this->cart->findOneByField('session_id', $cookie);
$products = array();
foreach($cartItems as $cartItem) {
$cartItemId = $cartItem->id;
// $cart_products = $this->cart->getProducts($cart->id);
$this->cart->updateItem(75, $cartItemId, 'quantity', $cartItem->quantity+1);
// foreach($cart_products as $cart_product) {
// $quantity = $cart_product->toArray()['pivot']['quantity'] + 1;
array_push($products, ['product_id' => $this->cartItem->getProduct($cartItemId), 'quantity' => $cartItem->quantity]);
}
// $pivot = $cart_product->toArray()['pivot'];
// $saveQuantity = $this->cart->saveRelated($pivot, 'quantity', $quantity+1);
// }
// dd('done');
// }
dd($products);
return response()->json($products, 200);
}
}

View File

@ -5,6 +5,7 @@ use Illuminate\Routing\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Auth;
use Webkul\Shipping\Facades\Shipping;
/**
* Chekout controller for the customer
@ -15,7 +16,6 @@ use Auth;
*/
class CheckoutController extends Controller
{
/**
* Contains route related configuration
*
@ -43,4 +43,34 @@ class CheckoutController extends Controller
return view($this->_config['view']);
}
/**
* Saves customer address.
*
* @return \Illuminate\Http\Response
*/
public function saveAddress()
{
return response()->json([
'shipping' => Shipping::collectRates()
]);
}
/**
* Saves shipping method.
*
* @return \Illuminate\Http\Response
*/
public function saveShipping()
{
}
/**
* Saves payment method.
*
* @return \Illuminate\Http\Response
*/
public function saveAPayment()
{
}
}

View File

@ -7,6 +7,9 @@ use Illuminate\Support\Collection;
use Webkul\Cart\Repositories\CartRepository;
use Webkul\Cart\Repositories\CartItemRepository;
use Cookie;
use Cart;
/**
@ -32,27 +35,42 @@ class CartComposer
* @param View $view
* @return void
*/
public function __construct(CartRepository $cart) {
public function __construct(CartRepository $cart, CartItemRepository $cartItem) {
$this->cart = $cart;
$this->cartItem = $cartItem;
}
public function compose(View $view) {
if(auth()->guard('customer')->check()) {
$cart = $this->cart->findOneByField('customer_id', auth()->guard('customer')->user()->id);
$cart_products = $this->cart->getProducts($cart['id']);
if(isset($cart)) {
$cart_items = $this->cart->items($cart['id']);
// dd($cart_products);
$cart_products = array();
$view->with('cart', $cart_products);
foreach($cart_items as $cart_item) {
array_push($cart_products, $this->cartItem->getProduct($cart_item->id));
}
$view->with('cart', $cart_products);
}
} else {
if(Cookie::has('cart_session_id')) {
$cart = $this->cart->findOneByField('session_id', Cookie::get('cart_session_id'));
$cart_products = $this->cart->getProducts($cart['id']);
if(isset($cart)) {
$cart_items = $this->cart->items($cart['id']);
$view->with('cart', $cart_products);
$cart_products = array();
foreach($cart_items as $cart_item) {
array_push($cart_products, $this->cartItem->getProduct($cart_item->id));
}
$view->with('cart', $cart_products);
}
}
}
}

View File

@ -3,8 +3,9 @@
namespace Webkul\Cart\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Product\Models\Product;
use Webkul\Cart\Models\CartAddress;
use Webkul\Cart\Models\CartShipping;
class Cart extends Model
{
@ -16,6 +17,26 @@ class Cart extends Model
public function with_products() {
return $this->belongsToMany(Product::class, 'cart_products')->withPivot('id', 'product_id','quantity', 'cart_id');
return $this->belongsToMany(Product::class, 'cart_items')->withPivot('id', 'product_id','quantity', 'cart_id');
}
public function items() {
return $this->hasMany('Webkul\Cart\Models\CartItem');
}
/**
* Get the addresses for the cart.
*/
public function addresses()
{
return $this->hasMany(CartAddress::class);
}
/**
* Get the shipping for the cart.
*/
public function shipping()
{
return $this->hasMany(CartShipping::class);
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Cart\Models;
use Illuminate\Database\Eloquent\Model;
class CartAddress extends Model
{
}

View File

@ -0,0 +1,17 @@
<?php
namespace Webkul\Cart\Models;
use Illuminate\Database\Eloquent\Model;
class CartItem extends Model
{
protected $table = 'cart_items';
protected $fillable = ['product_id','quantity','cart_id','tax_category_id','coupon_code'];
public function product() {
return $this->hasOne('Webkul\Product\Models\Product', 'id', 'product_id');
}
}

View File

@ -1,11 +0,0 @@
<?php
namespace Webkul\Cart\Models;
use Illuminate\Database\Eloquent\Model;
class CartProduct extends Model
{
protected $table = 'cart_products';
protected $fillable = ['product_id','quantity','cart_id','tax_category_id','coupon_code'];
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Cart\Models;
use Illuminate\Database\Eloquent\Model;
class CartShipping extends Model
{
}

View File

@ -46,10 +46,13 @@ class CartServiceProvider extends ServiceProvider
//to make the cart facade and bind the
//alias to the class needed to be called.
$loader = AliasLoader::getInstance();
$loader->alias('cart', CartFacade::class);
$loader->alias('cart', Cart::class);
$this->app->singleton('cart', function () {
return new Cart();
return new cart();
});
$this->app->bind('cart', 'Webkul\Cart\Cart');
}
}
}

View File

@ -11,7 +11,7 @@ use Webkul\Core\Eloquent\Repository;
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CartProductRepository extends Repository
class CartItemRepository extends Repository
{
/**
* Specify Model class name
@ -21,7 +21,7 @@ class CartProductRepository extends Repository
function model()
{
return 'Webkul\Cart\Models\CartProduct';
return 'Webkul\Cart\Models\CartItem';
}
/**
@ -51,4 +51,8 @@ class CartProductRepository extends Repository
return $cartitems;
}
public function getProduct($cartItemId) {
return $this->model->find($cartItemId)->product->id;
}
}

View File

@ -63,9 +63,8 @@ class CartRepository extends Repository
*
* @return Mixed
*/
public function attach($cart_id, $product_id, $quantity) {
return $this->model->findOrFail($cart_id)->with_products()->attach($cart_id, ['product_id' => $product_id, 'cart_id' => $cart_id, 'quantity' => $quantity]);
public function attach($cart_id, $product_id, $quantity, $price) {
return $this->model->findOrFail($cart_id)->with_products()->attach($cart_id, ['product_id' => $product_id, 'cart_id' => $cart_id, 'quantity' => $quantity, 'price' => $price]);
}
@ -77,12 +76,25 @@ class CartRepository extends Repository
*
* @return Mixed
*/
public function updateRelatedForMerge($pivot, $column, $value) {
$cart_product = $this->model->findOrFail($pivot['cart_id']);
public function updateRelatedForMerge($cart_id, $product_id, $column, $value) {
$cart_product = $this->model->findOrFail($cart_id);
return $cart_product->with_products()->updateExistingPivot($pivot['product_id'], array($column => $value));
return $cart_product->with_products()->updateExistingPivot($product_id, array($column => $value));
}
/**
* Update the quantity of
* previously added item
* in the cart.
*
* @return Mixed
*/
// public function updateRelatedInItems($cartId, $cartItemId, $column, $value) {
// return $this->updateItem($cartId)->syncWithoutDetaching($cartItemId, [$column => $value]);
// }
/**
* Method to detach
* associations.
@ -92,12 +104,13 @@ class CartRepository extends Repository
*
* @return Mixed
*/
public function detachAndDeleteParent($cart_id) {
public function deleteParent($cart_id) {
$cart = $this->model->find($cart_id);
//apply strict check for verifying guest ownership on this record.
$cart->with_products()->detach();
return $this->model->destroy($cart_id);
}
public function items($cartId) {
return $this->model->find($cartId)->items;
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCoreConfigTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('core_config', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('value');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('core_config');
}
}

View File

@ -33,6 +33,7 @@ class CoreServiceProvider extends ServiceProvider
Validator::extend('slug', 'Webkul\Core\Contracts\Validations\Slug@passes');
Validator::extend('code', 'Webkul\Core\Contracts\Validations\Code@passes');
}
/**
* Register services.
*

View File

@ -5,6 +5,7 @@ namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Product\Repositories\ProductReviewRepository as ProductReview;
use Webkul\Customer\Models\Customer;
use Auth;
@ -27,14 +28,29 @@ class CustomerController extends Controller
protected $_config;
protected $customer;
/**
* ProductReviewRepository object
*
* @var array
*/
protected $productReview;
public function __construct(CustomerRepository $customer)
/**
* Create a new controller instance.
*
* @param Webkul\Product\Repositories\ProductReviewRepository $productReview
* @return void
*/
public function __construct(CustomerRepository $customer , ProductReview $productReview)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
$this->productReview = $productReview;
}
/**
@ -141,7 +157,12 @@ class CustomerController extends Controller
}
public function reviews() {
return view($this->_config['view']);
$id = auth()->guard('customer')->user()->id;
$reviews = $this->productReview->getCustomerReview($id);
return view($this->_config['view'],compact('reviews'));
}
public function address() {

View File

@ -0,0 +1,32 @@
<?php
namespace Webkul\Payment;
use Illuminate\Support\Facades\Config;
class Payment
{
/**
* Returns all supported payment methods
*
* @return array
*/
public function getSupportedPaymentMethods()
{
$paymentMethods = [];
foreach (Config::get('paymentmethods') as $paymentMethod) {
if($paymentMethod['active']) {
$object = new $paymentMethod['class'];
$paymentMethods[] = [
'code' => $object->getCode(),
'title' => $object->getTitle(),
'description' => $object->getDescription(),
];
}
}
return $paymentMethods;
}
}

View File

@ -0,0 +1,27 @@
{
"name": "webkul/laravel-payment",
"license": "MIT",
"authors": [
{
"name": "Jitendra Singh",
"email": "jitendra@webkul.com"
}
],
"require": {},
"autoload": {
"psr-4": {
"Webkul\\Payment\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Webkul\\Payment\\Providers\\PaymentServiceProvider"
],
"aliases": {
"Bouncer": "Webkul\\Payment\\Facades\\Bouncer"
}
}
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,18 @@
<?php
namespace Webkul\Payment\Facades;
use Illuminate\Support\Facades\Facade;
class Payment extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'payment';
}
}

View File

@ -0,0 +1,10 @@
<?php
use Webkul\Payment\Payment;
if (! function_exists('payment')) {
function payment()
{
return new Payment;
}
}
?>

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Payment\Payment;
class CashOnDelivery extends Payment
{
/**
* Payment method code
*
* @var string
*/
protected $code = 'cashondelivery';
}

View File

@ -0,0 +1,71 @@
<?php
namespace Webkul\Payment\Payment;
use Illuminate\Support\Facades\Config;
abstract class Payment
{
/**
* Checks if payment method is available
*
* @return array
*/
public function isAvailable()
{
return $this->getConfigData('active');
}
/**
* Returns payment method code
*
* @return array
*/
public function getCode()
{
if (empty($this->code)) {
// throw exception
}
return $this->_code;
}
/**
* Returns payment method title
*
* @return array
*/
public function getTitle()
{
return $this->getConfigData('title');
}
/**
* Returns payment method decription
*
* @return array
*/
public function getDecription()
{
return $this->getConfigData('decription');
}
/**
* 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 = core()->getCurrentChannel()->getId();
}
$paymentConfig = Config::get('paymentmethods' . $this->getCode());
return $paymentConfig[$field];
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace Webkul\Payment\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Routing\Router;
use Webkul\Payment\Payment;
use Webkul\Payment\Facades\Payment as PaymentFacade;
class PaymentServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(Router $router)
{
include __DIR__ . '/../Http/helpers.php';
}
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->registerFacades();
}
/**
* Register Bouncer as a singleton.
*
* @return void
*/
protected function registerFacades()
{
$loader = AliasLoader::getInstance();
$loader->alias('payment', PaymentFacade::class);
$this->app->singleton('payment', function () {
return new Payment();
});
}
}

View File

@ -59,13 +59,13 @@ class AttributeToSelectCriteria extends AbstractProduct implements CriteriaInter
public function apply($model, RepositoryInterface $repository)
{
$model = $model->select('products.*');
foreach ($this->attributeToSelect as $code) {
$attribute = $this->attribute->findOneByField('code', $code);
if(!$attribute)
continue;
$productValueAlias = 'pav_' . $attribute->code;
$model = $model->leftJoin('product_attribute_values as ' . $productValueAlias, function($qb) use($attribute, $productValueAlias) {

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\Core\Http\Controllers;
namespace Webkul\Product\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -53,29 +53,43 @@ class ReviewController extends Controller
$this->_config = request('_config');
}
/**
* Store a newly created resource in storage.
/**
* Display a listing of the resource.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function index()
{
return view($this->_config['view']);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function store(Request $request , $id)
{
$this->validate(request(), [
'comment' => 'required',
]);
public function edit($id)
{
$review = $this->productReview->find($id);
$input=$request->all();
return view($this->_config['view'],compact('review'));
}
$input['product_id']=$id;
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$input['customer_id']=1;
$this->productReview->update(request()->all(), $id);
$this->productReview->create($input);
session()->flash('success', 'Review submitted successfully.');
session()->flash('success', 'Review updated successfully.');
return redirect()->route($this->_config['redirect']);
}
}

View File

@ -157,7 +157,7 @@ class Product extends Model
* @return mixed
*/
public function getAttribute($key)
{
{
if (!method_exists(self::class, $key) && !in_array($key, ['parent_id', 'attribute_family_id']) && !isset($this->attributes[$key])) {
if (isset($this->id) && $this->isCustomAttribute($key)) {
$this->attributes[$key] = '';

View File

@ -4,6 +4,7 @@ namespace Webkul\Product\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Customer\Models\Customer;
use Webkul\Product\Models\Product;
class ProductReview extends Model
{
@ -16,4 +17,12 @@ class ProductReview extends Model
{
return $this->belongsTo(Customer::class);
}
/**
* Get the product.
*/
public function product()
{
return $this->belongsTo(Product::class);
}
}

View File

@ -56,7 +56,7 @@ class Review extends AbstractProduct
*/
public function getTotalRating($product)
{
return $product->reviews()->where('status',1)->sum('rating');
return $product->reviews()->where('status','approved')->sum('rating');
}
/**
@ -101,7 +101,7 @@ class Review extends AbstractProduct
$link = $_SERVER['PHP_SELF'];
$link_array = explode('/',$link);
$last=end($link_array);
$itemPerPage = $last*5;
$itemPerPage = 1*5;
return $product->reviews()->where('status',1)->paginate($itemPerPage);
}
}

View File

@ -1,8 +1,10 @@
<?php
<?php
namespace Webkul\Product\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
use Webkul\Product\Repositories\ProductRepository;
/**
* Product Review Reposotory
@ -11,7 +13,29 @@ use Webkul\Core\Eloquent\Repository;
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ProductReviewRepository extends Repository
{
{
/**
* ProductImageRepository object
*
* @var array
*/
protected $product;
/**
* Create a new controller instance.
*
* @param Webkul\Product\Repositories\ProductRepository $product
* @return void
*/
public function __construct(
ProductRepository $product,
App $app)
{
$this->product = $product;
parent::__construct($app);
}
/**
* Specify Model class name
*
@ -21,4 +45,16 @@ class ProductReviewRepository extends Repository
{
return 'Webkul\Product\Models\ProductReview';
}
/**
* Retrieve review for customerId
*
* @param int $customerId
*/
function getCustomerReview($customerId)
{
$reviews = $this->model->where('customer_id',$customerId)->with('product')->get();
return $reviews;
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace Webkul\Shipping\Carriers;
use Illuminate\Support\Facades\Config;
/**
* Abstract class Shipping
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
abstract class AbstractShipping
{
abstract public function calculate();
/**
* Checks if payment method is available
*
* @return array
*/
public function isAvailable()
{
return $this->getConfigData('active');
}
/**
* Returns payment method code
*
* @return array
*/
public function getCode()
{
if (empty($this->code)) {
// throw exception
}
return $this->code;
}
/**
* Returns payment method title
*
* @return array
*/
public function getTitle()
{
return $this->getConfigData('title');
}
/**
* Returns payment method decription
*
* @return array
*/
public function getDecription()
{
return $this->getConfigData('decription');
}
/**
* 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 = core()->getCurrentChannel()->id;
}
$shippingConfig = Config::get('carriers.' . $this->getCode());
return $shippingConfig[$field];
}
}
?>

View File

@ -2,8 +2,8 @@
namespace Webkul\Shipping\Carriers;
use Webkul\Shipping\Contracts\AbstractShipping;
use Config;
use Webkul\Cart\Models\CartShipping;
/**
* Class Rate.
@ -11,8 +11,40 @@ use Config;
*/
class FlatRate extends AbstractShipping
{
/**
* Payment method code
*
* @var string
*/
protected $code = 'flatrate';
public function calculate()
{
return [];
return [
'carrier_code' => 'flatrate',
'carrier_title' => 'Flat Rate',
'carrier_description' => '',
'rates' => [
[
'method' => 'flatrate_flatrate',
'method_title' => 'Flat Rate',
'price' => 10,
'price_formated' => core()->currency(10),
]
]
];
$object = new CartShipping;
$object->carrier = 'flatrate_flatrate';
$object->carrier_title = $this->getConfigData('description');
$object->method = 'flatrate';
$object->method_title = $this->getConfigData('title');
$object->method_description = $this->getConfigData('description');
$object->price = 10;
return [
'flatrate' => [$object]
];
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace Webkul\Shipping\Contracts;
/**
* Abstract class Shipping
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
*/
abstract class AbstractShipping
{
abstract public function calculate();
}
?>

View File

@ -0,0 +1,18 @@
<?php
namespace Webkul\Shipping\Facades;
use Illuminate\Support\Facades\Facade;
class Shipping extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'shipping';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Webkul\Shipping\Helper;
use Illuminate\Support\Facades\Config;
/**
* Class Rate.
*
*/
class Rate
{
public function collectRates()
{
$rates = [];
$shippingMethods = Config::get('carriers');
foreach($shippingMethods as $shippingMethod) {
$object = new $shippingMethod['class'];
if($rate = $object->calculate()) {
$rates[] = $rate;
}
}
return $rates;
}
}

View File

@ -0,0 +1,10 @@
<?php
use Webkul\Shipping\Shipping;
if (! function_exists('shipping')) {
function shipping()
{
return new Shipping;
}
}
?>

View File

@ -3,8 +3,11 @@
namespace Webkul\Shipping\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Routing\Router;
use Webkul\Customer\Http\Middleware\RedirectIfNotCustomer;
use Webkul\Shipping\Shipping;
use Webkul\Shipping\Facades\Shipping as ShippingFacade;
class ShippingServiceProvider extends ServiceProvider
{
@ -15,8 +18,9 @@ class ShippingServiceProvider extends ServiceProvider
*/
public function boot(Router $router)
{
include __DIR__ . '/../Http/helpers.php';
}
/**
* Register services.
*
@ -24,6 +28,20 @@ class ShippingServiceProvider extends ServiceProvider
*/
public function register()
{
$this->registerFacades();
}
/**
* Register Bouncer as a singleton.
*
* @return void
*/
protected function registerFacades()
{
$loader = AliasLoader::getInstance();
$loader->alias('shipping', ShippingFacade::class);
$this->app->singleton('shipping', function () {
return new Shipping();
});
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Webkul\Shipping;
use Illuminate\Support\Facades\Config;
/**
* Class Shipping.
*
*/
class Shipping
{
public function collectRates()
{
$rates = [];
foreach(Config::get('carriers') as $shippingMethod) {
$object = new $shippingMethod['class'];
if($object->isAvailable()) {
$rates[] = $object->calculate();
}
}
return $rates;
// return view('shop::checkout.onepage.shipping', compact('rates'));
}
}

View File

@ -52,6 +52,8 @@ class ProductController extends Controller
{
$product = $this->product->findBySlugOrFail($slug);
return view($this->_config['view'], compact('product'));
$customer = auth()->guard('customer')->user();
return view($this->_config['view'], compact('product','customer'));
}
}

View File

@ -94,7 +94,7 @@ class ReviewController extends Controller
$customer_id = auth()->guard('customer')->user()->id;
$data['status']=0;
$data['status']='pending';
$data['product_id']=$id;
$data['customer_id']=$customer_id;

View File

@ -14,6 +14,14 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'shop::checkout.onepage'
])->name('shop.checkout');
Route::get('test', 'Webkul\Cart\Http\Controllers\CartController@test');
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');
Route::post('/checkout/save-payment', 'Webkul\Cart\Http\Controllers\CheckoutController@savePayment')->name('shop.checkout.save-payment');
/* dummy routes ends here */
@ -39,12 +47,12 @@ Route::group(['middleware' => ['web']], function () {
])->name('shop.reviews.create');
Route::post('/product/{slug}/review', 'Webkul\Shop\Http\Controllers\ReviewController@store')->defaults('_config', [
'redirect' => 'shop.reviews.index'
'redirect' => 'customer.reviews.index'
])->name('shop.reviews.store');
Route::post('/reviews/create/{slug}', 'Webkul\Shop\Http\Controllers\ReviewController@store')->defaults('_config', [
'redirect' => 'admin.reviews.index'
])->name('admin.reviews.store');
// Route::post('/reviews/create/{slug}', 'Webkul\Shop\Http\Controllers\ReviewController@store')->defaults('_config', [
// 'redirect' => 'admin.reviews.index'
// ])->name('admin.reviews.store');
//customer routes starts here

View File

@ -75,6 +75,8 @@ export default {
initializeDropdown: function() {
this.totalitems = this.items.length;
this.cart_items = this.items;
console.log("The cart items here are = ",cart_items);
}
}
}

View File

@ -1070,7 +1070,6 @@ section.slider-block {
.addtocart {
white-space: nowrap;
font-size: 12px;
border-radius: 0px;
}
}
}
@ -1174,7 +1173,6 @@ section.slider-block {
.addtocart {
white-space: nowrap;
font-size: 12px;
border-radius: 0px;
}
}
}
@ -1651,13 +1649,11 @@ section.product-detail {
.addtocart {
width: 293px;
background: black;
border-radius: 0px;
}
.buynow {
width: 293px;
float:right;
border-radius: 0px;
}
}
}
@ -1995,12 +1991,10 @@ section.product-detail {
.addtocart {
width: 49%;
background: #000000;
border-radius: 0px;
}
.buynow {
width: 49%;
border-radius: 0px;
}
}
}
@ -4221,5 +4215,58 @@ section.review {
}
}
// review page end here
// review page start here
// customer section css start here
.cusomer-section {
margin-left: 50px;
width:100%;
.customer-section-info {
display: flex;
flex-direction: row;
border-top: 1px solid #E8E8E8;
.pro-img {
margin-top: 10px;
margin-bottom: 5px;
img {
height: 125px;
width: 100px;
}
}
.pro-discription {
margin-left: 20px;
width: 100%;
.title {
font-size: 16px;
color: #0031F0;
margin-top: 15px;
}
.rating {
margin-top: 10px;
.icon {
height: 16px;
width: 16px;
}
}
.discription {
margin-top: 15px;
}
}
}
.customer-section-info:last-child {
border-bottom: 1px solid #e8e8e8;
}
}
// customer section css end here

View File

@ -84,7 +84,8 @@ return [
'order-summary' => 'Order Summary',
'shipping-address' => 'Shipping Address',
'use_for_shipping' => 'Ship to this address',
'continue' => 'Continue'
'continue' => 'Continue',
'shipping-method' => 'Shipping Method'
]
]
];

View File

@ -18,40 +18,28 @@
<div class="col-main">
<ul class="checkout-steps">
<li class="active">
<div class="decorator">
<img src="{{ bagisto_asset('images/address.svg') }}" />
</div>
<li class="active" :class="[completedStep >= 0 ? 'active' : '', completedStep > 0 ? 'completed' : '']" @click="navigateToStep(1)">
<div class="decorator address-info"></div>
<span>{{ __('shop::app.checkout.onepage.information') }}</span>
</li>
<li>
<div class="decorator">
<img src="{{ bagisto_asset('images/shipping.svg') }}" />
</div>
<li :class="[currentStep == 2 || completedStep > 1 ? 'active' : '', completedStep > 1 ? 'completed' : '']" @click="navigateToStep(2)">
<div class="decorator shipping"></div>
<span>{{ __('shop::app.checkout.onepage.shipping') }}</span>
</li>
<li>
<div class="decorator">
<img src="{{ bagisto_asset('images/payment.svg') }}" />
</div>
<li :class="[currentStep == 3 || completedStep > 2 ? 'active' : '', completedStep > 2 ? 'completed' : '']" @click="navigateToStep(3)">
<div class="decorator payment"></div>
<span>{{ __('shop::app.checkout.onepage.payment') }}</span>
</li>
<li>
<div class="decorator">
<img src="{{ bagisto_asset('images/finish.svg') }}" />
</div>
<li :class="[currentStep == 4 ? 'active' : '']">
<div class="decorator review"></div>
<span>{{ __('shop::app.checkout.onepage.complete') }}</span>
</li>
</ul>
<div class="step-content information">
<div class="step-content information" v-show="currentStep == 1">
@include('shop::checkout.onepage.customer-info')
@ -65,15 +53,32 @@
</div>
</div>
<div class="step-content shipping" v-show="currentStep == 2">
@include('shop::checkout.onepage.shipping')
<div class="step-content shipping">
</div>
<div class="button-group">
<div class="step-content payment">
</div>
<button type="button" class="btn btn-lg btn-primary" @click="validateForm('shipping-form')">
{{ __('shop::app.checkout.onepage.continue') }}
</button>
</div>
</div>
<div class="step-content payment" v-show="currentStep == 3">
@include('shop::checkout.onepage.payment')
</div>
<div class="step-content review" v-show="currentStep == 4">
@include('shop::checkout.onepage.review')
</div>
<div class="step-content review">
</div>
@include('shop::checkout.onepage.summary')
@ -89,10 +94,27 @@
inject: ['$validator'],
data: () => ({
billing: {
use_for_shipping: true
currentStep: 1,
completedStep: 0,
shipping_methods: [],
payment_methods: [],
address: {
billing: {
use_for_shipping: true
},
shipping: {},
},
shipping: {},
selected_shipping_method: '',
selected_payment: {
method: ''
}
}),
created () {
@ -100,19 +122,52 @@
},
methods: {
navigateToStep (step) {
if(step <= this.completedStep) {
this.currentStep = step
this.completedStep = step - 1;
}
},
validateForm: function (scope) {
this.$validator.validateAll(scope).then((result) => {
if(result) {
this.saveAddress()
if(scope == 'address-form') {
this.saveAddress()
} else if(scope == 'shipping-form') {
this.saveShipping()
}
}
});
},
saveAddress () {
var this_this = this;
this.$http.post("{{ route('shop.checkout.save-address') }}", this.address)
.then(function(response) {
if(response.data.shipping) {
this_this.shipping_methods = response.data.shipping
this_this.completedStep = 1;
this_this.currentStep = 2;
}
})
},
saveShipping () {
// this.$http.get('https://api.coindesk.com/v1/bpi/currentprice.json')
// .then(function(response) {
// console.log(response)
// })
this.completedStep = 2;
this.currentStep = 3;
// })
},
savePayment () {
// this.$http.get('https://api.coindesk.com/v1/bpi/currentprice.json')
// .then(function(response) {
this.completedStep = 1;
this.currentStep = 2;
// })
}
}
})

View File

@ -15,7 +15,7 @@
{{ __('shop::app.checkout.onepage.first-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[first_name]" name="billing[first_name]" v-model="billing.first_name"/>
<input type="text" v-validate="'required'" class="control" id="billing[first_name]" name="billing[first_name]" v-model="address.billing.first_name"/>
<span class="control-error" v-if="errors.has('address-form.billing[first_name]')">
@{{ errors.first('address-form.billing[first_name]') }}
@ -27,7 +27,7 @@
{{ __('shop::app.checkout.onepage.last-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[last_name]" name="billing[last_name]" v-model="billing.last_name"/>
<input type="text" v-validate="'required'" class="control" id="billing[last_name]" name="billing[last_name]" v-model="address.billing.last_name"/>
<span class="control-error" v-if="errors.has('address-form.billing[last_name]')">
@{{ errors.first('address-form.billing[last_name]') }}
@ -39,7 +39,7 @@
{{ __('shop::app.checkout.onepage.email') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[email]" name="billing[email]" v-model="billing.email"/>
<input type="text" v-validate="'required'" class="control" id="billing[email]" name="billing[email]" v-model="address.billing.email"/>
<span class="control-error" v-if="errors.has('address-form.billing[email]')">
@{{ errors.first('address-form.billing[email]') }}
@ -51,7 +51,7 @@
{{ __('shop::app.checkout.onepage.address1') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[address1]" name="billing[address1]" v-model="billing.address1"/>
<input type="text" v-validate="'required'" class="control" id="billing[address1]" name="billing[address1]" v-model="address.billing.address1"/>
<span class="control-error" v-if="errors.has('address-form.billing[address1]')">
@{{ errors.first('address-form.billing[address1]') }}
@ -63,7 +63,7 @@
{{ __('shop::app.checkout.onepage.address2') }}
</label>
<input type="text" class="control" id="billing[address2]" name="billing[address2]" v-model="billing.address2"/>
<input type="text" class="control" id="billing[address2]" name="billing[address2]" v-model="address.billing.address2"/>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[city]') ? 'has-error' : '']">
@ -71,7 +71,7 @@
{{ __('shop::app.checkout.onepage.city') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[city]" name="billing[city]" v-model="billing.city"/>
<input type="text" v-validate="'required'" class="control" id="billing[city]" name="billing[city]" v-model="address.billing.city"/>
<span class="control-error" v-if="errors.has('address-form.billing[city]')">
@{{ errors.first('address-form.billing[city]') }}
@ -83,7 +83,7 @@
{{ __('shop::app.checkout.onepage.state') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[state]" name="billing[state]" v-model="billing.state"/>
<input type="text" v-validate="'required'" class="control" id="billing[state]" name="billing[state]" v-model="address.billing.state"/>
<span class="control-error" v-if="errors.has('address-form.billing[state]')">
@{{ errors.first('address-form.billing[state]') }}
@ -95,7 +95,7 @@
{{ __('shop::app.checkout.onepage.postcode') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[postcode]" name="billing[postcode]" v-model="billing.postcode"/>
<input type="text" v-validate="'required'" class="control" id="billing[postcode]" name="billing[postcode]" v-model="address.billing.postcode"/>
<span class="control-error" v-if="errors.has('address-form.billing[postcode]')">
@{{ errors.first('address-form.billing[postcode]') }}
@ -107,7 +107,7 @@
{{ __('shop::app.checkout.onepage.phone') }}
</label>
<input type="text" v-validate="'required'" class="control" id="billing[phone]" name="billing[phone]" v-model="billing.phone"/>
<input type="text" v-validate="'required'" class="control" id="billing[phone]" name="billing[phone]" v-model="address.billing.phone"/>
<span class="control-error" v-if="errors.has('address-form.billing[phone]')">
@{{ errors.first('address-form.billing[phone]') }}
@ -119,7 +119,7 @@
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="billing.country">
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country">
<option value=""></option>
@foreach (country()->all() as $code => $country)
@ -136,7 +136,7 @@
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="billing[use_for_shipping]" name="billing[use_for_shipping]" v-model="billing.use_for_shipping"/>
<input type="checkbox" id="billing[use_for_shipping]" name="billing[use_for_shipping]" v-model="address.billing.use_for_shipping"/>
<label class="checkbox-view" for="billing[use_for_shipping]"></label>
{{ __('shop::app.checkout.onepage.use_for_shipping') }}
</span>
@ -144,7 +144,7 @@
</div>
</div>
<div class="form-container" v-if="!billing.use_for_shipping">
<div class="form-container" v-if="!address.billing.use_for_shipping">
<div class="form-header">
<h1>{{ __('shop::app.checkout.onepage.shipping-address') }}</h1>
@ -155,7 +155,7 @@
{{ __('shop::app.checkout.onepage.first-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[first_name]" name="shipping[first_name]" v-model="shipping.first_name"/>
<input type="text" v-validate="'required'" class="control" id="shipping[first_name]" name="shipping[first_name]" v-model="address.shipping.first_name"/>
<span class="control-error" v-if="errors.has('address-form.shipping[first_name]')">
@{{ errors.first('address-form.shipping[first_name]') }}
@ -167,7 +167,7 @@
{{ __('shop::app.checkout.onepage.last-name') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[last_name]" name="shipping[last_name]" v-model="shipping.last_name"/>
<input type="text" v-validate="'required'" class="control" id="shipping[last_name]" name="shipping[last_name]" v-model="address.shipping.last_name"/>
<span class="control-error" v-if="errors.has('address-form.shipping[last_name]')">
@{{ errors.first('address-form.shipping[last_name]') }}
@ -179,7 +179,7 @@
{{ __('shop::app.checkout.onepage.email') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[email]" name="shipping[email]" v-model="shipping.email"/>
<input type="text" v-validate="'required'" class="control" id="shipping[email]" name="shipping[email]" v-model="address.shipping.email"/>
<span class="control-error" v-if="errors.has('address-form.shipping[email]')">
@{{ errors.first('address-form.shipping[email]') }}
@ -191,7 +191,7 @@
{{ __('shop::app.checkout.onepage.address1') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[address1]" name="shipping[address1]" v-model="shipping.address1"/>
<input type="text" v-validate="'required'" class="control" id="shipping[address1]" name="shipping[address1]" v-model="address.shipping.address1"/>
<span class="control-error" v-if="errors.has('address-form.shipping[address1]')">
@{{ errors.first('address-form.shipping[address1]') }}
@ -203,7 +203,7 @@
{{ __('shop::app.checkout.onepage.address2') }}
</label>
<input type="text" class="control" id="shipping[address2]" name="shipping[address2]" v-model="shipping.address2"/>
<input type="text" class="control" id="shipping[address2]" name="shipping[address2]" v-model="address.shipping.address2"/>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[city]') ? 'has-error' : '']">
@ -211,7 +211,7 @@
{{ __('shop::app.checkout.onepage.city') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[city]" name="shipping[city]" v-model="shipping.city"/>
<input type="text" v-validate="'required'" class="control" id="shipping[city]" name="shipping[city]" v-model="address.shipping.city"/>
<span class="control-error" v-if="errors.has('address-form.shipping[city]')">
@{{ errors.first('address-form.shipping[city]') }}
@ -223,7 +223,7 @@
{{ __('shop::app.checkout.onepage.state') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[state]" name="shipping[state]" v-model="shipping.state"/>
<input type="text" v-validate="'required'" class="control" id="shipping[state]" name="shipping[state]" v-model="address.shipping.state"/>
<span class="control-error" v-if="errors.has('address-form.shipping[state]')">
@{{ errors.first('address-form.shipping[state]') }}
@ -235,7 +235,7 @@
{{ __('shop::app.checkout.onepage.postcode') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[postcode]" name="shipping[postcode]" v-model="shipping.postcode"/>
<input type="text" v-validate="'required'" class="control" id="shipping[postcode]" name="shipping[postcode]" v-model="address.shipping.postcode"/>
<span class="control-error" v-if="errors.has('address-form.shipping[postcode]')">
@{{ errors.first('address-form.shipping[postcode]') }}
@ -247,7 +247,7 @@
{{ __('shop::app.checkout.onepage.phone') }}
</label>
<input type="text" v-validate="'required'" class="control" id="shipping[phone]" name="shipping[phone]" v-model="shipping.phone"/>
<input type="text" v-validate="'required'" class="control" id="shipping[phone]" name="shipping[phone]" v-model="address.shipping.phone"/>
<span class="control-error" v-if="errors.has('address-form.shipping[phone]')">
@{{ errors.first('address-form.shipping[phone]') }}
@ -259,7 +259,7 @@
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="shipping.country">
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country">
<option value=""></option>
@foreach (country()->all() as $code => $country)

View File

@ -0,0 +1,26 @@
<form data-vv-scope="shipping-form">
<div class="form-container">
<div class="form-header">
<h1>{{ __('shop::app.checkout.onepage.shipping-method') }}</h1>
</div>
<div class="shipping-methods">
<div class="control-group" v-for='(shipping_method, index) in shipping_methods' :class="[errors.has('shipping-form.shipping_method') ? 'has-error' : '']">
<h4 for="">@{{ shipping_method.carrier_title }}</h4>
<span class="radio" v-for='(rate, index) in shipping_method.rates'>
<input v-validate="'required'" type="radio" :id="rate.method" name="shipping_method" :value="rate.method">
<label class="radio-view" :for="rate.method"></label>
@{{ rate.method_title }}
<b>@{{ rate.price_formated }}</b>
</span>
<span class="control-error" v-if="errors.has('shipping-form.shipping_method')">
@{{ errors.first('shipping-form.shipping_method') }}
</span>
</div>
</div>
</div>
</form>

View File

@ -1 +1,44 @@
<h1>Customer Reviews page</h1>
@inject ('productImageHelper', 'Webkul\Product\Product\ProductImage')
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<div class="cusomer-section">
<h1> Reviews</h1>
@foreach($reviews as $review)
<div class="customer-section-info">
<?php $images = $productImageHelper->getGalleryImages($review->product); ?>
<div class="pro-img">
<img src="{{ $images[0]['small_image_url'] }}" />
</div>
<div class="pro-discription">
<div class="title">
{{ $review->product->name }}
</div>
<div class="rating">
@for($i=0 ; $i < $review->rating ; $i++)
<span class="icon star-icon"></span>
@endfor
</div>
<div class="discription">
{{ $review->comment }}
</div>
</div>
</div>
@endforeach
</div>
</div>
@endsection

View File

@ -91,7 +91,19 @@
</ul>
<cart-dropdown @if(isset($cart)) :items='@json($cart)' @endif></cart-dropdown>
@if(isset($cart))
<cart-dropdown :items='@json($cart)'></cart-dropdown>
@else
<ul class="cart-dropdown">
<li class="cart-summary">
<span class="icon cart-icon"></span>
<span class="cart"><span class="cart-count">0</span>Products</span>
<span class="icon arrow-down-icon"></span>
</li>
</ul>
@endif
{{-- Meant for responsive views only --}}
<ul class="ham-dropdown-container">

View File

@ -8,15 +8,13 @@
@section('content-wrapper')
<section class="product-detail">
<div class="category-breadcrumbs">
<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) }}">
@csrf()
<input type="hidden" name="product">
<input type="hidden" name="product" value="{{ $product->id }}">
@include ('shop::products.view.gallery')
@ -37,6 +35,17 @@
{{ $product->short_description }}
</div>
<div class="quantity control-group">
<label class="reqiured">Quantity</label>
<input name="quantity" class="control" value="1" v-validate="'numeric'" required style="width: 60px;">
</div>
@if ($product->type == 'configurable')
<input type="hidden" value="true" name="is_configurable">
@else
<input type="hidden" value="false" name="is_configurable">
@endif
@include ('shop::products.view.configurable-options')
<accordian :title="'{{ __('shop::app.products.description') }}'" :active="true">

View File

@ -1,5 +1,4 @@
@inject ('reviewHelper', 'Webkul\Product\Product\Review')
@if ($total = $reviewHelper->getTotalReviews($product))
<div class="rating-reviews">
<div class="rating-header">
@ -27,15 +26,17 @@
</div>
@if(!is_null($customer))
<a href="{{ route('shop.reviews.create', $product->url_key) }}" class="btn btn-lg btn-primary">
{{ __('shop::app.products.write-review-btn') }}
</a>
@endif
</div>
<div class="reviews">
@foreach ($reviewHelper->getReviews($product)->paginate(5) as $review)
@foreach ($reviewHelper->getReviews($product)->paginate(10) as $review)
<div class="review">
<div class="title">
{{ $review->title }}

View File

@ -1132,7 +1132,6 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
.main-container-wrapper .product-card .cart-fav-seg .addtocart {
white-space: nowrap;
font-size: 12px;
border-radius: 0px;
}
.main-container-wrapper .top-toolbar {
border-bottom: 1px solid #E8E8E8;
@ -1198,7 +1197,6 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
.main-container-wrapper .product-card .cart-fav-seg .addtocart {
white-space: nowrap;
font-size: 12px;
border-radius: 0px;
}
.main-container-wrapper .top-toolbar {
border-bottom: 1px solid #E8E8E8;
@ -1694,13 +1692,11 @@ section.product-detail div.layouter form div.product-image-group .cart-fav-seg {
section.product-detail div.layouter form div.product-image-group .cart-fav-seg .addtocart {
width: 293px;
background: black;
border-radius: 0px;
}
section.product-detail div.layouter form div.product-image-group .cart-fav-seg .buynow {
width: 293px;
float: right;
border-radius: 0px;
}
section.product-detail div.layouter form .details {
@ -1909,11 +1905,9 @@ section.product-detail div.layouter form .details .full-description {
section.product-detail div.layouter form .details .attributes .cart-fav-seg .addtocart {
width: 49%;
background: #000000;
border-radius: 0px;
}
section.product-detail div.layouter form .details .attributes .cart-fav-seg .buynow {
width: 49%;
border-radius: 0px;
}
}
@ -3975,3 +3969,57 @@ section.review .review-layouter .review-info .review-detail .rating-calculate .p
width: 20px;
border: 1px solid blue;
}
.cusomer-section {
margin-left: 50px;
width: 100%;
}
.cusomer-section .customer-section-info {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
border-top: 1px solid #E8E8E8;
}
.cusomer-section .customer-section-info .pro-img {
margin-top: 10px;
margin-bottom: 5px;
}
.cusomer-section .customer-section-info .pro-img img {
height: 125px;
width: 100px;
}
.cusomer-section .customer-section-info .pro-discription {
margin-left: 20px;
width: 100%;
}
.cusomer-section .customer-section-info .pro-discription .title {
font-size: 16px;
color: #0031F0;
margin-top: 15px;
}
.cusomer-section .customer-section-info .pro-discription .rating {
margin-top: 10px;
}
.cusomer-section .customer-section-info .pro-discription .rating .icon {
height: 16px;
width: 16px;
}
.cusomer-section .customer-section-info .pro-discription .discription {
margin-top: 15px;
}
.cusomer-section .customer-section-info:last-child {
border-bottom: 1px solid #e8e8e8;
}

File diff suppressed because one or more lines are too long