parent
81da5bd1d1
commit
e526af061e
|
|
@ -150,22 +150,22 @@ class AttributeDataGrid
|
|||
'type' => 'string',
|
||||
'label' => 'Type',
|
||||
], [
|
||||
'name' => 'is_required',
|
||||
'column' => 'is_required',
|
||||
'alias' => 'attributeIsRequired',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Required',
|
||||
], [
|
||||
'name' => 'is_unique',
|
||||
'column' => 'is_unique',
|
||||
'alias' => 'attributeIsUnique',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Unique',
|
||||
], [
|
||||
'name' => 'value_per_locale',
|
||||
'column' => 'value_per_locale',
|
||||
'alias' => 'attributeValuePerLocale',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Locale based',
|
||||
], [
|
||||
'name' => 'value_per_channel',
|
||||
'column' => 'value_per_channel',
|
||||
'alias' => 'attributeValuePerChannel',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Channel based',
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class ProductDataGrid
|
|||
'type' => 'string',
|
||||
'label' => 'Product Quantity',
|
||||
'sortable' => true,
|
||||
],
|
||||
]
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
|
|
@ -149,7 +149,7 @@ class ProductDataGrid
|
|||
'type' => 'string',
|
||||
'label' => 'Product Type',
|
||||
], [
|
||||
'name' => 'prods.status',
|
||||
'column' => 'prods.status',
|
||||
'alias' => 'ProductStatus',
|
||||
'type' => 'boolean',
|
||||
'label' => 'Status'
|
||||
|
|
|
|||
|
|
@ -73,24 +73,29 @@ class Product {
|
|||
|
||||
$variants = [];
|
||||
|
||||
$this->productGrid->create($gridObject);
|
||||
$found = $this->productGrid->findOneByField('product_id', $product->id);
|
||||
|
||||
if($product->type == 'configurable') {
|
||||
$variants = $product->variants()->get();
|
||||
//extra measure to stop duplicate entries
|
||||
if($found == null) {
|
||||
$this->productGrid->create($gridObject);
|
||||
|
||||
foreach($variants as $variant) {
|
||||
$variantObj = [
|
||||
'product_id' => $variant->id,
|
||||
'sku' => $variant->sku,
|
||||
'type' => $variant->type,
|
||||
'attribute_family_name' => $variant->toArray()['attribute_family']['name'],
|
||||
'name' => $variant->name,
|
||||
'quantity' => 0,
|
||||
'status' => $variant->status,
|
||||
'price' => $variant->price,
|
||||
];
|
||||
if($product->type == 'configurable') {
|
||||
$variants = $product->variants()->get();
|
||||
|
||||
$this->productGrid->create($variantObj);
|
||||
foreach($variants as $variant) {
|
||||
$variantObj = [
|
||||
'product_id' => $variant->id,
|
||||
'sku' => $variant->sku,
|
||||
'type' => $variant->type,
|
||||
'attribute_family_name' => $variant->toArray()['attribute_family']['name'],
|
||||
'name' => $variant->name,
|
||||
'quantity' => 0,
|
||||
'status' => $variant->status,
|
||||
'price' => $variant->price,
|
||||
];
|
||||
|
||||
$this->productGrid->create($variantObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ class ProductController extends Controller
|
|||
'sku' => ['required', 'unique:products,sku', new \Webkul\Core\Contracts\Validations\Slug]
|
||||
]);
|
||||
|
||||
|
||||
//before store of the product
|
||||
Event::fire('catalog.product.create.before');
|
||||
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@ class DataGrid
|
|||
throw new \Exception('Multiple Sort keys Found, Please Resolve the URL Manually.');
|
||||
}
|
||||
} elseif ($key=="search") {
|
||||
|
||||
// dd($this->searchable, $parsed);
|
||||
$count_keys = count(array_keys($value));
|
||||
if($count_keys==1)
|
||||
$this->query->where(function ($query) use ($parsed) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue