merge with master

This commit is contained in:
rahul shukla 2019-01-25 10:58:47 +05:30
commit 363efffaaa
72 changed files with 851 additions and 311 deletions

View File

@ -53,7 +53,7 @@ Bagisto is using power of both of these frameworks and making best out of it out
* **OS**: Ubuntu 16.04 LTS or higher.
* **SERVER**: Apache 2 or NGINX
* **RAM**: 2 GB or higer.
* **RAM**: 2 GB or higher.
* **PHP**: 7.1.17 or higher.
* **Processor**: Clock Cycle 1Ghz or higher.
* **Mysql**: 5.7.23 or higher.

View File

@ -147,7 +147,7 @@ return [
'editor' =>'vscode',
/**
* Debug blacklisting
* Blacklisting attributes while debugging
*/
'debug_blacklist' => [
'_ENV' => [

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/admin.js": "/js/admin.js?id=c70dacdf945a32e04b77",
"/js/admin.js": "/js/admin.js?id=7683c8f127f6ad2ac3ce",
"/css/admin.css": "/css/admin.css?id=3e790c2215bf5c60ac21"
}
}

View File

@ -36,7 +36,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -45,7 +44,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -54,7 +52,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -63,7 +60,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -72,7 +68,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value->is_required == 1)
return 'True';
@ -87,7 +82,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value->is_unique == 1)
return 'True';
@ -102,7 +96,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value->value_per_locale == 1)
return 'True';
@ -117,7 +110,6 @@ class AttributeDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
'wrapper' => function($value) {
if ($value->value_per_channel == 1)
return 'True';

View File

@ -34,7 +34,6 @@ class AttributeFamilyDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class AttributeFamilyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class AttributeFamilyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -38,7 +38,6 @@ class CategoryDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -47,7 +46,6 @@ class CategoryDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -56,7 +54,6 @@ class CategoryDataGrid extends DataGrid
'type' => 'string',
'searchable' => false,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -65,7 +62,6 @@ class CategoryDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value->status == 1)
return 'Active';
@ -80,20 +76,19 @@ class CategoryDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
}
public function prepareActions() {
$this->addAction([
'type' => 'Edit',
'route' => 'admin.catalog.products.edit',
'route' => 'admin.catalog.categories.edit',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'route' => 'admin.catalog.products.delete',
'route' => 'admin.catalog.categories.delete',
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
'icon' => 'icon trash-icon'
]);

View File

@ -34,7 +34,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -61,7 +58,6 @@ class ChannelDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
}

View File

@ -34,7 +34,6 @@ class CurrencyDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class CurrencyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class CurrencyDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -39,7 +39,6 @@ class CustomerDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -48,7 +47,6 @@ class CustomerDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -57,7 +55,6 @@ class CustomerDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -66,7 +63,6 @@ class CustomerDataGrid extends DataGrid
'type' => 'string',
'searchable' => false,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -34,7 +34,6 @@ class CustomerGroupDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,20 +42,19 @@ class CustomerGroupDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}
public function prepareActions() {
$this->addAction([
'type' => 'Edit',
'route' => 'admin.customer.edit',
'route' => 'admin.groups.edit',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'route' => 'admin.customer.delete',
'route' => 'admin.groups.delete',
'icon' => 'icon trash-icon'
]);
}

View File

@ -39,7 +39,6 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -48,7 +47,6 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -57,7 +55,6 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -66,7 +63,6 @@ class CustomerReviewDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([

View File

@ -36,7 +36,6 @@ class ExchangeRatesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -45,7 +44,6 @@ class ExchangeRatesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -54,7 +52,6 @@ class ExchangeRatesDataGrid extends DataGrid
'type' => 'number',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -34,7 +34,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -61,7 +58,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -70,7 +66,6 @@ class InventorySourcesDataGrid extends DataGrid
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value->status == 1)
return 'Active';

View File

@ -34,7 +34,6 @@ class LocalesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class LocalesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class LocalesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -34,7 +34,6 @@ class NewsLetterDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class NewsLetterDataGrid extends DataGrid
'type' => 'string',
'searchable' => false,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value->is_subscribed == 1)
return 'True';
@ -58,7 +56,6 @@ class NewsLetterDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -36,7 +36,6 @@ class OrderDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -45,7 +44,6 @@ class OrderDataGrid extends DataGrid
'type' => 'price',
'searchable' => false,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -54,7 +52,6 @@ class OrderDataGrid extends DataGrid
'type' => 'price',
'searchable' => false,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -63,7 +60,6 @@ class OrderDataGrid extends DataGrid
'type' => 'datetime',
'sortable' => true,
'searchable' => false,
'width' => '100px',
]);
$this->addColumn([
@ -72,7 +68,6 @@ class OrderDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -81,7 +76,6 @@ class OrderDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px',
'closure' => true,
'wrapper' => function ($value) {
if ($value->status == 'processing')
@ -107,7 +101,6 @@ class OrderDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -34,7 +34,6 @@ class OrderInvoicesDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class OrderInvoicesDataGrid extends DataGrid
'type' => 'number',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class OrderInvoicesDataGrid extends DataGrid
'type' => 'price',
'searchable' => true,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -61,7 +58,6 @@ class OrderInvoicesDataGrid extends DataGrid
'type' => 'datetime',
'searchable' => true,
'sortable' => true,
'width' => '100px',
]);
}

View File

@ -46,7 +46,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -55,7 +54,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'number',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -64,7 +62,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -73,7 +70,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px',
]);
$this->addColumn([
@ -82,7 +78,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'datetime',
'sortable' => true,
'searchable' => false,
'width' => '100px'
]);
$this->addColumn([
@ -91,7 +86,6 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'datetime',
'sortable' => true,
'searchable' => false,
'width' => '100px'
]);
$this->addColumn([
@ -100,14 +94,13 @@ class OrderShipmentsDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
]);
}
public function prepareActions() {
$this->addAction([
'type' => 'View',
'route' => 'admin.sales.orders.view',
'route' => 'admin.sales.shipments.view',
'icon' => 'icon eye-icon'
]);
}

View File

@ -40,7 +40,7 @@ class ProductDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
// 'width' => '40px'
]);
$this->addColumn([
@ -49,7 +49,7 @@ class ProductDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
// 'width' => '100px'
]);
$this->addColumn([
@ -58,7 +58,7 @@ class ProductDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
// 'width' => '100px'
]);
$this->addColumn([
@ -67,7 +67,7 @@ class ProductDataGrid extends DataGrid
'type' => 'string',
'sortable' => true,
'searchable' => true,
'width' => '100px'
// 'width' => '100px'
]);
$this->addColumn([
@ -76,7 +76,7 @@ class ProductDataGrid extends DataGrid
'type' => 'boolean',
'sortable' => true,
'searchable' => false,
'width' => '100px',
// 'width' => '100px',
'wrapper' => function($value) {
if ($value->status == 1)
return 'Active';
@ -91,7 +91,7 @@ class ProductDataGrid extends DataGrid
'type' => 'price',
'sortable' => true,
'searchable' => false,
'width' => '100px'
// 'width' => '100px'
]);
$this->addColumn([
@ -100,7 +100,7 @@ class ProductDataGrid extends DataGrid
'type' => 'number',
'sortable' => true,
'searchable' => false,
'width' => '100px'
// 'width' => '100px'
]);
}

View File

@ -43,7 +43,6 @@ class RolesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +51,6 @@ class RolesDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -38,7 +38,6 @@ class SliderDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -47,7 +46,6 @@ class SliderDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -56,7 +54,6 @@ class SliderDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -34,7 +34,6 @@ class TaxCategoryDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class TaxCategoryDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class TaxCategoryDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}

View File

@ -34,7 +34,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -43,7 +42,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -52,7 +50,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -61,7 +58,6 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -70,20 +66,19 @@ class TaxRateDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}
public function prepareActions() {
$this->addAction([
'type' => 'Edit',
'route' => 'admin.tax-categories.edit',
'route' => 'admin.tax-rates.store',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'route' => 'admin.tax-categories.delete',
'route' => 'admin.tax-rates.delete',
'icon' => 'icon trash-icon'
]);
}

View File

@ -38,7 +38,6 @@ class UserDataGrid extends DataGrid
'type' => 'number',
'searchable' => false,
'sortable' => true,
'width' => '40px'
]);
$this->addColumn([
@ -47,7 +46,6 @@ class UserDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -56,7 +54,6 @@ class UserDataGrid extends DataGrid
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'width' => '100px',
'wrapper' => function($value) {
if ($value->status == 1) {
return 'Active';
@ -72,7 +69,6 @@ class UserDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
$this->addColumn([
@ -81,14 +77,13 @@ class UserDataGrid extends DataGrid
'type' => 'string',
'searchable' => true,
'sortable' => true,
'width' => '100px'
]);
}
public function prepareActions() {
$this->addAction([
'type' => 'Edit',
'route' => 'admin.roles.edit',
'route' => 'admin.users.edit',
'icon' => 'icon pencil-lg-icon'
]);
}

View File

@ -3,6 +3,7 @@
namespace Webkul\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Category\Database\Seeders\DatabaseSeeder as CategorySeeder;
use Webkul\Attribute\Database\Seeders\DatabaseSeeder as AttributeSeeder;
use Webkul\Core\Database\Seeders\DatabaseSeeder as CoreSeeder;
use Webkul\User\Database\Seeders\DatabaseSeeder as UserSeeder;
@ -18,6 +19,7 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(CategorySeeder::class);
$this->call(CoreSeeder::class);
$this->call(InventorySeeder::class);
$this->call(AttributeSeeder::class);

View File

@ -157,12 +157,11 @@ class ShipmentController extends Controller
? $orderItem->child->product
: $orderItem->product;
$inventory = $product->inventories()
$availableQty = $product->inventories()
->where('inventory_source_id', $data['shipment']['source'])
->where('vendor_id', 0)
->first();
->sum('qty');
if ($orderItem->qty_to_ship < $qty || $inventory->qty < $qty) {
if ($orderItem->qty_to_ship < $qty || $availableQty < $qty) {
return false;
}

View File

@ -35,6 +35,8 @@ Route::group(['middleware' => ['web']], function () {
// Admin Routes
Route::group(['middleware' => ['admin']], function () {
Route::get('testev', 'Webkul\Product\Http\Controllers\ProductController@testProductFlat');
Route::get('/logout', 'Webkul\User\Http\Controllers\SessionController@destroy')->defaults('_config', [
'redirect' => 'admin.session.create'
])->name('admin.session.destroy');

View File

@ -4,6 +4,7 @@ namespace Webkul\Admin\Listeners;
use Webkul\Product\Repositories\ProductRepository;
use Webkul\Product\Repositories\ProductGridRepository;
use Webkul\Product\Repositories\ProductFlatRepository;
use Webkul\Product\Helpers\Price;
/**
@ -23,19 +24,28 @@ class Product {
*
* @var array
*/
Protected $price;
protected $price;
/**
* Product Flat Object
*
* Repository Object
*/
protected $productFlat;
/**
* Product Grid Repository Object
*/
protected $productGrid;
public function __construct(ProductRepository $product, ProductGridRepository $productGrid, Price $price)
public function __construct(ProductRepository $product, ProductGridRepository $productGrid, ProductFlatRepository $productFlat, Price $price)
{
$this->product = $product;
$this->productGrid = $productGrid;
$this->productFlat = $productFlat;
$this->price = $price;
}
@ -91,7 +101,7 @@ class Product {
'name' => $variant->name,
'quantity' => 0,
'status' => $variant->status,
'price' => $variant->price,
'price' => $variant->price
];
$this->productGrid->create($variantObj);
@ -269,17 +279,5 @@ class Product {
//find if there is duplicacy in the products grid here
}
/**
* Take action for attribute creation
*/
public function createColumnBasedOnAttribute($attribute) {
dd($attribute);
}
/**
* Take action for attribute updatation
*/
public function updateColumnBasedOnAttribute($attribute) {
dd($attribute);
}
public function syncFlat() {}
}

View File

@ -27,7 +27,5 @@ class EventServiceProvider extends ServiceProvider
Event::listen('catalog.product.create.after', 'Webkul\Admin\Listeners\Product@afterProductCreated');
Event::listen('catalog.product.update.after', 'Webkul\Admin\Listeners\Product@afterProductUpdate');
// Event::listen('after.attribute.update', 'Webkul\Admin\Listeners\Product@updateColumnBasedOnAttribute');
}
}

View File

@ -5,6 +5,8 @@ require("./bootstrap");
Vue.use(VeeValidate);
window.eventBus = new Vue();
$(document).ready(function () {
Vue.config.ignoredElements = [
'option-wrapper',

View File

@ -7,7 +7,7 @@
$qty = 0;
foreach ($product->inventories as $inventory) {
if ($inventory->inventory_source_id == $inventorySource->id && ! $inventory->vendor_id) {
if ($inventory->inventory_source_id == $inventorySource->id) {
$qty = $inventory->qty;
break;
}

View File

@ -325,7 +325,7 @@
sourceInventoryQty (inventorySourceId) {
var inventories = this.variant.inventories.filter(function(inventory) {
return inventorySourceId === inventory.inventory_source_id && !inventory.vendor_id;
return inventorySourceId === inventory.inventory_source_id;
})
if (inventories.length)

View File

@ -312,9 +312,8 @@
$product = $item->type == 'configurable' ? $item->child->product : $item->product;
foreach ($product->inventories as $inventory) {
if ($inventory->inventory_source_id == $inventorySource->id && !$inventory->vendor_id) {
$sourceQty = $inventory->qty;
break;
if ($inventory->inventory_source_id == $inventorySource->id) {
$sourceQty += $inventory->qty;
}
}
?>

View File

@ -5,7 +5,7 @@ namespace Webkul\Attribute\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
// use Event;
use Event;
/**
* Catalog attribute controller
@ -75,9 +75,15 @@ class AttributeController extends Controller
'type' => 'required'
]);
$attribute = $this->attribute->create(request()->all());
$data = request()->all();
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
$data['is_user_defined'] = 1;
$attribute = $this->attribute->create($data);
Event::fire('after.attribute.created', $attribute);
session()->flash('success', 'Attribute created successfully.');
return redirect()->route($this->_config['redirect']);
}
@ -112,7 +118,9 @@ class AttributeController extends Controller
$attribute = $this->attribute->update(request()->all(), $id);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Attribute']));
// Event::fire('after.attribute.updated', $attribute);
session()->flash('success', 'Attribute updated successfully.');
return redirect()->route($this->_config['redirect']);
}
@ -131,9 +139,12 @@ class AttributeController extends Controller
session()->flash('error', trans('admin::app.response.user-define-error', ['name' => 'attribute']));
} else {
try {
Event::fire('after.attribute.deleted', $attribute);
$this->attribute->delete($id);
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Attribute']));
session()->flash('success', 'Attribute deleted successfully.');
} catch(\Exception $e) {
session()->flash('error', trans('admin::app.response.attribute-error', ['name' => 'Attribute']));
}

View File

@ -15,23 +15,11 @@ class CategoryTableSeeder extends Seeder
$now = Carbon::now();
DB::table('categories')->insert([
['id' => '1','position' => '1','image' => NULL,'status' => '1','_lft' => '1','_rgt' => '14','parent_id' => NULL, 'created_at' => $now, 'updated_at' => $now],
['id' => '2','position' => '1','image' => NULL,'status' => '1','_lft' => '2','_rgt' => '7','parent_id' => '1', 'created_at' => $now, 'updated_at' => $now],
['id' => '3','position' => '2','image' => NULL,'status' => '1','_lft' => '8','_rgt' => '13','parent_id' => '1', 'created_at' => $now, 'updated_at' => $now],
['id' => '4','position' => '1','image' => NULL,'status' => '1','_lft' => '5','_rgt' => '6','parent_id' => '2', 'created_at' => $now, 'updated_at' => $now],
['id' => '5','position' => '2','image' => NULL,'status' => '1','_lft' => '3','_rgt' => '4','parent_id' => '2', 'created_at' => $now, 'updated_at' => $now],
['id' => '6','position' => '1','image' => NULL,'status' => '1','_lft' => '9','_rgt' => '10','parent_id' => '3', 'created_at' => $now, 'updated_at' => $now],
['id' => '7','position' => '2','image' => NULL,'status' => '1','_lft' => '11','_rgt' => '12','parent_id' => '3', 'created_at' => $now, 'updated_at' => $now]
['id' => '1','position' => '1','image' => NULL,'status' => '1','_lft' => '1','_rgt' => '14','parent_id' => NULL, 'created_at' => $now, 'updated_at' => $now]
]);
DB::table('category_translations')->insert([
['id' => '1','name' => 'Root','slug' => 'root','description' => 'Root','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '1','locale' => 'en'],
['id' => '2','name' => 'Women','slug' => 'women','description' => 'Women','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '2','locale' => 'en'],
['id' => '3','name' => 'Men','slug' => 'men','description' => 'Men','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '3','locale' => 'en'],
['id' => '4','name' => 'Tops','slug' => 'tops-women','description' => 'Tops','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '4','locale' => 'en'],
['id' => '5','name' => 'Bottoms','slug' => 'bottoms-women','description' => 'Bottoms','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '5','locale' => 'en'],
['id' => '6','name' => 'Tops','slug' => 'tops-men','description' => 'Tops','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '6','locale' => 'en'],
['id' => '7','name' => 'Bottoms','slug' => 'bottoms-men','description' => 'Bottoms','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '7','locale' => 'en']
['id' => '1','name' => 'Root','slug' => 'root','description' => 'Root','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '1','locale' => 'en']
]);
}
}

View File

@ -775,5 +775,15 @@ class Core
}
return $merged;
}
}
public function convertEmptyStringsToNull($array) {
foreach($array as $key => $value) {
if($value == "" || $value == "null") {
$array[$key] = null;
}
}
return $array;
}
}

View File

@ -15,6 +15,7 @@ class ChannelTableSeeder extends Seeder
'id' => 1,
'code' => 'default',
'name' => 'Default',
'root_category_id' => 1,
'home_page_content' => '<p>@include("shop::home.slider") @include("shop::home.featured-products") @include("shop::home.new-products")</p><div style="width: 100%; float: left; padding: 0 18px; margin-bottom: 40px;"><div style="width: 60%; float: left;"><img src="themes/default/assets/images/1.png" /></div><div style="width: 40%; float: left;"><img src="themes/default/assets/images/2.png" /> <img style="margin-top: 36px;" src="themes/default/assets/images/3.png" /></div></div>',
'footer_content' => '<div class="list-container"><span class="list-heading">Quick Links</span><ul class="list-group"><li><a href="#">About Us</a></li><li><a href="#">Return Policy</a></li><li><a href="#">Refund Policy</a></li><li><a href="#">Terms and conditions</a></li><li><a href="#">Terms of Use</a></li><li><a href="#">Contact Us</a></li></ul></div><div class="list-container"><span class="list-heading">Connect With Us</span><ul class="list-group"><li><a href="#"><span class="icon icon-facebook"></span>Facebook </a></li><li><a href="#"><span class="icon icon-twitter"></span> Twitter </a></li><li><a href="#"><span class="icon icon-instagram"></span> Instagram </a></li><li><a href="#"> <span class="icon icon-google-plus"></span>Google+ </a></li><li><a href="#"> <span class="icon icon-linkedin"></span>LinkedIn </a></li></ul></div>',
'name' => 'Default',

View File

@ -40,12 +40,12 @@ class FilterByAttributesCriteria extends AbstractProduct implements CriteriaInte
public function apply($model, RepositoryInterface $repository)
{
$model = $model->leftJoin('products as variants', 'products.id', '=', 'variants.parent_id');
$model = $model->where(function($query1) use($model) {
$aliases = [
'products' => 'filter_',
'variants' => 'variant_filter_'
];
'products' => 'filter_',
'variants' => 'variant_filter_'
];
foreach ($aliases as $table => $alias) {
$query1 = $query1->orWhere(function($query2) use($model, $table, $alias) {
@ -58,8 +58,9 @@ class FilterByAttributesCriteria extends AbstractProduct implements CriteriaInte
$query2 = $this->applyChannelLocaleFilter($attribute, $query2, $aliasTemp);
$column = ProductAttributeValue::$attributeTypeFields[$attribute->type];
$temp = explode(',', request()->get($attribute->code));
if ($attribute->type != 'price') {
$query2 = $query2->where($aliasTemp . '.attribute_id', $attribute->id);

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNewFromToColumnsInProductFlat extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasTable('product_flat')) {
Schema::table('product_flat', function (Blueprint $table) {
$table->date('new_to')->after('new');
$table->date('new_from')->after('new');
$table->unique(['product_id', 'channel', 'locale'], 'product_flat_unique_index');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasTable('product_flat')) {
Schema::table('product_flat', function (Blueprint $table) {
$table->dropColumn('new_from');
$table->dropColumn('new_to');
$table->dropIndex('product_flat_unique_index');
});
}
}
}

View File

@ -8,10 +8,11 @@ use Illuminate\Support\Facades\Event;
use Webkul\Product\Http\Requests\ProductForm;
use Webkul\Product\Repositories\ProductRepository as Product;
use Webkul\Product\Repositories\ProductGridRepository as ProductGrid;
use Webkul\Product\Repositories\ProductFlatRepository as ProductFlat;
use Webkul\Product\Repositories\ProductAttributeValueRepository as ProductAttributeValue;
use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily;
use Webkul\Category\Repositories\CategoryRepository as Category;
use Webkul\Inventory\Repositories\InventorySourceRepository as InventorySource;
use Webkul\Admin\DataGrids\TestDataGrid;
/**
* Product controller
@ -62,6 +63,8 @@ class ProductController extends Controller
* @var array
*/
protected $productGrid;
protected $productFlat;
protected $productAttributeValue;
/**
* Create a new controller instance.
@ -77,7 +80,9 @@ class ProductController extends Controller
Category $category,
InventorySource $inventorySource,
Product $product,
ProductGrid $productGrid)
ProductGrid $productGrid,
ProductFlat $productFlat,
ProductAttributeValue $productAttributeValue)
{
$this->attributeFamily = $attributeFamily;
@ -89,6 +94,10 @@ class ProductController extends Controller
$this->productGrid = $productGrid;
$this->productFlat = $productFlat;
$this->productAttributeValue = $productAttributeValue;
$this->_config = request('_config');
}
@ -127,7 +136,7 @@ class ProductController extends Controller
*/
public function store()
{
if (! request()->get('family') && request()->input('type') == 'configurable' && request()->input('sku') != '') {
if (!request()->get('family') && request()->input('type') == 'configurable' && request()->input('sku') != '') {
return redirect(url()->current() . '?family=' . request()->input('attribute_family_id') . '&sku=' . request()->input('sku'));
}
@ -225,11 +234,11 @@ class ProductController extends Controller
{
$data = request()->all();
if (! isset($data['massaction-type'])) {
if (!isset($data['massaction-type'])) {
return redirect()->back();
}
if (! $data['massaction-type'] == 'update') {
if (!$data['massaction-type'] == 'update') {
return redirect()->back();
}
@ -237,10 +246,10 @@ class ProductController extends Controller
foreach ($productIds as $productId) {
$this->product->update([
'channel' => null,
'locale' => null,
'status' => $data['update-options']
], $productId);
'channel' => null,
'locale' => null,
'status' => $data['update-options']
], $productId);
}
session()->flash('success', trans('admin::app.catalog.products.mass-update-success'));
@ -257,4 +266,160 @@ class ProductController extends Controller
return redirect()->route('admin.catalog.products.index');
}
// public function testProductFlat() {
// $product = $this->product->find(2);
// $productAttributes = $product->attribute_family->custom_attributes;
// $allLocales = core()->getAllLocales();
// $productsFlat = array();
// $channelLocaleMap = array();
// $nonDependentAttributes = array();
// $localeDependentAttributes = array();
// $channelDependentAttributes = array();
// $channelLocaleDependentAttributes = array();
// foreach($productAttributes as $key => $productAttribute) {
// if($productAttribute->value_per_channel) {
// if($productAttribute->value_per_locale) {
// array_push($channelLocaleDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
// } else {
// array_push($channelDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
// }
// } else if($productAttribute->value_per_locale && !$productAttribute->value_per_channel) {
// array_push($localeDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
// } else {
// array_push($nonDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
// }
// }
// foreach(core()->getAllChannels() as $channel) {
// $dummy = [
// 'product_id' => $product->id,
// 'channel' => $channel->code,
// 'locale' => null,
// 'data' => $channelDependentAttributes
// ];
// array_push($channelLocaleMap, $dummy);
// $dummy = [];
// foreach($channel->locales as $locale) {
// $dummy = [
// 'product_id' => $product->id,
// 'channel' => $channel->code,
// 'locale' => $locale->code,
// 'data' => $channelLocaleDependentAttributes
// ];
// array_push($channelLocaleMap, $dummy);
// $dummy = [];
// }
// }
// $dummy = [
// 'product_id' => $product->id,
// 'channel' => null,
// 'locale' => null,
// 'data' => $nonDependentAttributes
// ];
// array_push($channelLocaleMap, $dummy);
// $dummy = [];
// foreach($allLocales as $key => $allLocale) {
// $dummy = [
// 'product_id' => $product->id,
// 'channel' => null,
// 'locale' => $allLocale->code,
// 'data' => $localeDependentAttributes
// ];
// array_push($channelLocaleMap, $dummy);
// $dummy = [];
// }
// $productFlatObjects = $channelLocaleMap;
// $keyOfNonDependentAttributes = null;
// foreach($productAttributes as $productAttribute) {
// foreach($productFlatObjects as $flatKey => $productFlatObject) {
// if($productFlatObject['channel'] == null && $productFlatObject['locale'] == null) {
// $keyOfNonDependentAttributes = $flatKey;
// }
// foreach($productFlatObject['data'] as $key => $value) {
// if($productAttribute->code == $value['code']) {
// $valueOf = $this->productAttributeValue->findOneWhere([
// 'product_id' => $product->id,
// 'channel' => $productFlatObject['channel'],
// 'locale' => $productFlatObject['locale'],
// 'attribute_id' => $productAttribute->id
// ]);
// if($valueOf != null) {
// $productAttributeColumn = $this->productAttributeValue->model()::$attributeTypeFields[$productAttribute->type];
// $valueOf = $valueOf->{$productAttributeColumn};
// $productFlatObjects[$flatKey][$productAttribute->code] = $valueOf;
// } else {
// $productFlatObjects[$flatKey][$productAttribute->code] = 'null';
// }
// }
// }
// }
// }
// $nonDependentAttributes = $productFlatObjects[$keyOfNonDependentAttributes];
// array_forget($nonDependentAttributes, ['product_id', 'channel', 'locale', 'data', 'visible_individually', 'width', 'height', 'depth']);
// unset($productFlatObjects[$keyOfNonDependentAttributes]);
// $productFlatEntryObject = array();
// $tempFlatObject = array();
// foreach($productFlatObjects as $flatKey => $productFlatObject) {
// unset($productFlatObject['data']);
// if(isset($productFlatObject['short_description'])) {
// $productFlatObject['description'] = $productFlatObject['short_description'];
// unset($productFlatObject['short_description']);
// }
// if(isset($productFlatObject['meta_title'])) {
// unset($productFlatObject['meta_title']);
// unset($productFlatObject['meta_description']);
// unset($productFlatObject['meta_keywords']);
// }
// $tempFlatObject = array_merge($productFlatObject, $nonDependentAttributes);
// $tempFlatObject = core()->convertEmptyStringsToNull($tempFlatObject);
// $exists = $this->productFlat->findWhere([
// 'product_id' => $product->id,
// 'channel' => $tempFlatObject['channel'],
// 'locale' => $tempFlatObject['locale']
// ]);
// if($exists->count() == 0) {
// $result = $this->productFlat->create($tempFlatObject);
// } else {
// $result = $exists->first();
// $result->update($tempFlatObject);
// }
// unset($tempFlatObject);
// }
// return 'true';
// }
}

View File

@ -1,24 +0,0 @@
<?php
namespace Webkul\Admin\Listeners;
/**
* Products Flat Event handler
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ProductFlat {
/**
* After the attribute is updated
*
* @return void
*/
public function afterAttributeUpdated()
{
dd('after attribute is created');
}
}

View File

@ -0,0 +1,270 @@
<?php
namespace Webkul\Product\Listeners;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Webkul\Product\Repositories\ProductFlatRepository as ProductFlat;
use Webkul\Product\Repositories\ProductAttributeValueRepository as ProductAttributeValue;
/**
* Products Flat Event handler
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ProductsFlat
{
/**
* ProductFlat Repository Object
*
* @vatr array
*/
protected $productFlat;
protected $productAttributeValue;
protected $attribute;
public function __construct(ProductFlat $productFlat, ProductAttributeValue $productAttributeValue) {
$this->productAttributeValue = $productAttributeValue;
$this->productFlat = $productFlat;
}
/**
* After the attribute is created
*
* @return void
*/
public function afterAttributeCreated($attribute)
{
if(!$attribute->is_user_defined) {
return false;
}
$attributeType = $attribute->type;
$attributeCode = $attribute->code;
if ($attributeType == 'text' || $attributeType == 'textarea') {
$columnType = 'text';
} else if ($attributeType == 'price') {
$columnType = 'decimal';
} else if ($attributeType == 'boolean') {
$columnType = 'boolean';
} else if ($attributeType == 'select' || $attributeType == 'multiselect') {
if ($attributeType == 'multiselect') {
$columnType = 'text';
} else {
$columnType = 'integer';
}
} else if ($attributeType == 'datetime') {
$columnType = 'dateTime';
} else if ($attributeType == 'date') {
$columnType = 'date';
} else {
return false;
}
if (Schema::hasTable('product_flat')) {
if (!Schema::hasColumn('product_flat', strtolower($attribute->code))) {
Schema::table('product_flat', function (Blueprint $table) use($columnType, $attributeCode, $attributeType) {
$table->{$columnType}(strtolower($attributeCode))->nullable();
if($attributeType == 'select' || $attributeType == 'multiselect') {
$table->string(strtolower($attributeCode).'_label')->nullable();
}
});
return true;
} else {
return false;
}
}
}
/**
* After the attribute is updated
*
* @return void
*/
public function afterAttributeUpdated($attribute)
{
return true;
}
public function afterAttributeDeleted($attribute)
{
if (Schema::hasTable('product_flat')) {
if (Schema::hasColumn('product_flat', strtolower($attribute->code))) {
Schema::table('product_flat', function (Blueprint $table) use($attribute){
$table->dropColumn(strtolower($attribute->code));
if ($attribute->type == 'select' || $attribute->type == 'multiselect') {
$table->dropColumn(strtolower($attribute->code).'_label');
}
});
return true;
} else {
return false;
}
}
}
public function afterProductCreatedOrUpdated($ProductFlat) {
$product = $ProductFlat;
$productAttributes = $product->attribute_family->custom_attributes;
$allLocales = core()->getAllLocales();
$productsFlat = array();
$channelLocaleMap = array();
$nonDependentAttributes = array();
$localeDependentAttributes = array();
$channelDependentAttributes = array();
$channelLocaleDependentAttributes = array();
foreach($productAttributes as $key => $productAttribute) {
if($productAttribute->value_per_channel) {
if($productAttribute->value_per_locale) {
array_push($channelLocaleDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
} else {
array_push($channelDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
}
} else if($productAttribute->value_per_locale && !$productAttribute->value_per_channel) {
array_push($localeDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
} else {
array_push($nonDependentAttributes, ['id' => $productAttribute->id, 'code' => $productAttribute->code]);
}
}
foreach(core()->getAllChannels() as $channel) {
$dummy = [
'product_id' => $product->id,
'channel' => $channel->code,
'locale' => null,
'data' => $channelDependentAttributes
];
array_push($channelLocaleMap, $dummy);
$dummy = [];
foreach($channel->locales as $locale) {
$dummy = [
'product_id' => $product->id,
'channel' => $channel->code,
'locale' => $locale->code,
'data' => $channelLocaleDependentAttributes
];
array_push($channelLocaleMap, $dummy);
$dummy = [];
}
}
$dummy = [
'product_id' => $product->id,
'channel' => null,
'locale' => null,
'data' => $nonDependentAttributes
];
array_push($channelLocaleMap, $dummy);
$dummy = [];
foreach($allLocales as $key => $allLocale) {
$dummy = [
'product_id' => $product->id,
'channel' => null,
'locale' => $allLocale->code,
'data' => $localeDependentAttributes
];
array_push($channelLocaleMap, $dummy);
$dummy = [];
}
$productFlatObjects = $channelLocaleMap;
$keyOfNonDependentAttributes = null;
foreach($productAttributes as $productAttribute) {
foreach($productFlatObjects as $flatKey => $productFlatObject) {
if($productFlatObject['channel'] == null && $productFlatObject['locale'] == null) {
$keyOfNonDependentAttributes = $flatKey;
}
foreach($productFlatObject['data'] as $key => $value) {
if($productAttribute->code == $value['code']) {
$valueOf = $this->productAttributeValue->findOneWhere([
'product_id' => $product->id,
'channel' => $productFlatObject['channel'],
'locale' => $productFlatObject['locale'],
'attribute_id' => $productAttribute->id
]);
if($valueOf != null) {
$productAttributeColumn = $this->productAttributeValue->model()::$attributeTypeFields[$productAttribute->type];
$valueOf = $valueOf->{$productAttributeColumn};
$productFlatObjects[$flatKey][$productAttribute->code] = $valueOf;
} else {
$productFlatObjects[$flatKey][$productAttribute->code] = 'null';
}
}
}
}
}
$nonDependentAttributes = $productFlatObjects[$keyOfNonDependentAttributes];
array_forget($nonDependentAttributes, ['product_id', 'channel', 'locale', 'data', 'visible_individually', 'width', 'height', 'depth', 'tax_category_id']);
unset($productFlatObjects[$keyOfNonDependentAttributes]);
$productFlatEntryObject = array();
$tempFlatObject = array();
foreach($productFlatObjects as $flatKey => $productFlatObject) {
unset($productFlatObject['data']);
if(isset($productFlatObject['short_description'])) {
$productFlatObject['description'] = $productFlatObject['short_description'];
unset($productFlatObject['short_description']);
}
if(isset($productFlatObject['meta_title'])) {
unset($productFlatObject['meta_title']);
unset($productFlatObject['meta_description']);
unset($productFlatObject['meta_keywords']);
}
$tempFlatObject = array_merge($productFlatObject, $nonDependentAttributes);
$tempFlatObject = core()->convertEmptyStringsToNull($tempFlatObject);
$exists = $this->productFlat->findWhere([
'product_id' => $product->id,
'channel' => $tempFlatObject['channel'],
'locale' => $tempFlatObject['locale']
]);
if($exists->count() == 0) {
$result = $this->productFlat->create($tempFlatObject);
} else {
$result = $exists->first();
$result->update($tempFlatObject);
}
unset($tempFlatObject);
}
return 'true';
}
}

View File

@ -28,19 +28,19 @@ class ProductAttributeValue extends Model
];
protected $fillable = [
'product_id',
'attribute_id',
'channel_id',
'locale',
'channel',
'text_value',
'boolean_value',
'integer_value',
'float_value',
'datetime_value',
'date_value',
'json_value'
];
'product_id',
'attribute_id',
'channel_id',
'locale',
'channel',
'text_value',
'boolean_value',
'integer_value',
'float_value',
'datetime_value',
'date_value',
'json_value'
];
/**
* Get the attribute that owns the attribute value.

View File

@ -0,0 +1,22 @@
<?php
namespace Webkul\Product\Models;
use Illuminate\Database\Eloquent\Model;
// use Webkul\Attribute\Models\AttributeFamily;
// use Webkul\Category\Models\Category;
// use Webkul\Attribute\Models\Attribute;
// use Webkul\Product\Models\ProductAttributeValue;
// use Webkul\Product\Models\ProductInventory;
// use Webkul\Product\Models\ProductImage;
// use Webkul\Inventory\Models\InventorySource;
// use Webkul\Product\Models\ProductReview;
class ProductFlat extends Model
{
protected $table = 'product_flat';
protected $guarded = ['id', 'created_at', 'updated_at'];
public $timestamps = false;
}

View File

@ -14,6 +14,15 @@ class EventServiceProvider extends ServiceProvider
*/
public function boot()
{
Event::listen('after.attribute.update', 'Webkul\Product\Listeners\ProductFlat@afterAttributeUpdated');
// Event::listen('after.attribute.updated', 'Webkul\Product\Listeners\ProductsFlat@afterAttributeUpdated');
Event::listen('after.attribute.created', 'Webkul\Product\Listeners\ProductsFlat@afterAttributeCreated');
Event::listen('after.attribute.deleted', 'Webkul\Product\Listeners\ProductsFlat@afterAttributeDeleted');
Event::listen('after.product.created', 'Webkul\Product\Listeners\ProductsFlat@afterProductCreatedOrUpdated');
Event::listen('after.product.updated', 'Webkul\Product\Listeners\ProductsFlat@afterProductCreatedOrUpdated');
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace Webkul\Product\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
use Webkul\Product\Repositories\ProductRepository as Product;
use Webkul\Product\Helpers\Price;
/**
* Product Repository
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class ProductFlatRepository extends Repository
{
protected $product;
/**
* Price Object
*
* @var array
*/
protected $price;
public function __construct(
Product $product,
Price $price,
App $app
) {
$this->product = $product;
$this->price = $price;
parent::__construct($app);
}
public function model()
{
return 'Webkul\Product\Models\ProductFlat';
}
}

View File

@ -108,7 +108,7 @@ class ProductGridRepository extends Repository
return $this->getModel()->where('product_id', $variant->id)->update($gridObject);
}
}
return false;
}
}

View File

@ -144,7 +144,6 @@ class ProductRepository extends Repository
//after store of the product
Event::fire('catalog.product.create.after', $product);
return $product;
}
@ -233,6 +232,9 @@ class ProductRepository extends Repository
Event::fire('catalog.product.update.after', $product);
//correct it after making sure which event to use.
Event::fire('after.product.updated', $product);
return $product;
}
@ -243,7 +245,7 @@ class ProductRepository extends Repository
public function delete($id)
{
Event::fire('catalog.product.delete.before', $id);
parent::delete($id);
Event::fire('catalog.product.delete.after', $id);
@ -512,14 +514,4 @@ class ProductRepository extends Repository
return $query->distinct()->addSelect('products.*')->where('pav.text_value', 'like', '%'.$term.'%');
})->paginate(4);
}
/**
* break the search term into explode by using space and tell which exploded item is attribute
* , category, super attribute or combination of them.
*/
public function breakTheTerm($term) {
$explodedTerm = (explode(" ", $term));
dd($term);
}
}

View File

@ -18,7 +18,7 @@ class CreateOrderPaymentTable extends Migration
$table->string('method');
$table->string('method_title')->nullable();
$table->integer('order_id')->nullable()->unsigned();
$table->foreign('order_id')->references('id')->on('orders');
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -29,6 +29,9 @@ class ShipmentItemRepository extends Repository
*/
public function updateProductInventory($data)
{
if (! $data['product'])
return;
$orderedInventory = $data['product']->ordered_inventories()
->where('channel_id', $data['shipment']->order->channel->id)
->first();
@ -54,6 +57,9 @@ class ShipmentItemRepository extends Repository
->where('inventory_source_id', $data['shipment']->inventory_source_id)
->first();
if (!$inventory)
return;
if (($qty = $inventory->qty - $data['qty']) < 0) {
$qty = 0;
}

View File

@ -106,6 +106,9 @@ class ShipmentRepository extends Repository
$orderItem = $this->orderItem->find($itemId);
if ($qty > $orderItem->qty_to_ship)
$qty = $orderItem->qty_to_ship;
$totalQty += $qty;
$shipmentItem = $this->shipmentItem->create([

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,9 @@
{
<<<<<<< HEAD
"/js/shop.js": "/js/shop.js",
"/css/shop.css": "/css/shop.css"
=======
"/js/shop.js": "/js/shop.js?id=0076f480705e7ce1f8e0",
"/css/shop.css": "/css/shop.css?id=064ee767a010fa58727e"
>>>>>>> 97cb751c56e436baed6fe43c0e0fccfbf726334d
}

View File

@ -89,21 +89,28 @@ class CartController extends Controller
*/
public function add($id)
{
Event::fire('checkout.cart.add.before', $id);
try {
Event::fire('checkout.cart.add.before', $id);
$result = Cart::add($id, request()->except('_token'));
$result = Cart::add($id, request()->except('_token'));
Event::fire('checkout.cart.add.after', $result);
Event::fire('checkout.cart.add.after', $result);
if ($result) {
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
} else {
session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
if ($result) {
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
} else {
session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
}
Cart::collectTotals();
return redirect()->route($this->_config['redirect']);
} catch(\Exception $e) {
session()->flash('error', trans($e->getMessage()));
return redirect()->back();
}
Cart::collectTotals();
return redirect()->back();
}
/**
@ -176,10 +183,15 @@ class CartController extends Controller
public function buyNow($id)
{
Event::fire('checkout.cart.add.before', $id);
$result = Cart::proceedToBuyNow($id);
Event::fire('checkout.cart.add.after', $result);
Cart::collectTotals();
if (! $result) {
return redirect()->back();
} else {

View File

@ -41,7 +41,9 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
])->name('shop.checkout.cart.index');
//Cart Items Add
Route::post('checkout/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->name('cart.add');
Route::post('checkout/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->defaults('_config',[
'redirect' => 'shop.checkout.cart.index'
])->name('cart.add');
//Cart Items Add Configurable for more
Route::get('checkout/cart/addconfigurable/{slug}', 'Webkul\Shop\Http\Controllers\CartController@addConfigurable')->name('cart.add.configurable');

View File

@ -7,6 +7,8 @@ require("./bootstrap");
Vue.use(VeeValidate);
Vue.prototype.$http = axios
window.eventBus = new Vue();
Vue.component("category-nav", require("./components/category-nav.vue"));
Vue.component("category-item", require("./components/category-item.vue"));
Vue.component("image-slider", require("./components/image-slider.vue"));

View File

@ -33,16 +33,28 @@
<div class="item-details">
{!! view_render_event('bagisto.shop.checkout.cart.item.name.before', ['item' => $item]) !!}
<div class="item-title">
<a href="{{ url()->to('/').'/products/'.$item->product->url_key }}">
{{ $item->product->name }}
</a>
</div>
{!! view_render_event('bagisto.shop.checkout.cart.item.name.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart.item.price.before', ['item' => $item]) !!}
<div class="price">
{{ core()->currency($item->base_price) }}
</div>
{!! view_render_event('bagisto.shop.checkout.cart.item.price.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart.item.options.before', ['item' => $item]) !!}
@if ($item->type == 'configurable')
<div class="summary">
@ -51,6 +63,12 @@
</div>
@endif
{!! view_render_event('bagisto.shop.checkout.cart.item.options.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart.item.quantity.before', ['item' => $item]) !!}
<div class="misc">
<div class="control-group" :class="[errors.has('qty[{{$item->id}}]') ? 'has-error' : '']">
<div class="wrap">
@ -76,6 +94,8 @@
@endauth
</div>
{!! view_render_event('bagisto.shop.checkout.cart.item.quantity.after', ['item' => $item]) !!}
@if (! cart()->isItemHaveQuantity($item))
<div class="error-message mt-15">
* {{ __('shop::app.checkout.cart.quantity-error') }}
@ -87,6 +107,8 @@
@endforeach
</div>
{!! view_render_event('bagisto.shop.checkout.cart.controls.after', ['cart' => $cart]) !!}
<div class="misc-controls">
<a href="{{ route('shop.home.index') }}" class="link">{{ __('shop::app.checkout.cart.continue-shopping') }}</a>
@ -102,11 +124,17 @@
@endif
</div>
</div>
{!! view_render_event('bagisto.shop.checkout.cart.controls.after', ['cart' => $cart]) !!}
</form>
</div>
<div class="right-side">
{!! view_render_event('bagisto.shop.checkout.cart.summary.after', ['cart' => $cart]) !!}
@include('shop::checkout.total.summary', ['cart' => $cart])
{!! view_render_event('bagisto.shop.checkout.cart.summary.after', ['cart' => $cart]) !!}
</div>
</div>

View File

@ -22,42 +22,63 @@
<div class="dropdown-header">
<p class="heading">
{{ __('shop::app.checkout.cart.cart-subtotal') }} -
{!! view_render_event('bagisto.shop.checkout.cart-mini.subtotal.before', ['cart' => $cart]) !!}
{{ core()->currency($cart->base_sub_total) }}
{!! view_render_event('bagisto.shop.checkout.cart-mini.subtotal.after', ['cart' => $cart]) !!}
</p>
</div>
<div class="dropdown-content">
@foreach ($items as $item)
{{-- @if ($item->type == "configurable") --}}
<div class="item">
<div class="item-image" >
<?php
if ($item->type == "configurable")
$images = $productImageHelper->getProductBaseImage($item->child->product);
else
$images = $productImageHelper->getProductBaseImage($item->product);
?>
<img src="{{ $images['small_image_url'] }}" />
</div>
<div class="item-details">
{{-- @if ($item->type == "configurable")
<div class="item-name">{{ $item->child->name }}</div>
@else --}}
<div class="item-name">{{ $item->name }}</div>
{{-- @endif --}}
@if ($item->type == "configurable")
<div class="item-options">
{{ trim(Cart::getProductAttributeOptionDetails($item->child->product)['html']) }}
</div>
@endif
<div class="item-price">{{ core()->currency($item->base_total) }}</div>
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
</div>
<div class="item">
<div class="item-image" >
<?php
if ($item->type == "configurable")
$images = $productImageHelper->getProductBaseImage($item->child->product);
else
$images = $productImageHelper->getProductBaseImage($item->product);
?>
<img src="{{ $images['small_image_url'] }}" />
</div>
<div class="item-details">
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.name.before', ['item' => $item]) !!}
<div class="item-name">{{ $item->name }}</div>
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.name.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.options.before', ['item' => $item]) !!}
@if ($item->type == "configurable")
<div class="item-options">
{{ trim(Cart::getProductAttributeOptionDetails($item->child->product)['html']) }}
</div>
@endif
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.options.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.price.before', ['item' => $item]) !!}
<div class="item-price">{{ core()->currency($item->base_total) }}</div>
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.price.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.quantity.before', ['item' => $item]) !!}
<div class="item-qty">Quantity - {{ $item->quantity }}</div>
{!! view_render_event('bagisto.shop.checkout.cart-mini.item.quantity.after', ['item' => $item]) !!}
</div>
</div>
@endforeach
</div>

View File

@ -61,10 +61,17 @@
<div class="item-details">
{!! view_render_event('bagisto.shop.checkout.name.before', ['item' => $item]) !!}
<div class="item-title">
{{ $product->name }}
</div>
{!! view_render_event('bagisto.shop.checkout.name.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.price.before', ['item' => $item]) !!}
<div class="row">
<span class="title">
{{ __('shop::app.checkout.onepage.price') }}
@ -74,6 +81,11 @@
</span>
</div>
{!! view_render_event('bagisto.shop.checkout.price.after', ['item' => $item]) !!}
{!! view_render_event('bagisto.shop.checkout.quantity.before', ['item' => $item]) !!}
<div class="row">
<span class="title">
{{ __('shop::app.checkout.onepage.quantity') }}
@ -83,13 +95,19 @@
</span>
</div>
{!! view_render_event('bagisto.shop.checkout.quantity.after', ['item' => $item]) !!}
@if ($product->type == 'configurable')
{!! view_render_event('bagisto.shop.checkout.options.after', ['item' => $item]) !!}
<div class="summary" >
{{ Cart::getProductAttributeOptionDetails($item->child->product)['html'] }}
</div>
{!! view_render_event('bagisto.shop.checkout.options.after', ['item' => $item]) !!}
@endif
</div>

View File

@ -13,7 +13,7 @@
<script type="text/x-template" id="product-options-template">
<div class="attributes">
<input type="hidden" name="selected_configurable_option" :value="selectedProductId">
<input type="hidden" id="selected_configurable_option" name="selected_configurable_option" :value="selectedProductId">
<div v-for='(attribute, index) in childAttributes' class="attribute control-group" :class="[errors.has('super_attribute[' + attribute.id + ']') ? 'has-error' : '']">
<label class="required">@{{ attribute.label }}</label>
@ -101,25 +101,6 @@
this.selectedProductId = attribute.options[attribute.selectedIndex].allowedProducts[0];
}
//wishlist anchor href changer with options
// @auth('customer')
// var wishlistLink = $('#wishlist-changer').attr('data-href');
// if (this.selectedProductId != '') {
// var splitted = wishlistLink.split("/");
// var lastItem = splitted.pop();
// lastItem = this.selectedProductId;
// var joined = splitted.join('/');
// var newWishlistUrl = joined + '/' + lastItem;
// $('#wishlist-changer').attr('data-href', newWishlistUrl);
// }
// @endauth
//buy now anchor href changer with options
var buyNowLink = $('.btn.buynow').attr('data-href');
@ -156,7 +137,6 @@
selectedIndex = index;
}
})
return selectedIndex;
},
@ -266,10 +246,14 @@
priceLabelElement.style.display = 'none';
priceElement.innerHTML = this.config.variant_prices[this.simpleProduct].final_price.formated_price;
eventBus.$emit('configurable-variant-selected-event', this.simpleProduct)
} else {
priceLabelElement.style.display = 'inline-block';
priceElement.innerHTML = this.config.regular_price.formated_price;
eventBus.$emit('configurable-variant-selected-event', 0)
}
},

View File

@ -1,8 +1,8 @@
const { mix } = require("laravel-mix");
require("laravel-mix-merge-manifest");
// var publicPath = 'publishable/assets';
var publicPath = "../../../public/themes/default/assets";
var publicPath = 'publishable/assets';
// var publicPath = "../../../public/themes/default/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,9 @@
{
<<<<<<< HEAD
"/js/ui.js": "/js/ui.js",
"/css/ui.css": "/css/ui.css"
=======
"/js/ui.js": "/js/ui.js?id=711bb1082d5b116e929f",
"/css/ui.css": "/css/ui.css?id=384d20a09ced97996829"
>>>>>>> 97cb751c56e436baed6fe43c0e0fccfbf726334d
}

View File

@ -13,6 +13,7 @@ use Illuminate\Http\Request;
abstract class DataGrid
{
protected $index = null;
protected $sortOrder = 'asc';
protected $enableFilterMap = false;
protected $filterMap = [];
protected $columns = [];
@ -43,20 +44,7 @@ abstract class DataGrid
'and' => "&",
'bor' => "|",
'regex' => "regexp",
'notregex' => "not regexp",
// 14 => "^",
// 15 => "<<",
// 16 => ">>",
// 17 => "rlike",
// 20 => "~",
// 21 => "~*",
// 22 => "!~",
// 23 => "!~*",
// 24 => "similar to",
// 25 => "not similar to",
// 26 => "not ilike",
// 27 => "~~*",
// 28 => "!~~*"
'notregex' => "not regexp"
];
protected $bindings = [
@ -155,18 +143,18 @@ abstract class DataGrid
if ($this->paginate) {
if ($this->itemsPerPage > 0)
return $filteredOrSortedCollection->paginate($this->itemsPerPage)->appends(request()->except('page'));
return $filteredOrSortedCollection->orderBy($this->index, $this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
} else {
return $filteredOrSortedCollection->get();
return $filteredOrSortedCollection->orderBy($this->index, $this->sortOrder)->get();
}
}
if ($this->paginate) {
if ($this->itemsPerPage > 0) {
$this->collection = $this->queryBuilder->paginate($this->itemsPerPage)->appends(request()->except('page'));
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->paginate($this->itemsPerPage)->appends(request()->except('page'));
}
} else {
$this->collection = $this->queryBuilder->get();
$this->collection = $this->queryBuilder->orderBy($this->index, $this->sortOrder)->get();
}
return $this->collection;
@ -298,8 +286,6 @@ abstract class DataGrid
$this->prepareQueryBuilder();
// dd($this->paginate, $this->itemsPerPage);
return view('ui::datagrid.table')->with('results', ['records' => $this->getCollection(), 'columns' => $this->completeColumnDetails, 'actions' => $this->actions, 'massactions' => $this->massActions, 'index' => $this->index, 'enableMassActions' => $this->enableMassAction, 'enableActions' => $this->enableAction, 'paginated' => $this->paginate, 'norecords' => trans('ui::app.datagrid.no-records')]);
}
}

View File

@ -276,6 +276,13 @@ h2 {
&.empty {
text-align: center;
}
tr {
td {
// border: 1px solid red;
}
}
}
tbody tr:last-child td {

View File

@ -39,7 +39,7 @@
@endforeach
@if ($enableActions)
<td style="width: 50px;">
<td>
<div class="actions">
@foreach ($actions as $action)
<a href="{{ route($action['route'], $record->{$index}) }}">

View File

@ -148,14 +148,14 @@
</span>
</div>
<table>
<table class="table">
<thead v-if="massActionsToggle">
@if (isset($results['massactions']))
<tr class="mass-action" style="height: 63px;" v-if="massActionsToggle">
<th colspan="10" style="width: 100%;">
<tr class="mass-action" v-if="massActionsToggle" style="height: 65px;">
<th colspan="100%">
<div class="mass-action-wrapper" style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start;">
<span class="massaction-remove" v-on:click="removeMassActions" style="margin-right: 10px;">
<span class="massaction-remove" v-on:click="removeMassActions" style="margin-right: 10px; margin-top: 3px;">
<span class="icon checkbox-dash-icon"></span>
</span>
@ -185,7 +185,7 @@
</thead>
<thead v-if="massActionsToggle == false">
<tr>
<tr style="height: 65px;">
@if (count($results['records']) && $results['enableMassActions'])
<th class="grid_head" id="mastercheckbox" style="width: 50px;">
<span class="checkbox">

View File

@ -1,8 +1,8 @@
const { mix } = require("laravel-mix");
require("laravel-mix-merge-manifest");
// var publicPath = 'publishable/assets';
var publicPath = "../../../public/vendor/webkul/ui/assets";
var publicPath = 'publishable/assets';
// var publicPath = "../../../public/vendor/webkul/ui/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();

View File

@ -2,7 +2,7 @@
$install = require __DIR__.'/installer/install.php';
if (!is_null($install)) {
if (0 && !is_null($install)) {
header("Location: $install");