conflict resolve
This commit is contained in:
commit
007f945b05
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jitendra-webkul/bagisto",
|
||||
"description": "The Laravel Framework.",
|
||||
"name": "bagisto/bagisto",
|
||||
"description": "Bagisto Ecommerce",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
'timezone' => 'Asia/Kolkata',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class AttributeDataGrid
|
|||
'name' => 'Attributes',
|
||||
'table' => 'attributes',
|
||||
'select' => 'id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => true,
|
||||
|
||||
'massoperations' => [
|
||||
|
|
|
|||
|
|
@ -62,12 +62,6 @@ class CategoryDataGrid
|
|||
'primaryKey' => 'cat.id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'ct.category_id',
|
||||
], [
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'category_translations as cta',
|
||||
'primaryKey' => 'cat.parent_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'cta.category_id',
|
||||
],
|
||||
],
|
||||
|
||||
|
|
@ -92,13 +86,15 @@ class CategoryDataGrid
|
|||
'type' => 'string',
|
||||
'label' => 'Category Position',
|
||||
'sortable' => false,
|
||||
], [
|
||||
'name' => 'cta.name',
|
||||
'alias' => 'parent_name',
|
||||
'type' => 'string',
|
||||
'label' => 'Parent Name',
|
||||
'sortable' => true,
|
||||
], [
|
||||
],
|
||||
// [
|
||||
// 'name' => 'cta.name',
|
||||
// 'alias' => 'parent_name',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Parent Name',
|
||||
// 'sortable' => true,
|
||||
// ],
|
||||
[
|
||||
'name' => 'cat.status',
|
||||
'alias' => 'cat_status',
|
||||
'type' => 'string',
|
||||
|
|
@ -110,15 +106,16 @@ class CategoryDataGrid
|
|||
else
|
||||
return "True";
|
||||
},
|
||||
], [
|
||||
'name' => 'cta.locale',
|
||||
],
|
||||
[
|
||||
'name' => 'ct.locale',
|
||||
'alias' => 'cat_locale',
|
||||
'type' => 'string',
|
||||
'label' => 'Locale',
|
||||
'sortable' => true,
|
||||
'filter' => [
|
||||
'function' => 'where',
|
||||
'condition' => ['cta.locale', app()->getLocale()]
|
||||
'function' => 'orWhere',
|
||||
'condition' => ['ct.locale', app()->getLocale()]
|
||||
],
|
||||
]
|
||||
],
|
||||
|
|
@ -134,12 +131,14 @@ class CategoryDataGrid
|
|||
'alias' => 'catName',
|
||||
'type' => 'string',
|
||||
'label' => 'Category Name',
|
||||
], [
|
||||
'column' => 'cta.name',
|
||||
'alias' => 'parentName',
|
||||
'type' => 'string',
|
||||
'label' => 'Parent Name',
|
||||
], [
|
||||
],
|
||||
// [
|
||||
// 'column' => 'cta.name',
|
||||
// 'alias' => 'parentName',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Parent Name',
|
||||
// ],
|
||||
[
|
||||
'column' => 'cat.status',
|
||||
'alias' => 'catStatus',
|
||||
'type' => 'string',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ChannelDataGrid
|
|||
'name' => 'Channels',
|
||||
'table' => 'channels',
|
||||
'select' => 'id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CurrencyDataGrid
|
|||
'name' => 'Currencies',
|
||||
'table' => 'currencies',
|
||||
'select' => 'id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ExchangeRatesDataGrid
|
|||
'name' => 'Exchange Rates',
|
||||
'table' => 'currency_exchange_rates as cer',
|
||||
'select' => 'cer.id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class InventorySourcesDataGrid
|
|||
'name' => 'Inventory Sources',
|
||||
'table' => 'inventory_sources',
|
||||
'select' => 'id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class LocalesDataGrid
|
|||
'name' => 'Locales',
|
||||
'table' => 'locales',
|
||||
'select' => 'id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class OrderDataGrid
|
|||
'name' => 'orders',
|
||||
'table' => 'orders as or',
|
||||
'select' => 'or.id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => false,
|
||||
//True in case of joins else aliasing key required on all cases
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class ProductDataGrid
|
|||
'name' => 'Products',
|
||||
'table' => 'products_grid as prods',
|
||||
'select' => 'prods.product_id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class RolesDataGrid
|
|||
'name' => 'Roles',
|
||||
'table' => 'roles',
|
||||
'select' => 'id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => false, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class SliderDataGrid
|
|||
'name' => 'Sliders',
|
||||
'table' => 'sliders as s',
|
||||
'select' => 's.id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class UserDataGrid
|
|||
'name' => 'Admins',
|
||||
'table' => 'admins as u',
|
||||
'select' => 'u.id',
|
||||
'perpage' => 5,
|
||||
'perpage' => 10,
|
||||
'aliased' => true, //use this with false as default and true in case of joins
|
||||
|
||||
'massoperations' =>[
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ class DashboardController extends Controller
|
|||
'stock_threshold' => $this->getStockThreshold(),
|
||||
];
|
||||
|
||||
|
||||
foreach (core()->getTimeInterval($this->startDate, $this->endDate) as $interval) {
|
||||
$statistics['sale_graph']['label'][] = $interval['start']->format('d M');
|
||||
|
||||
|
|
|
|||
|
|
@ -43,26 +43,127 @@ class Product {
|
|||
$this->price = $price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data from the product created
|
||||
*
|
||||
* @return array $data
|
||||
*/
|
||||
public function prepareData($product) {
|
||||
$gridObject = [];
|
||||
$gridObject = [
|
||||
'product_id' => $product->id,
|
||||
'sku' => $product->sku,
|
||||
'type' => $product->type,
|
||||
'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);
|
||||
|
||||
$variants = $product->variants;
|
||||
|
||||
if(count($variants)) {
|
||||
foreach($variants as $variant) {
|
||||
$variantObject = [
|
||||
'product_id' => $variant->id,
|
||||
'sku' => $variant->sku,
|
||||
'type' => $variant->type,
|
||||
'attribute_family_name' => $variant->toArray()['attribute_family']['name'],
|
||||
'name' => $variant->name,
|
||||
'status' => $variant->status,
|
||||
];
|
||||
|
||||
$qty = 1;
|
||||
|
||||
foreach($variant->toArray()['inventories'] as $inventorySource) {
|
||||
$qty = $qty + $inventorySource['qty'];
|
||||
}
|
||||
|
||||
$variantObject['price'] = $product->price;
|
||||
$variantObject['quantity'] = $qty;
|
||||
|
||||
array_push($variantObjects, $variantObject);
|
||||
|
||||
$qty = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$qty = 0;
|
||||
|
||||
foreach($product->toArray()['inventories'] as $inventorySource) {
|
||||
$qty = $qty + $inventorySource['qty'];
|
||||
}
|
||||
|
||||
$gridObject['price'] = $product->price;
|
||||
$gridObject['quantity'] = $qty;
|
||||
|
||||
$qty = 0;
|
||||
}
|
||||
}
|
||||
// dd($gridObject, $variantObjects);
|
||||
return [
|
||||
'parent' => $gridObject,
|
||||
'variants' => $variantObjects
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new entry in the product grid whenever a new product is created.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function afterProductCreated($product) {
|
||||
$gridObject = [];
|
||||
$data = $this->prepareData($product);
|
||||
|
||||
$gridObject = [
|
||||
'product_id' => $product->id,
|
||||
'sku' => $product->sku,
|
||||
'type' => $product->type,
|
||||
'attribute_family_name' => $product->toArray()['attribute_family']['name'],
|
||||
];
|
||||
$result = $this->saveProduct($product, $data);
|
||||
|
||||
if($this->productGrid->create($gridObject)) {
|
||||
return true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the product to the product as the product data grid instance
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function saveProduct($product, $data) {
|
||||
|
||||
$productGridObject = $this->productGrid->findOneByField('product_id', $product->id);
|
||||
// dd($product, $data, $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 {
|
||||
$this->productGrid->create($variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
$this->productGrid->create($data['parent']);
|
||||
|
||||
//no need for tese lines
|
||||
if(count($data['variants'])) {
|
||||
foreach($data['variants'] as $variant) {
|
||||
$this->productGrid->create($variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class NewInvoiceNotification extends Mailable
|
|||
$order = $this->invoice->order;
|
||||
|
||||
return $this->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('admin::app.mail.invoice.subject', ['order_id' => $order->id]))
|
||||
->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->id]))
|
||||
->view('shop::emails.sales.new-invoice');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class NewOrderNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->to($this->order->customer_email, $this->order->customer_full_name)
|
||||
->subject(trans('admin::app.mail.order.subject'))
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-order');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class NewShipmentNotification extends Mailable
|
|||
$order = $this->shipment->order;
|
||||
|
||||
return $this->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('admin::app.mail.shipment.subject', ['order_id' => $order->id]))
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->id]))
|
||||
->view('shop::emails.sales.new-shipment');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,13 @@
|
|||
@if ($item->qty_to_invoice > 0)
|
||||
<tr>
|
||||
<td>{{ $item->type == 'configurable' ? $item->child->sku : $item->sku }}</td>
|
||||
<td>{{ $item->name }}</td>
|
||||
<td>
|
||||
{{ $item->name }}
|
||||
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<p>{{ $html }}</p>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $item->qty_ordered }}</td>
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has('invoice[items][{{ $item->id }}]') ? 'has-error' : '']">
|
||||
|
|
|
|||
|
|
@ -218,7 +218,13 @@
|
|||
@foreach ($invoice->items as $item)
|
||||
<tr>
|
||||
<td>{{ $item->child ? $item->child->sku : $item->sku }}</td>
|
||||
<td>{{ $item->name }}</td>
|
||||
<td>
|
||||
{{ $item->name }}
|
||||
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<p>{{ $html }}</p>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ core()->formatBasePrice($item->base_price) }}</td>
|
||||
<td>{{ $item->qty }}</td>
|
||||
<td>{{ core()->formatBasePrice($item->base_total) }}</td>
|
||||
|
|
|
|||
|
|
@ -232,7 +232,13 @@
|
|||
<td>
|
||||
{{ $item->type == 'configurable' ? $item->child->sku : $item->sku }}
|
||||
</td>
|
||||
<td>{{ $item->name }}</td>
|
||||
<td>
|
||||
{{ $item->name }}
|
||||
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<p>{{ $html }}</p>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ core()->formatBasePrice($item->base_price) }}</td>
|
||||
<td>{{ $item->qty_ordered }}</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -235,7 +235,13 @@
|
|||
@if ($item->qty_to_ship > 0)
|
||||
<tr>
|
||||
<td>{{ $item->type == 'configurable' ? $item->child->sku : $item->sku }}</td>
|
||||
<td>{{ $item->name }}</td>
|
||||
<td>
|
||||
{{ $item->name }}
|
||||
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<p>{{ $html }}</p>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $item->qty_ordered }}</td>
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has('shipment[items][{{ $item->id }}]') ? 'has-error' : '']">
|
||||
|
|
|
|||
|
|
@ -233,7 +233,13 @@
|
|||
@foreach ($shipment->items as $item)
|
||||
<tr>
|
||||
<td>{{ $item->sku }}</td>
|
||||
<td>{{ $item->name }}</td>
|
||||
<td>
|
||||
{{ $item->name }}
|
||||
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<p>{{ $html }}</p>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $item->qty }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -3,153 +3,16 @@
|
|||
namespace Webkul\Attribute\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
|
||||
use DB;
|
||||
|
||||
class AttributeFamilyTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $rawData = [
|
||||
[
|
||||
"code" => "default",
|
||||
"name" => "Default",
|
||||
"is_user_defined" => 0,
|
||||
'attribute_groups' => [
|
||||
[
|
||||
"name" => "General",
|
||||
"is_user_defined" => 0,
|
||||
"position" => 1,
|
||||
"custom_attributes" => [
|
||||
[
|
||||
'code' => 'sku',
|
||||
'position' => 1
|
||||
], [
|
||||
'code' => 'name',
|
||||
'position' => 2
|
||||
], [
|
||||
'code' => 'url_key',
|
||||
'position' => 3
|
||||
], [
|
||||
'code' => 'tax_category_id',
|
||||
'position' => 4
|
||||
], [
|
||||
'code' => 'new',
|
||||
'position' => 5
|
||||
], [
|
||||
'code' => 'featured',
|
||||
'position' => 6
|
||||
], [
|
||||
'code' => 'visible_individually',
|
||||
'position' => 7
|
||||
], [
|
||||
'code' => 'status',
|
||||
'position' => 8
|
||||
], [
|
||||
'code' => 'color',
|
||||
'position' => 9
|
||||
], [
|
||||
'code' => 'size',
|
||||
'position' => 10
|
||||
]
|
||||
]
|
||||
], [
|
||||
"name" => "Description",
|
||||
"is_user_defined" => 0,
|
||||
"position" => 2,
|
||||
"custom_attributes" => [
|
||||
[
|
||||
'code' => 'short_description',
|
||||
'position' => 1
|
||||
], [
|
||||
'code' => 'description',
|
||||
'position' => 2
|
||||
]
|
||||
]
|
||||
], [
|
||||
"name" => "Meta Description",
|
||||
"is_user_defined" => 0,
|
||||
"position" => 3,
|
||||
"custom_attributes" => [
|
||||
[
|
||||
'code' => 'meta_title',
|
||||
'position' => 1
|
||||
], [
|
||||
'code' => 'meta_keywords',
|
||||
'position' => 2
|
||||
], [
|
||||
'code' => 'meta_description',
|
||||
'position' => 3
|
||||
]
|
||||
]
|
||||
], [
|
||||
"name" => "Price",
|
||||
"is_user_defined" => 0,
|
||||
"position" => 4,
|
||||
"custom_attributes" => [
|
||||
[
|
||||
'code' => 'price',
|
||||
'position' => 1
|
||||
], [
|
||||
'code' => 'cost',
|
||||
'position' => 2
|
||||
], [
|
||||
'code' => 'special_price',
|
||||
'position' => 3
|
||||
], [
|
||||
'code' => 'special_price_from',
|
||||
'position' => 4
|
||||
], [
|
||||
'code' => 'special_price_to',
|
||||
'position' => 5
|
||||
]
|
||||
]
|
||||
], [
|
||||
"name" => "Shipping",
|
||||
"is_user_defined" => 0,
|
||||
"position" => 5,
|
||||
"custom_attributes" => [
|
||||
[
|
||||
'code' => 'width',
|
||||
'position' => 1
|
||||
], [
|
||||
'code' => 'height',
|
||||
'position' => 2
|
||||
], [
|
||||
'code' => 'depth',
|
||||
'position' => 3
|
||||
], [
|
||||
'code' => 'weight',
|
||||
'position' => 4
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* AttributeFamilyRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributeFamily;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(AttributeFamilyRepository $attributeFamily)
|
||||
{
|
||||
$this->attributeFamily = $attributeFamily;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
foreach($this->rawData as $row) {
|
||||
$this->attributeFamily->create($row);
|
||||
}
|
||||
DB::table('attribute_families')->delete();
|
||||
|
||||
DB::table('attribute_families')->insert([
|
||||
['id' => '1','code' => 'default','name' => 'Default','status' => '0','is_user_defined' => '1']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Attribute\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use DB;
|
||||
|
||||
class AttributeGroupTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('attribute_groups')->delete();
|
||||
|
||||
DB::table('attribute_groups')->insert([
|
||||
['id' => '1','name' => 'General','position' => '1','is_user_defined' => '0','attribute_family_id' => '1'],
|
||||
['id' => '2','name' => 'Description','position' => '2','is_user_defined' => '0','attribute_family_id' => '1'],
|
||||
['id' => '3','name' => 'Meta Description','position' => '3','is_user_defined' => '0','attribute_family_id' => '1'],
|
||||
['id' => '4','name' => 'Price','position' => '4','is_user_defined' => '0','attribute_family_id' => '1'],
|
||||
['id' => '5','name' => 'Shipping','position' => '5','is_user_defined' => '0','attribute_family_id' => '1']
|
||||
]);
|
||||
|
||||
DB::table('attribute_group_mappings')->insert([
|
||||
['attribute_id' => '1','attribute_group_id' => '1','position' => '1'],
|
||||
['attribute_id' => '2','attribute_group_id' => '1','position' => '2'],
|
||||
['attribute_id' => '3','attribute_group_id' => '1','position' => '3'],
|
||||
['attribute_id' => '4','attribute_group_id' => '1','position' => '4'],
|
||||
['attribute_id' => '5','attribute_group_id' => '1','position' => '5'],
|
||||
['attribute_id' => '6','attribute_group_id' => '1','position' => '6'],
|
||||
['attribute_id' => '7','attribute_group_id' => '1','position' => '7'],
|
||||
['attribute_id' => '8','attribute_group_id' => '1','position' => '8'],
|
||||
['attribute_id' => '9','attribute_group_id' => '2','position' => '1'],
|
||||
['attribute_id' => '10','attribute_group_id' => '2','position' => '2'],
|
||||
['attribute_id' => '11','attribute_group_id' => '4','position' => '1'],
|
||||
['attribute_id' => '12','attribute_group_id' => '4','position' => '2'],
|
||||
['attribute_id' => '13','attribute_group_id' => '4','position' => '3'],
|
||||
['attribute_id' => '14','attribute_group_id' => '4','position' => '4'],
|
||||
['attribute_id' => '15','attribute_group_id' => '4','position' => '5'],
|
||||
['attribute_id' => '16','attribute_group_id' => '3','position' => '1'],
|
||||
['attribute_id' => '17','attribute_group_id' => '3','position' => '2'],
|
||||
['attribute_id' => '18','attribute_group_id' => '3','position' => '3'],
|
||||
['attribute_id' => '19','attribute_group_id' => '5','position' => '1'],
|
||||
['attribute_id' => '20','attribute_group_id' => '5','position' => '2'],
|
||||
['attribute_id' => '21','attribute_group_id' => '5','position' => '3'],
|
||||
['attribute_id' => '22','attribute_group_id' => '5','position' => '4'],
|
||||
['attribute_id' => '23','attribute_group_id' => '1','position' => '9'],
|
||||
['attribute_id' => '24','attribute_group_id' => '1','position' => '10']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Attribute\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use DB;
|
||||
|
||||
class AttributeOptionTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
public function run()
|
||||
{
|
||||
DB::table('attribute_options')->delete();
|
||||
|
||||
DB::table('attribute_options')->insert([
|
||||
['id' => '1','admin_name' => 'Red','sort_order' => '1','attribute_id' => '23'],
|
||||
['id' => '2','admin_name' => 'Green','sort_order' => '2','attribute_id' => '23'],
|
||||
['id' => '3','admin_name' => 'Yellow','sort_order' => '3','attribute_id' => '23'],
|
||||
['id' => '4','admin_name' => 'Black','sort_order' => '4','attribute_id' => '23'],
|
||||
['id' => '5','admin_name' => 'White','sort_order' => '5','attribute_id' => '23'],
|
||||
['id' => '6','admin_name' => 'S','sort_order' => '1','attribute_id' => '24'],
|
||||
['id' => '7','admin_name' => 'M','sort_order' => '2','attribute_id' => '24'],
|
||||
['id' => '8','admin_name' => 'L','sort_order' => '3','attribute_id' => '24'],
|
||||
['id' => '9','admin_name' => 'XL','sort_order' => '4','attribute_id' => '24']
|
||||
]);
|
||||
|
||||
DB::table('attribute_option_translations')->insert([
|
||||
['id' => '1','locale' => 'en','label' => 'Red','attribute_option_id' => '1'],
|
||||
['id' => '2','locale' => 'en','label' => 'Green','attribute_option_id' => '2'],
|
||||
['id' => '3','locale' => 'en','label' => 'Yellow','attribute_option_id' => '3'],
|
||||
['id' => '4','locale' => 'en','label' => 'Black','attribute_option_id' => '4'],
|
||||
['id' => '5','locale' => 'en','label' => 'White','attribute_option_id' => '5'],
|
||||
['id' => '6','locale' => 'en','label' => 'S','attribute_option_id' => '6'],
|
||||
['id' => '7','locale' => 'en','label' => 'M','attribute_option_id' => '7'],
|
||||
['id' => '8','locale' => 'en','label' => 'L','attribute_option_id' => '8'],
|
||||
['id' => '9','locale' => 'en','label' => 'XL','attribute_option_id' => '9']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,444 +3,71 @@
|
|||
namespace Webkul\Attribute\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AttributeTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $rawData = [
|
||||
[
|
||||
'code' => 'sku',
|
||||
'admin_name' => 'SKU',
|
||||
'en' => [
|
||||
'name' => 'SKU'
|
||||
],
|
||||
'type' => 'text',
|
||||
'position' => 1,
|
||||
'is_unique' => 1,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'name',
|
||||
'admin_name' => 'Name',
|
||||
'en' => [
|
||||
'name' => 'Name'
|
||||
],
|
||||
'type' => 'text',
|
||||
'position' => 2,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 1,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'url_key',
|
||||
'admin_name' => 'URL Key',
|
||||
'en' => [
|
||||
'name' => 'URL Key'
|
||||
],
|
||||
'type' => 'text',
|
||||
'position' => 3,
|
||||
'is_unique' => 1,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'tax_category_id',
|
||||
'admin_name' => 'Tax Category',
|
||||
'en' => [
|
||||
'name' => 'Tax Category'
|
||||
],
|
||||
'type' => 'select',
|
||||
'position' => 4,
|
||||
'is_unique' => 0,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'new',
|
||||
'admin_name' => 'New',
|
||||
'en' => [
|
||||
'name' => 'New'
|
||||
],
|
||||
'type' => 'boolean',
|
||||
'position' => 5,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'featured',
|
||||
'admin_name' => 'Featured',
|
||||
'en' => [
|
||||
'name' => 'Featured'
|
||||
],
|
||||
'type' => 'boolean',
|
||||
'position' => 6,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'visible_individually',
|
||||
'admin_name' => 'Visible Individually',
|
||||
'en' => [
|
||||
'name' => 'Visible Individually'
|
||||
],
|
||||
'type' => 'boolean',
|
||||
'position' => 7,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'status',
|
||||
'admin_name' => 'Status',
|
||||
'en' => [
|
||||
'name' => 'Status'
|
||||
],
|
||||
'type' => 'boolean',
|
||||
'position' => 8,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'short_description',
|
||||
'admin_name' => 'Short Description',
|
||||
'en' => [
|
||||
'name' => 'Short Description'
|
||||
],
|
||||
'type' => 'textarea',
|
||||
'position' => 9,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 1,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'description',
|
||||
'admin_name' => 'Description',
|
||||
'en' => [
|
||||
'name' => 'Description'
|
||||
],
|
||||
'type' => 'textarea',
|
||||
'position' => 10,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 1,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'price',
|
||||
'admin_name' => 'Price',
|
||||
'en' => [
|
||||
'name' => 'Price'
|
||||
],
|
||||
'type' => 'price',
|
||||
'position' => 11,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 1,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'cost',
|
||||
'admin_name' => 'Cost',
|
||||
'en' => [
|
||||
'name' => 'Cost'
|
||||
],
|
||||
'type' => 'price',
|
||||
'position' => 12,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 1
|
||||
], [
|
||||
'code' => 'special_price',
|
||||
'admin_name' => 'Special Price',
|
||||
'en' => [
|
||||
'name' => 'Special Price'
|
||||
],
|
||||
'type' => 'price',
|
||||
'position' => 13,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'special_price_from',
|
||||
'admin_name' => 'Special Price From',
|
||||
'en' => [
|
||||
'name' => 'Special Price From'
|
||||
],
|
||||
'type' => 'date',
|
||||
'position' => 14,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'special_price_to',
|
||||
'admin_name' => 'Special Price To',
|
||||
'en' => [
|
||||
'name' => 'Special Price To'
|
||||
],
|
||||
'type' => 'date',
|
||||
'position' => 15,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'meta_title',
|
||||
'admin_name' => 'Meta Title',
|
||||
'en' => [
|
||||
'name' => 'Meta Description'
|
||||
],
|
||||
'type' => 'textarea',
|
||||
'position' => 16,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 1,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'meta_keywords',
|
||||
'admin_name' => 'Meta Keywords',
|
||||
'en' => [
|
||||
'name' => 'Meta Keywords'
|
||||
],
|
||||
'type' => 'textarea',
|
||||
'position' => 17,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 1,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'meta_description',
|
||||
'admin_name' => 'Meta Description',
|
||||
'en' => [
|
||||
'name' => 'Meta Description'
|
||||
],
|
||||
'type' => 'textarea',
|
||||
'position' => 18,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 1,
|
||||
'value_per_channel' => 1,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 1
|
||||
], [
|
||||
'code' => 'width',
|
||||
'admin_name' => 'Width',
|
||||
'en' => [
|
||||
'name' => 'Width'
|
||||
],
|
||||
'type' => 'text',
|
||||
'validation' => 'numeric',
|
||||
'position' => 19,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 1
|
||||
], [
|
||||
'code' => 'height',
|
||||
'admin_name' => 'Height',
|
||||
'en' => [
|
||||
'name' => 'Height'
|
||||
],
|
||||
'type' => 'text',
|
||||
'validation' => 'numeric',
|
||||
'position' => 20,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 1
|
||||
], [
|
||||
'code' => 'depth',
|
||||
'admin_name' => 'Depth',
|
||||
'en' => [
|
||||
'name' => 'Depth'
|
||||
],
|
||||
'type' => 'text',
|
||||
'validation' => 'numeric',
|
||||
'position' => 21,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 1
|
||||
], [
|
||||
'code' => 'weight',
|
||||
'admin_name' => 'Weight',
|
||||
'en' => [
|
||||
'name' => 'Weight'
|
||||
],
|
||||
'type' => 'text',
|
||||
'validation' => 'numeric',
|
||||
'position' => 22,
|
||||
'is_required' => 1,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 0,
|
||||
'is_configurable' => 0,
|
||||
'is_user_defined' => 0
|
||||
], [
|
||||
'code' => 'color',
|
||||
'admin_name' => 'Color',
|
||||
'en' => [
|
||||
'name' => 'Color'
|
||||
],
|
||||
'type' => 'select',
|
||||
'position' => 23,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 1,
|
||||
'is_configurable' => 1,
|
||||
'is_user_defined' => 1,
|
||||
'options' => [
|
||||
[
|
||||
'admin_name' => 'Red',
|
||||
'en' => [
|
||||
'label' => 'Red'
|
||||
],
|
||||
'sort_order' => 1
|
||||
], [
|
||||
'admin_name' => 'Green',
|
||||
'en' => [
|
||||
'label' => 'Green'
|
||||
],
|
||||
'sort_order' => 2
|
||||
], [
|
||||
'admin_name' => 'Yellow',
|
||||
'en' => [
|
||||
'label' => 'Yellow'
|
||||
],
|
||||
'sort_order' => 3
|
||||
], [
|
||||
'admin_name' => 'Black',
|
||||
'en' => [
|
||||
'label' => 'Black'
|
||||
],
|
||||
'sort_order' => 4
|
||||
], [
|
||||
'admin_name' => 'White',
|
||||
'en' => [
|
||||
'label' => 'White'
|
||||
],
|
||||
'sort_order' => 5
|
||||
]
|
||||
]
|
||||
], [
|
||||
'code' => 'size',
|
||||
'admin_name' => 'Size',
|
||||
'en' => [
|
||||
'name' => 'Size'
|
||||
],
|
||||
'type' => 'select',
|
||||
'position' => 24,
|
||||
'is_required' => 0,
|
||||
'value_per_locale' => 0,
|
||||
'value_per_channel' => 0,
|
||||
'is_filterable' => 1,
|
||||
'is_configurable' => 1,
|
||||
'is_user_defined' => 1,
|
||||
'options' => [
|
||||
[
|
||||
'admin_name' => 'S',
|
||||
'en' => [
|
||||
'label' => 'S'
|
||||
],
|
||||
'sort_order' => 1
|
||||
], [
|
||||
'admin_name' => 'M',
|
||||
'en' => [
|
||||
'label' => 'M'
|
||||
],
|
||||
'sort_order' => 2
|
||||
], [
|
||||
'admin_name' => 'L',
|
||||
'en' => [
|
||||
'label' => 'L'
|
||||
],
|
||||
'sort_order' => 3
|
||||
], [
|
||||
'admin_name' => 'XL',
|
||||
'en' => [
|
||||
'label' => 'XL'
|
||||
],
|
||||
'sort_order' => 4
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* AttributeRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attribute;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(AttributeRepository $attribute)
|
||||
{
|
||||
$this->attribute = $attribute;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
\Illuminate\Database\Eloquent\Model::reguard();
|
||||
DB::table('attributes')->delete();
|
||||
|
||||
foreach($this->rawData as $row) {
|
||||
$this->attribute->create($row);
|
||||
}
|
||||
$now = Carbon::now();
|
||||
|
||||
DB::table('attributes')->insert([
|
||||
['id' => '1','code' => 'sku','admin_name' => 'SKU','type' => 'text','validation' => NULL,'position' => '1','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '2','code' => 'name','admin_name' => 'Name','type' => 'text','validation' => NULL,'position' => '2','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '3','code' => 'url_key','admin_name' => 'URL Key','type' => 'text','validation' => NULL,'position' => '3','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '4','code' => 'tax_category_id','admin_name' => 'Tax Category','type' => 'select','validation' => NULL,'position' => '4','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '5','code' => 'new','admin_name' => 'New','type' => 'boolean','validation' => NULL,'position' => '5','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '6','code' => 'featured','admin_name' => 'Featured','type' => 'boolean','validation' => NULL,'position' => '6','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '7','code' => 'visible_individually','admin_name' => 'Visible Individually','type' => 'boolean','validation' => NULL,'position' => '7','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '8','code' => 'status','admin_name' => 'Status','type' => 'boolean','validation' => NULL,'position' => '8','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '9','code' => 'short_description','admin_name' => 'Short Description','type' => 'textarea','validation' => NULL,'position' => '9','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '10','code' => 'description','admin_name' => 'Description','type' => 'textarea','validation' => NULL,'position' => '10','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '11','code' => 'price','admin_name' => 'Price','type' => 'price','validation' => NULL,'position' => '11','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '12','code' => 'cost','admin_name' => 'Cost','type' => 'price','validation' => NULL,'position' => '12','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '13','code' => 'special_price','admin_name' => 'Special Price','type' => 'price','validation' => NULL,'position' => '13','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '14','code' => 'special_price_from','admin_name' => 'Special Price From','type' => 'date','validation' => NULL,'position' => '14','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '15','code' => 'special_price_to','admin_name' => 'Special Price To','type' => 'date','validation' => NULL,'position' => '15','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '16','code' => 'meta_title','admin_name' => 'Meta Title','type' => 'textarea','validation' => NULL,'position' => '16','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '17','code' => 'meta_keywords','admin_name' => 'Meta Keywords','type' => 'textarea','validation' => NULL,'position' => '17','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '18','code' => 'meta_description','admin_name' => 'Meta Description','type' => 'textarea','validation' => NULL,'position' => '18','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '19','code' => 'width','admin_name' => 'Width','type' => 'text','validation' => NULL,'position' => '19','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '20','code' => 'height','admin_name' => 'Height','type' => 'text','validation' => NULL,'position' => '20','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '21','code' => 'depth','admin_name' => 'Depth','type' => 'text','validation' => NULL,'position' => '21','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '22','code' => 'weight','admin_name' => 'Weight','type' => 'text','validation' => NULL,'position' => '22','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '23','code' => 'color','admin_name' => 'Color','type' => 'select','validation' => NULL,'position' => '23','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now],
|
||||
['id' => '24','code' => 'size','admin_name' => 'Size','type' => 'select','validation' => NULL,'position' => '24','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now]
|
||||
]);
|
||||
|
||||
|
||||
DB::table('attribute_translations')->insert([
|
||||
['id' => '1','locale' => 'en','name' => 'SKU','attribute_id' => '1'],
|
||||
['id' => '2','locale' => 'en','name' => 'Name','attribute_id' => '2'],
|
||||
['id' => '3','locale' => 'en','name' => 'URL Key','attribute_id' => '3'],
|
||||
['id' => '4','locale' => 'en','name' => 'Tax Category','attribute_id' => '4'],
|
||||
['id' => '5','locale' => 'en','name' => 'New','attribute_id' => '5'],
|
||||
['id' => '6','locale' => 'en','name' => 'Featured','attribute_id' => '6'],
|
||||
['id' => '7','locale' => 'en','name' => 'Visible Individually','attribute_id' => '7'],
|
||||
['id' => '8','locale' => 'en','name' => 'Status','attribute_id' => '8'],
|
||||
['id' => '9','locale' => 'en','name' => 'Short Description','attribute_id' => '9'],
|
||||
['id' => '10','locale' => 'en','name' => 'Description','attribute_id' => '10'],
|
||||
['id' => '11','locale' => 'en','name' => 'Price','attribute_id' => '11'],
|
||||
['id' => '12','locale' => 'en','name' => 'Cost','attribute_id' => '12'],
|
||||
['id' => '13','locale' => 'en','name' => 'Special Price','attribute_id' => '13'],
|
||||
['id' => '14','locale' => 'en','name' => 'Special Price From','attribute_id' => '14'],
|
||||
['id' => '15','locale' => 'en','name' => 'Special Price To','attribute_id' => '15'],
|
||||
['id' => '16','locale' => 'en','name' => 'Meta Description','attribute_id' => '16'],
|
||||
['id' => '17','locale' => 'en','name' => 'Meta Keywords','attribute_id' => '17'],
|
||||
['id' => '18','locale' => 'en','name' => 'Meta Description','attribute_id' => '18'],
|
||||
['id' => '19','locale' => 'en','name' => 'Width','attribute_id' => '19'],
|
||||
['id' => '20','locale' => 'en','name' => 'Height','attribute_id' => '20'],
|
||||
['id' => '21','locale' => 'en','name' => 'Depth','attribute_id' => '21'],
|
||||
['id' => '22','locale' => 'en','name' => 'Weight','attribute_id' => '22'],
|
||||
['id' => '23','locale' => 'en','name' => 'Color','attribute_id' => '23'],
|
||||
['id' => '24','locale' => 'en','name' => 'Size','attribute_id' => '24']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,8 @@ class DatabaseSeeder extends Seeder
|
|||
public function run()
|
||||
{
|
||||
$this->call(AttributeTableSeeder::class);
|
||||
$this->call(AttributeOptionTableSeeder::class);
|
||||
$this->call(AttributeFamilyTableSeeder::class);
|
||||
$this->call(AttributeGroupTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CategoryTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('categories')->delete();
|
||||
|
||||
$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]
|
||||
]);
|
||||
|
||||
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']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->call(CategoryTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ class CategoryController extends Controller
|
|||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Code],
|
||||
'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -121,18 +121,16 @@ class Cart {
|
|||
}
|
||||
|
||||
$child = $childData = null;
|
||||
$additional = [];
|
||||
if($product->type == 'configurable') {
|
||||
$child = $this->product->findOneByField('id', $data['selected_configurable_option']);
|
||||
|
||||
$productAddtionalData = $this->getProductAttributeOptionDetails($child);
|
||||
$additional = $this->getProductAttributeOptionDetails($child);
|
||||
|
||||
unset($productAddtionalData['html']);
|
||||
unset($additional['html']);
|
||||
|
||||
$additional = [
|
||||
'request' => $data,
|
||||
'variant_id' => $data['selected_configurable_option'],
|
||||
'attributes' => $productAddtionalData
|
||||
];
|
||||
$additional['request'] = $data;
|
||||
$additional['variant_id'] = $data['selected_configurable_option'];
|
||||
|
||||
$childData = [
|
||||
'product_id' => $data['selected_configurable_option'],
|
||||
|
|
@ -157,7 +155,7 @@ class Cart {
|
|||
'weight' => $weight = ($product->type == 'configurable' ? $child->weight : $product->weight),
|
||||
'total_weight' => $weight * $data['quantity'],
|
||||
'base_total_weight' => $weight * $data['quantity'],
|
||||
'additional' => json_encode($additional)
|
||||
'additional' => $additional
|
||||
];
|
||||
|
||||
return ['parent' => $parentData, 'child' => $childData];
|
||||
|
|
@ -175,8 +173,7 @@ class Cart {
|
|||
{
|
||||
if($prepared == false) {
|
||||
$itemData = $this->prepareItemData($id, $data);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$itemData = $preparedData;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -521,8 +521,8 @@ class Core
|
|||
public function getTimeInterval($startDate, $endDate) {
|
||||
$timeIntervals = [];
|
||||
|
||||
$totalDays = $startDate->diffInDays($endDate);
|
||||
$totalMonths = $startDate->diffInMonths($endDate);
|
||||
$totalDays = $startDate->diffInDays($endDate) + 1;
|
||||
$totalMonths = $startDate->diffInMonths($endDate) + 1;
|
||||
|
||||
$startWeekDay = Carbon::createFromTimeString($this->xWeekRange($startDate, 0) . ' 00:00:01');
|
||||
$endWeekDay = Carbon::createFromTimeString($this->xWeekRange($endDate, 1) . ' 23:59:59');
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ class CreateWishlistTable extends Migration
|
|||
Schema::create('wishlist', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('channel_id')->unsigned();
|
||||
$table->foreign('channel_id')->references('id')->on('channels');
|
||||
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
|
||||
|
||||
$table->integer('product_id')->unsigned();
|
||||
$table->foreign('product_id')->references('id')->on('products');
|
||||
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
|
||||
|
||||
$table->integer('customer_id')->unsigned();
|
||||
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Product\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->call(ProductTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Category\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use DB;
|
||||
|
||||
class ProductTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -17,19 +17,21 @@ class ProductImage extends AbstractProduct
|
|||
{
|
||||
$images = [];
|
||||
|
||||
foreach($product->images as $image) {
|
||||
if(!Storage::has($image->path))
|
||||
continue;
|
||||
if($product) {
|
||||
foreach($product->images as $image) {
|
||||
if(!Storage::has($image->path))
|
||||
continue;
|
||||
|
||||
$images[] = [
|
||||
'small_image_url' => url('cache/small/' . $image->path),
|
||||
'medium_image_url' => url('cache/medium/' . $image->path),
|
||||
'large_image_url' => url('cache/large/' . $image->path),
|
||||
'original_image_url' => url('cache/original/' . $image->path),
|
||||
];
|
||||
$images[] = [
|
||||
'small_image_url' => url('cache/small/' . $image->path),
|
||||
'medium_image_url' => url('cache/medium/' . $image->path),
|
||||
'large_image_url' => url('cache/large/' . $image->path),
|
||||
'original_image_url' => url('cache/original/' . $image->path),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if(!$product->parent_id && !count($images)) {
|
||||
if(!$product || (!$product->parent_id && !count($images))) {
|
||||
$images[] = [
|
||||
'small_image_url' => bagisto_asset('images/product/small-product-placeholder.png'),
|
||||
'medium_image_url' => bagisto_asset('images/product/meduim-product-placeholder.png'),
|
||||
|
|
@ -49,9 +51,8 @@ class ProductImage extends AbstractProduct
|
|||
*/
|
||||
public function getProductBaseImage($product)
|
||||
{
|
||||
$images = $product->images;
|
||||
|
||||
if($images->count()) {
|
||||
if($product && $product->images->count()) {
|
||||
$images = $product->images;
|
||||
$image = [
|
||||
'small_image_url' => url('cache/small/' . $images[0]->path),
|
||||
'medium_image_url' => url('cache/medium/' . $images[0]->path),
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Review extends AbstractProduct
|
|||
public function getPercentageRating($product)
|
||||
{
|
||||
$reviews = $product->reviews()->where('status','approved')
|
||||
->select('rating', DB::raw ('count(*) as total'))
|
||||
->select('rating', DB::raw('count(*) as total'))
|
||||
->groupBy('rating')
|
||||
->orderBy('rating','desc')
|
||||
->get();
|
||||
|
|
|
|||
|
|
@ -182,10 +182,10 @@ class ProductController extends Controller
|
|||
// before update of product
|
||||
// Event::fire('product.update.before', $id);
|
||||
|
||||
$this->product->update(request()->all(), $id);
|
||||
$product = $this->product->update(request()->all(), $id);
|
||||
|
||||
//after update of product
|
||||
Event::fire('product.update.after', $this->product->find($id));
|
||||
Event::fire('product.save.after', $product);
|
||||
|
||||
session()->flash('success', 'Product updated successfully.');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
namespace Webkul\Product\Repositories;
|
||||
|
||||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
|
@ -14,7 +14,7 @@ use Webkul\Product\Models\ProductAttributeValue;
|
|||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ProductAttributeValueRepository extends Repository
|
||||
{
|
||||
{
|
||||
/**
|
||||
* AttributeRepository object
|
||||
*
|
||||
|
|
|
|||
|
|
@ -154,15 +154,16 @@ class ProductRepository extends Repository
|
|||
|
||||
$product->update($data);
|
||||
|
||||
if(isset($data['categories']))
|
||||
if(isset($data['categories'])) {
|
||||
$product->categories()->sync($data['categories']);
|
||||
}
|
||||
|
||||
$attributes = $product->attribute_family->custom_attributes;
|
||||
|
||||
foreach ($attributes as $attribute) {
|
||||
if(!isset($data[$attribute->code]) || ($attribute->code == 'boolean' && !$data[$attribute->code]))
|
||||
continue;
|
||||
|
||||
|
||||
$attributeValue = $this->attributeValue->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'attribute_id' => $attribute->id,
|
||||
|
|
@ -172,16 +173,17 @@ class ProductRepository extends Repository
|
|||
|
||||
if(!$attributeValue) {
|
||||
$this->attributeValue->create([
|
||||
'product_id' => $product->id,
|
||||
'attribute_id' => $attribute->id,
|
||||
'value' => $data[$attribute->code],
|
||||
'channel' => $attribute->value_per_channel ? $data['channel'] : null,
|
||||
'locale' => $attribute->value_per_locale ? $data['locale'] : null
|
||||
]);
|
||||
'product_id' => $product->id,
|
||||
'attribute_id' => $attribute->id,
|
||||
'value' => $data[$attribute->code],
|
||||
'channel' => $attribute->value_per_channel ? $data['channel'] : null,
|
||||
'locale' => $attribute->value_per_locale ? $data['locale'] : null
|
||||
]);
|
||||
} else {
|
||||
$this->attributeValue->update([
|
||||
ProductAttributeValue::$attributeTypeFields[$attribute->type] => $data[$attribute->code]
|
||||
], $attributeValue->id);
|
||||
ProductAttributeValue::$attributeTypeFields[$attribute->type] => $data[$attribute->code]
|
||||
], $attributeValue->id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ use Webkul\Sales\Contracts\InvoiceItem as InvoiceItemContract;
|
|||
class InvoiceItem extends Model implements InvoiceItemContract
|
||||
{
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
|
||||
protected $casts = [
|
||||
'additional' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the invoice record associated with the invoice item.
|
||||
|
|
@ -40,4 +44,21 @@ class InvoiceItem extends Model implements InvoiceItemContract
|
|||
{
|
||||
return $this->hasOne(InvoiceItemProxy::modelClass(), 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configurable option html
|
||||
*/
|
||||
public function getOptionDetailHtml()
|
||||
{
|
||||
|
||||
if($this->type == 'configurable' && isset($this->additional['attributes'])) {
|
||||
$labels = [];
|
||||
|
||||
foreach($this->additional['attributes'] as $attribute) {
|
||||
$labels[] = $attribute['attribute_name'] . ' : ' . $attribute['option_label'];
|
||||
}
|
||||
|
||||
return implode(', ', $labels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,10 @@ class OrderItem extends Model implements OrderItemContract
|
|||
{
|
||||
protected $guarded = ['id', 'child', 'created_at', 'updated_at'];
|
||||
|
||||
protected $casts = [
|
||||
'additional' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get remaining qty for shipping.
|
||||
*/
|
||||
|
|
@ -75,4 +79,21 @@ class OrderItem extends Model implements OrderItemContract
|
|||
public function shipment_items() {
|
||||
return $this->hasMany(ShipmentItemProxy::modelClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configurable option html
|
||||
*/
|
||||
public function getOptionDetailHtml()
|
||||
{
|
||||
|
||||
if($this->type == 'configurable' && isset($this->additional['attributes'])) {
|
||||
$labels = [];
|
||||
|
||||
foreach($this->additional['attributes'] as $attribute) {
|
||||
$labels[] = $attribute['attribute_name'] . ' : ' . $attribute['option_label'];
|
||||
}
|
||||
|
||||
return implode(', ', $labels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,10 @@ use Webkul\Sales\Contracts\ShipmentItem as ShipmentItemContract;
|
|||
class ShipmentItem extends Model implements ShipmentItemContract
|
||||
{
|
||||
protected $guarded = ['id', 'child', 'created_at', 'updated_at'];
|
||||
|
||||
protected $casts = [
|
||||
'additional' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the shipment record associated with the shipment item.
|
||||
|
|
@ -40,4 +44,21 @@ class ShipmentItem extends Model implements ShipmentItemContract
|
|||
{
|
||||
return $this->belongsTo(ShipmentItemProxy::modelClass(), 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configurable option html
|
||||
*/
|
||||
public function getOptionDetailHtml()
|
||||
{
|
||||
|
||||
if($this->type == 'configurable' && isset($this->additional['attributes'])) {
|
||||
$labels = [];
|
||||
|
||||
foreach($this->additional['attributes'] as $attribute) {
|
||||
$labels[] = $attribute['attribute_name'] . ' : ' . $attribute['option_label'];
|
||||
}
|
||||
|
||||
return implode(', ', $labels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
</div>
|
||||
|
||||
@foreach ($invoice->items as $item)
|
||||
<div style="background: #FFFFFF;border: 1px solid #E8E8E8;border-radius: 3px;padding: 20px">
|
||||
<div style="background: #FFFFFF;border: 1px solid #E8E8E8;border-radius: 3px;padding: 20px;margin-bottom: 10px">
|
||||
<p style="font-size: 18px;color: #242424;line-height: 24px;margin-top: 0;margin-bottom: 10px;font-weight: bold;">
|
||||
{{ $item->name }}
|
||||
</p>
|
||||
|
|
@ -120,11 +120,13 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div style="">
|
||||
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
|
||||
Color : Gray, Size : S
|
||||
</label>
|
||||
</div>
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<div style="">
|
||||
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
|
||||
{{ $html }}
|
||||
</label>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
</div>
|
||||
|
||||
@foreach ($order->items as $item)
|
||||
<div style="background: #FFFFFF;border: 1px solid #E8E8E8;border-radius: 3px;padding: 20px">
|
||||
<div style="background: #FFFFFF;border: 1px solid #E8E8E8;border-radius: 3px;padding: 20px;margin-bottom: 10px">
|
||||
<p style="font-size: 18px;color: #242424;line-height: 24px;margin-top: 0;margin-bottom: 10px;font-weight: bold;">
|
||||
{{ $item->name }}
|
||||
</p>
|
||||
|
|
@ -118,11 +118,13 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div style="">
|
||||
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
|
||||
Color : Gray, Size : S
|
||||
</label>
|
||||
</div>
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<div style="">
|
||||
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
|
||||
{{ $html }}
|
||||
</label>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
</div>
|
||||
|
||||
@foreach ($shipment->items as $item)
|
||||
<div style="background: #FFFFFF;border: 1px solid #E8E8E8;border-radius: 3px;padding: 20px">
|
||||
<div style="background: #FFFFFF;border: 1px solid #E8E8E8;border-radius: 3px;padding: 20px;margin-bottom: 10px">
|
||||
<p style="font-size: 18px;color: #242424;line-height: 24px;margin-top: 0;margin-bottom: 10px;font-weight: bold;">
|
||||
{{ $item->name }}
|
||||
</p>
|
||||
|
|
@ -130,11 +130,13 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div style="">
|
||||
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
|
||||
Color : Gray, Size : S
|
||||
</label>
|
||||
</div>
|
||||
@if ($html = $item->getOptionDetailHtml())
|
||||
<div style="">
|
||||
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
|
||||
{{ $html }}
|
||||
</label>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -1,79 +1,84 @@
|
|||
@inject ('reviewHelper', 'Webkul\Product\Helpers\Review')
|
||||
|
||||
@if ($total = $reviewHelper->getTotalReviews($product))
|
||||
<div class="rating-reviews">
|
||||
<div class="rating-header">
|
||||
{{ __('shop::app.products.reviews-title') }}
|
||||
</div>
|
||||
|
||||
<div class="overall">
|
||||
<div class="review-info">
|
||||
|
||||
<span class="number">
|
||||
{{ $reviewHelper->getAverageRating($product) }}
|
||||
</span>
|
||||
|
||||
<span class="stars">
|
||||
@for ($i = 1; $i <= round($reviewHelper->getAverageRating($product)); $i++)
|
||||
|
||||
<span class="icon star-icon"></span>
|
||||
|
||||
@endfor
|
||||
</span>
|
||||
|
||||
<div class="total-reviews">
|
||||
{{ __('shop::app.products.total-reviews', ['total' => $total]) }}
|
||||
</div>
|
||||
|
||||
<div class="rating-reviews">
|
||||
<div class="rating-header">
|
||||
{{ __('shop::app.products.reviews-title') }}
|
||||
</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 class="overall">
|
||||
<div class="review-info">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="reviews">
|
||||
|
||||
@foreach ($reviewHelper->getReviews($product)->paginate(10) as $review)
|
||||
<div class="review">
|
||||
<div class="title">
|
||||
{{ $review->title }}
|
||||
</div>
|
||||
<span class="number">
|
||||
{{ $reviewHelper->getAverageRating($product) }}
|
||||
</span>
|
||||
|
||||
<span class="stars">
|
||||
@for ($i = 1; $i <= $review->rating; $i++)
|
||||
@for ($i = 1; $i <= round($reviewHelper->getAverageRating($product)); $i++)
|
||||
|
||||
<span class="icon star-icon"></span>
|
||||
|
||||
@endfor
|
||||
</span>
|
||||
|
||||
<div class="message">
|
||||
{{ $review->comment }}
|
||||
<div class="total-reviews">
|
||||
{{ __('shop::app.products.total-reviews', ['total' => $total]) }}
|
||||
</div>
|
||||
|
||||
<div class="reviewer-details">
|
||||
<span class="by">
|
||||
{{ __('shop::app.products.by', ['name' => $review->customer->name]) }},
|
||||
</span>
|
||||
|
||||
<span class="when">
|
||||
{{ core()->formatDate($review->created_at) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<a href="{{ route('shop.reviews.index', $product->url_key) }}" class="view-all">View All</a>
|
||||
@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(10) as $review)
|
||||
<div class="review">
|
||||
<div class="title">
|
||||
{{ $review->title }}
|
||||
</div>
|
||||
|
||||
<span class="stars">
|
||||
@for ($i = 1; $i <= $review->rating; $i++)
|
||||
|
||||
<span class="icon star-icon"></span>
|
||||
|
||||
@endfor
|
||||
</span>
|
||||
|
||||
<div class="message">
|
||||
{{ $review->comment }}
|
||||
</div>
|
||||
|
||||
<div class="reviewer-details">
|
||||
<span class="by">
|
||||
{{ __('shop::app.products.by', ['name' => $review->customer->name]) }},
|
||||
</span>
|
||||
|
||||
<span class="when">
|
||||
{{ core()->formatDate($review->created_at) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<a href="{{ route('shop.reviews.index', $product->url_key) }}" class="view-all">View All</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
@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>
|
||||
<div class="rating-reviews">
|
||||
<div class="rating-header">
|
||||
<a href="{{ route('shop.reviews.create', $product->url_key) }}" class="btn btn-lg btn-primary">
|
||||
{{ __('shop::app.products.write-review-btn') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
|
@ -774,7 +774,7 @@ class DataGrid
|
|||
|
||||
$this->results = $this->query->get();
|
||||
|
||||
$this->results = $this->query->distinct()->paginate($this->perpage)->appends(request()->except('page'));
|
||||
$this->results = $this->query->paginate($this->perpage)->appends(request()->except('page'));
|
||||
|
||||
return $this->results;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ h2 {
|
|||
cursor: pointer;
|
||||
transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
font: inherit;
|
||||
display: inline-block;
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
|
|
@ -586,11 +587,11 @@ h2 {
|
|||
}
|
||||
}
|
||||
|
||||
.accordian {
|
||||
.accordian, accordian {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
|
||||
.accordian-header {
|
||||
.accordian-header, div[slot*="header"] {
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
font-size: 18px;
|
||||
|
|
@ -620,7 +621,7 @@ h2 {
|
|||
}
|
||||
}
|
||||
|
||||
.accordian-content {
|
||||
.accordian-content, div[slot*="body"] {
|
||||
width: 100%;
|
||||
padding: 20px 15px;
|
||||
display: none;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js",
|
||||
"/css/shop.css": "/css/shop.css"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue