Conflict resolved

This commit is contained in:
jitendra 2018-10-26 12:54:39 +05:30
commit 2d24f24c9c
18 changed files with 171 additions and 108 deletions

18
bower.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "bagisto",
"description": "An eCommerce ecosystem for All to build and scale your business.",
"main": "",
"authors": [
"Webkul <support@webkul.com>"
],
"license": "MIT",
"keywords": [
"ecommerce",
"framework",
"laravel",
"php",
"store",
"commerce"
],
"homepage": "https://github.com/bagisto/bagisto"
}

View File

@ -92,7 +92,6 @@ class OrderDataGrid
return '<span class="badge badge-md badge-info">Completed</span>';
else if($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
},
],
],

View File

@ -70,19 +70,19 @@ class ProductDataGrid
'name' => 'prods.name',
'alias' => 'ProductName',
'type' => 'string',
'label' => 'Product Name',
'label' => 'Name',
'sortable' => false,
], [
'name' => 'prods.type',
'alias' => 'ProductType',
'type' => 'string',
'label' => 'Product Type',
'label' => 'Type',
'sortable' => false,
], [
'name' => 'prods.status',
'alias' => 'ProductStatus',
'type' => 'string',
'label' => 'Product Status',
'label' => 'Status',
'sortable' => false,
'wrapper' => function ($value) {
if($value == 1)
@ -94,7 +94,7 @@ class ProductDataGrid
'name' => 'prods.price',
'alias' => 'ProductPrice',
'type' => 'string',
'label' => 'Product Price',
'label' => 'Price',
'sortable' => false,
'wrapper' => function ($value) {
return core()->formatBasePrice($value);

View File

@ -13,17 +13,17 @@ use Webkul\Ui\DataGrid\Facades\DataGrid;
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerReviewDataGrid
class ProductReviewDataGrid
{
/**
* The CustomerReviewDataGrid
* The ProductReviewDataGrid
* implementation.
*
* @var CustomerReviewsDataGrid
* for Reviews
*/
public function createCustomerReviewDataGrid()
public function createProductReviewDataGrid()
{
return DataGrid::make([
@ -87,6 +87,12 @@ class CustomerReviewDataGrid
'type' => 'number',
'label' => 'Status',
'sortable' => true,
'wrapper' => function ($value) {
if($value == 'approved')
return '<span class="badge badge-md badge-success">Approved</span>';
else if($value == "pending")
return '<span class="badge badge-md badge-warning">Pending</span>';
},
],
],
@ -153,6 +159,6 @@ class CustomerReviewDataGrid
public function render()
{
return $this->createCustomerReviewDataGrid()->render();
return $this->createProductReviewDataGrid()->render();
}
}

View File

@ -50,6 +50,8 @@ class Product {
*/
public function prepareData($product) {
$gridObject = [];
$variantObjects = [];
$gridObject = [
'product_id' => $product->id,
'sku' => $product->sku,
@ -57,15 +59,13 @@ class Product {
'attribute_family_name' => $product->attribute_family->name,
];
$variantObjects = [];
if($this->productGrid->findOneByField('product_id', $product->id)) {
$gridObject['name'] = $product->name;
$gridObject['status'] = $product->status;
if($product->type == 'configurable') {
$gridObject['quantity'] = 0;
$gridObject['price'] = $this->price->getMinimalPrice($product);
$gridObject['price'] = 0;
$variants = $product->variants;
@ -80,13 +80,13 @@ class Product {
'status' => $variant->status,
];
$qty = 1;
foreach($variant->toArray()['inventories'] as $inventorySource) {
$qty = $qty + $inventorySource['qty'];
$qty = 0;
//inventories and inventory sources relation for the variants return empty or null collection objects only
foreach($variant->inventories()->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
$variantObject['price'] = $product->price;
$variantObject['price'] = $variant->price;
$variantObject['quantity'] = $qty;
array_push($variantObjects, $variantObject);
@ -97,8 +97,8 @@ class Product {
} else {
$qty = 0;
foreach($product->toArray()['inventories'] as $inventorySource) {
$qty = $qty + $inventorySource['qty'];
foreach($product->inventories->get() as $inventory_source) {
$qty = $qty + $inventory_source->qty;
}
$gridObject['price'] = $product->price;
@ -107,7 +107,6 @@ class Product {
$qty = 0;
}
}
// dd($gridObject, $variantObjects);
return [
'parent' => $gridObject,
'variants' => $variantObjects
@ -136,15 +135,16 @@ class Product {
$productGridObject = $this->productGrid->findOneByField('product_id', $product->id);
// dd($product, $data, $productGridObject);
if (!is_null($productGridObject)) {
if(!is_null($productGridObject)) {
if($product->type == 'simple') {
$r = $productGridObject->update($data['parent']);
} else {
$productGridObject->update($data['parent']);
if(count($data['variants'])) {
dd($data['variants']);
foreach($data['variants'] as $variant) {
$variantObject = $this->productGrid->findOneByField('product_id', $variant['product_id']);
if(!is_null($variantObject)) {
$variantObject->update($variant);
} else {
@ -156,7 +156,7 @@ class Product {
} else {
$this->productGrid->create($data['parent']);
//no need for tese lines
//no need for these lines
if(count($data['variants'])) {
foreach($data['variants'] as $variant) {
$this->productGrid->create($variant);
@ -176,37 +176,8 @@ class Product {
}
/**
* Event after the product update
*
* @var collection product
*
* return boolean
* Manually invoke this function when you have created the products by importing or seeding or factory.
*/
public function afterProductUpdate($product) {
//update product grid here
$this->productGrid->updateWhere($product);
return true;
}
/**
* Event after deletion of the product
*
* @return boolean
*/
public function afterProductDelete($productId) {
return true;
}
/**
* Fill attributes for that product after the creation
*
* @return boolean
*/
public function fillAttribute() {
}
public function sync() {
$gridObject = [];

View File

@ -19,7 +19,7 @@
</div>
<div class="page-content">
@inject('review','Webkul\Admin\DataGrids\CustomerReviewDataGrid')
@inject('review','Webkul\Admin\DataGrids\ProductReviewDataGrid')
{!! $review->render() !!}
</div>
</div>

View File

@ -1164,4 +1164,21 @@ class Cart {
return ['parent' => $parentData, 'child' => $childData];
}
/**
* Handle the buy now process for simple as well as configurable products
*
* @return response mixed
*/
public function proceedForBuyNow($id) {
$product = $this->product->findOneByField('id', $id);
if($product->type == 'configurable') {
session()->flash('warning', 'Please Select Options Before Buying This Product');
return false;
} else {
$this->moveToCart($id);
}
}
}

View File

@ -205,7 +205,7 @@ class ProductController extends Controller
$this->product->delete($id);
//before update of product
Event::fire('product.delete.after', $id);
// Event::fire('product.delete.after', $id);
session()->flash('success', 'Product deleted successfully.');

View File

@ -88,7 +88,7 @@ class CartController extends Controller
public function add($id) {
$data = request()->input();
Cart::add($id, $data);
Cart::collectTotals();
@ -143,7 +143,11 @@ class CartController extends Controller
return redirect()->route('shop.products.index', $slug);
}
public function test() {
$result = Cart::isConfigurable(9);
public function test($id) {
$result = Cart::proceedForBuyNow($id);
if(!$result) {
return redirect()->back();
}
}
}

View File

@ -46,9 +46,9 @@ class ReviewController extends Controller
*/
public function __construct(Product $product, ProductReview $productReview)
{
$this->middleware('admin');
$this->middleware('admin')->only(['update', 'destroy']);
$this->middleware('customer')->only(['create', 'store']);
$this->middleware('customer')->only(['create', 'store', 'destroy']);
$this->product = $product;
@ -151,4 +151,17 @@ class ReviewController extends Controller
return redirect()->route($this->_config['redirect']);
}
/**
* Delete the review of the current product
*
* @return response
*/
public function destroy($id) {
$this->productReview->delete($id);
success()->flash('success', 'Product Review Successfully Deleted');
return redirect()->back();
}
}

View File

@ -45,8 +45,8 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
'view' => 'shop::checkout.success'
])->name('shop.checkout.success');
//dummy
Route::get('test', 'Webkul\Shop\Http\Controllers\CartController@test');
//buy now
Route::get('buynow/{id}', 'Webkul\Shop\Http\Controllers\CartController@test')->name('shop.product.buynow');
Route::get('/products/{slug}', 'Webkul\Shop\Http\Controllers\ProductController@index')->defaults('_config', [
'view' => 'shop::products.view'

View File

@ -655,13 +655,18 @@ section.slider-block {
flex-direction: row;
justify-content: flex-end;
align-items: center;
// cursor: pointer;
.currency-switcher {
float: right;
border-right: 2px solid $border-color;
cursor: pointer;
.dropdown-toggle {
line-height: 25px;
margin-left: 14px;
margin-right: 14px;
}
.dropdown-list {
width: 100px;
top: 37px;
@ -675,12 +680,20 @@ section.slider-block {
ul.account-dropdown-container {
float: right;
border-right: 2px solid $border-color;
cursor: pointer;
li.account-dropdown {
display: flex;
flex-direction: row;
margin-right: 14px;
margin-left: 14px;
margin-right: 14px;
.account {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.dropdown-list {
width: 300px;
@ -816,6 +829,7 @@ section.slider-block {
}
}
}
ul.right-responsive {
display: none;
cursor: pointer;
@ -1052,6 +1066,7 @@ section.slider-block {
ul.right-responsive {
display: flex !important;
margin-left: 12px;
}
}
@ -1658,7 +1673,6 @@ section.product-detail {
.rating-reviews {
.rating-header {
font-weight: 600;
padding: 20px 0;
}

View File

@ -7,6 +7,17 @@ return [
'new-products' => 'New Products'
],
'header' => [
'title' => 'Account',
'dropdown-text' => 'Manage Cart, Orders & Wishlist.',
'sign-in' => 'Sign In',
'sign-up' => 'Sign Up',
'profile' => 'Profile',
'wishlist' => 'Wishlist',
'cart' => 'Cart',
'logout' => 'Logout'
],
'footer' => [
'subscribe-newsletter' => 'Subscribe Newsletter',
'subscribe' => 'Subscribe',

View File

@ -26,9 +26,9 @@
<div class="right-content">
@if (core()->getCurrentChannel()->currencies->count() > 1)
<div class="currency-switcher">
<ul class="currency-switcher">
<div class="dropdown-toggle">
USD
{{ core()->getCurrentCurrencyCode() }}
<i class="icon arrow-down-icon active"></i>
</div>
@ -43,27 +43,25 @@
</ul>
</div>
</div>
</div>
</ul>
@endif
<ul class="account-dropdown-container">
<li class="account-dropdown">
<div class="dropdown-toggle">
<div style="display: inline-flex; align-items: center; cursor: pointer;">
<span class="icon account-icon" style="margin-top: 5px;"></span>
<i class="icon arrow-down-icon active"></i>
</div>
<div class="dropdown-toggle account">
<span class="icon account-icon"></span>
<i class="icon arrow-down-icon active"></i>
</div>
@guest('customer')
<div class="dropdown-list bottom-right" style="display: none;">
<div class="dropdown-container">
<label>Account</label><br/>
<span style="font-size: 12px;">Manage Cart, Orders & Wishlist.</span>
<label>{{ __('shop::app.header.title') }}</label><br/>
<span style="font-size: 12px;">{{ __('shop::app.header.dropdown-text') }}</span>
<ul class="account-dropdown-list">
<li><a class="btn btn-primary btn-sm" href="{{ route('customer.session.index') }}">Sign In</a></li>
<li><a class="btn btn-primary btn-sm" href="{{ route('customer.session.index') }}">{{ __('shop::app.header.sign-in') }}</a></li>
<li><a class="btn btn-primary btn-sm" href="{{ route('customer.register.index') }}">Sign Up</a></li>
<li><a class="btn btn-primary btn-sm" href="{{ route('customer.register.index') }}">{{ __('shop::app.header.sign-up') }}</a></li>
</ul>
</div>
@ -74,32 +72,27 @@
@auth('customer')
<div class="dropdown-list bottom-right" style="display: none; max-width: 230px;">
<div class="dropdown-container">
<label>Account</label>
<label>{{ __('shop::app.header.title') }}</label>
<ul>
<li><a href="{{ route('customer.profile.index') }}">Profile</a></li>
<li><a href="{{ route('customer.profile.index') }}">{{ __('shop::app.header.profile') }}</a></li>
<li><a href="{{ route('customer.wishlist.index') }}">Wishlist</a></li>
<li><a href="{{ route('customer.wishlist.index') }}">{{ __('shop::app.header.wishlist') }}</a></li>
<li><a href="{{ route('shop.checkout.cart.index') }}">Cart</a></li>
<li><a href="{{ route('shop.checkout.cart.index') }}">{{ __('shop::app.header.cart') }}</a></li>
<li><a href="{{ route('customer.session.destroy') }}">Logout</a></li>
<li><a href="{{ route('customer.session.destroy') }}">{{ __('shop::app.header.logout') }}</a></li>
</ul>
</div>
</div>
@endauth
</li>
</ul>
<ul class="cart-dropdown-container">
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
<li class="cart-dropdown">
<span class="icon cart-icon"></span>
@include('shop::checkout.cart.mini-cart')
</li>
</ul>
@ -109,22 +102,18 @@
<ul class="resp-account-dropdown-container">
<li class="account-dropdown">
<div class="dropdown-toggle">
<span class="icon account-icon"></span>
</div>
@guest
<div class="dropdown-list bottom-right" style="display: none;">
<div class="dropdown-container">
<label>Account</label>
<label>{{ __('shop::app.header.title') }}</label>
<ul>
<li><a href="{{ route('customer.session.index') }}">Sign In</a></li>
<li><a href="{{ route('customer.register.index') }}">Sign Up</a></li>
<li><a href="{{ route('customer.session.index') }}">{{ __('shop::app.header.sign-in') }}</a></li>
<li><a href="{{ route('customer.register.index') }}">{{ __('shop::app.header.sign-up') }}</a></li>
</ul>
</div>
</div>
@ -134,16 +123,16 @@
<div class="dropdown-list bottom-right" style="display: none;">
<div class="dropdown-container">
<label>Account</label>
<label>{{ __('shop::app.header.title') }}</label>
<ul>
<li><a href="{{ route('customer.profile.index') }}">Profile</a></li>
<li><a href="{{ route('customer.profile.index') }}">{{ __('shop::app.header.profile') }}</a></li>
<li><a href="{{ route('customer.wishlist.index') }}">Wishlist</a></li>
<li><a href="{{ route('customer.wishlist.index') }}">{{ __('shop::app.header.wishlist') }}</a></li>
<li><a href="{{ route('shop.checkout.cart.index') }}">Cart</a></li>
<li><a href="{{ route('shop.checkout.cart.index') }}">{{ __('shop::app.header.cart') }}</a></li>
<li><a href="{{ route('customer.session.destroy') }}">Logout</a></li>
<li><a href="{{ route('customer.session.destroy') }}">{{ __('shop::app.header.logout') }}</a></li>
</ul>
</div>

View File

@ -1,3 +1,3 @@
<a href="/buynow" class="btn btn-lg btn-primary buynow" style="text-align: center;">
<a href="{{ route('shop.product.buynow', $product->id)}}" class="btn btn-lg btn-primary buynow" style="text-align: center;">
{{ __('shop::app.products.buy-now') }}
</a>

View File

@ -32,8 +32,6 @@
@include ('shop::products.price', ['product' => $product])
@include ('shop::products.review', ['product' => $product])
@if(Route::currentRouteName() == "shop.products.index")
@include ('shop::products.add-to', ['product' => $product])
@else

View File

@ -27,11 +27,11 @@
</div>
@if(!is_null($customer))
@auth('customer')
<a href="{{ route('shop.reviews.create', $product->url_key) }}" class="btn btn-lg btn-primary">
{{ __('shop::app.products.write-review-btn') }}
</a>
@endif
@endauth
</div>
@ -72,7 +72,7 @@
</div>
</div>
@else
@if(!is_null($customer))
@auth('customer')
<div class="rating-reviews">
<div class="rating-header">
<a href="{{ route('shop.reviews.create', $product->url_key) }}" class="btn btn-lg btn-primary">
@ -80,5 +80,5 @@
</a>
</div>
</div>
@endif
@endauth
@endif

View File

@ -853,6 +853,12 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
cursor: pointer;
}
.header .header-top div.right-content .currency-switcher .dropdown-toggle {
line-height: 25px;
margin-left: 14px;
margin-right: 14px;
}
.header .header-top div.right-content .currency-switcher .dropdown-list {
width: 100px;
top: 37px;
@ -865,6 +871,7 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
.header .header-top div.right-content ul.account-dropdown-container {
float: right;
border-right: 2px solid #C7C7C7;
cursor: pointer;
}
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown {
@ -875,8 +882,24 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
margin-right: 14px;
margin-left: 14px;
margin-right: 14px;
}
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown .account {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown .dropdown-list {
@ -1261,6 +1284,7 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
display: -webkit-box !important;
display: -ms-flexbox !important;
display: flex !important;
margin-left: 12px;
}
}
@ -1859,7 +1883,6 @@ section.product-detail div.layouter form .details .attributes {
}
.rating-reviews .rating-header {
font-weight: 600;
padding: 20px 0;
}