Merge pull request #7 from jitendra-webkul/jitendra

Product Package Added
This commit is contained in:
JItendra Singh 2018-07-27 15:01:41 +05:30 committed by GitHub
commit 8c6bd42dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 208 additions and 30 deletions

View File

@ -93,7 +93,7 @@
</div> </div>
</accordian> </accordian>
<div class="<?php in_array($attribute->type, ['select', 'multiselect', 'checkbox']) ?: 'hide' ?>"> <div class="{{ in_array($attribute->type, ['select', 'multiselect', 'checkbox']) ?: 'hide' }}">
<accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'"> <accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'">
<div slot="body"> <div slot="body">
@ -116,7 +116,7 @@
<div class="control-group"> <div class="control-group">
<label for="is_unique">{{ __('admin::app.catalog.attributes.is_unique') }}</label> <label for="is_unique">{{ __('admin::app.catalog.attributes.is_unique') }}</label>
<select class="control" id="is_unique" name="is_unique"> <select class="control" id="is_unique" name="is_unique" disabled>
<option value="0" {{ $attribute->is_unique ? '' : 'selected' }}> <option value="0" {{ $attribute->is_unique ? '' : 'selected' }}>
{{ __('admin::app.catalog.attributes.no') }} {{ __('admin::app.catalog.attributes.no') }}
</option> </option>
@ -124,6 +124,7 @@
{{ __('admin::app.catalog.attributes.yes') }} {{ __('admin::app.catalog.attributes.yes') }}
</option> </option>
</select> </select>
<input type="hidden" name="is_unique" value="{{ $attribute->is_unique }}"/>
</div> </div>
<div class="control-group"> <div class="control-group">
@ -166,7 +167,7 @@
<div class="control-group"> <div class="control-group">
<label for="value_per_locale">{{ __('admin::app.catalog.attributes.value_per_locale') }}</label> <label for="value_per_locale">{{ __('admin::app.catalog.attributes.value_per_locale') }}</label>
<select class="control" id="value_per_locale" name="value_per_locale"> <select class="control" id="value_per_locale" name="value_per_locale" disabled>
<option value="0" {{ $attribute->value_per_locale ? '' : 'selected' }}> <option value="0" {{ $attribute->value_per_locale ? '' : 'selected' }}>
{{ __('admin::app.catalog.attributes.no') }} {{ __('admin::app.catalog.attributes.no') }}
</option> </option>
@ -174,11 +175,12 @@
{{ __('admin::app.catalog.attributes.yes') }} {{ __('admin::app.catalog.attributes.yes') }}
</option> </option>
</select> </select>
<input type="hidden" name="value_per_locale" value="{{ $attribute->value_per_locale }}"/>
</div> </div>
<div class="control-group"> <div class="control-group">
<label for="value_per_channel">{{ __('admin::app.catalog.attributes.value_per_channel') }}</label> <label for="value_per_channel">{{ __('admin::app.catalog.attributes.value_per_channel') }}</label>
<select class="control" id="value_per_channel" name="value_per_channel"> <select class="control" id="value_per_channel" name="value_per_channel" disabled>
<option value="0" {{ $attribute->value_per_channel ? '' : 'selected' }}> <option value="0" {{ $attribute->value_per_channel ? '' : 'selected' }}>
{{ __('admin::app.catalog.attributes.no') }} {{ __('admin::app.catalog.attributes.no') }}
</option> </option>
@ -186,6 +188,7 @@
{{ __('admin::app.catalog.attributes.yes') }} {{ __('admin::app.catalog.attributes.yes') }}
</option> </option>
</select> </select>
<input type="hidden" name="value_per_channel" value="{{ $attribute->value_per_channel }}"/>
</div> </div>
<div class="control-group"> <div class="control-group">

View File

@ -22,20 +22,23 @@ class AttributeFamilyTableSeeder extends Seeder
"position" => 1, "position" => 1,
"attributes" => [ "attributes" => [
[ [
'code' => 'name', 'code' => 'sku',
'position' => 1 'position' => 1
], [ ], [
'code' => 'url_key', 'code' => 'name',
'position' => 2 'position' => 2
], [ ], [
'code' => 'new_from', 'code' => 'url_key',
'position' => 3 'position' => 3
], [ ], [
'code' => 'new_to', 'code' => 'new_from',
'position' => 4 'position' => 4
], [ ], [
'code' => 'status', 'code' => 'new_to',
'position' => 5 'position' => 5
], [
'code' => 'status',
'position' => 6
] ]
] ]
], [ ], [

View File

@ -12,13 +12,28 @@ class AttributeTableSeeder extends Seeder
*/ */
protected $rawData = [ 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' => 1,
'is_configurable' => 0,
'is_user_defined' => 0
], [
'code' => 'name', 'code' => 'name',
'admin_name' => 'Name', 'admin_name' => 'Name',
'en' => [ 'en' => [
'name' => 'Name' 'name' => 'Name'
], ],
'type' => 'text', 'type' => 'text',
'position' => 1, 'position' => 2,
'is_required' => 1, 'is_required' => 1,
'value_per_locale' => 1, 'value_per_locale' => 1,
'value_per_channel' => 1, 'value_per_channel' => 1,
@ -32,7 +47,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'URL Key' 'name' => 'URL Key'
], ],
'type' => 'text', 'type' => 'text',
'position' => 2, 'position' => 3,
'is_unique' => 1, 'is_unique' => 1,
'is_required' => 1, 'is_required' => 1,
'value_per_locale' => 0, 'value_per_locale' => 0,
@ -47,7 +62,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'New From' 'name' => 'New From'
], ],
'type' => 'datetime', 'type' => 'datetime',
'position' => 3, 'position' => 4,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -61,7 +76,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'New To' 'name' => 'New To'
], ],
'type' => 'datetime', 'type' => 'datetime',
'position' => 4, 'position' => 5,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -75,7 +90,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Status' 'name' => 'Status'
], ],
'type' => 'boolean', 'type' => 'boolean',
'position' => 5, 'position' => 6,
'is_required' => 1, 'is_required' => 1,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -89,7 +104,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Short Description' 'name' => 'Short Description'
], ],
'type' => 'textarea', 'type' => 'textarea',
'position' => 6, 'position' => 7,
'is_required' => 1, 'is_required' => 1,
'value_per_locale' => 1, 'value_per_locale' => 1,
'value_per_channel' => 1, 'value_per_channel' => 1,
@ -103,7 +118,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Description' 'name' => 'Description'
], ],
'type' => 'textarea', 'type' => 'textarea',
'position' => 7, 'position' => 8,
'is_required' => 1, 'is_required' => 1,
'value_per_locale' => 1, 'value_per_locale' => 1,
'value_per_channel' => 1, 'value_per_channel' => 1,
@ -117,7 +132,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Price' 'name' => 'Price'
], ],
'type' => 'price', 'type' => 'price',
'position' => 8, 'position' => 9,
'is_required' => 1, 'is_required' => 1,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -131,7 +146,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Cost' 'name' => 'Cost'
], ],
'type' => 'price', 'type' => 'price',
'position' => 9, 'position' => 10,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -145,7 +160,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Special Price' 'name' => 'Special Price'
], ],
'type' => 'price', 'type' => 'price',
'position' => 10, 'position' => 11,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -159,7 +174,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Special Price From' 'name' => 'Special Price From'
], ],
'type' => 'datetime', 'type' => 'datetime',
'position' => 11, 'position' => 12,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -173,7 +188,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Special Price To' 'name' => 'Special Price To'
], ],
'type' => 'datetime', 'type' => 'datetime',
'position' => 12, 'position' => 13,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -187,7 +202,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Meta Description' 'name' => 'Meta Description'
], ],
'type' => 'textarea', 'type' => 'textarea',
'position' => 13, 'position' => 14,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 1, 'value_per_locale' => 1,
'value_per_channel' => 1, 'value_per_channel' => 1,
@ -201,7 +216,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Meta Keywords' 'name' => 'Meta Keywords'
], ],
'type' => 'textarea', 'type' => 'textarea',
'position' => 14, 'position' => 15,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 1, 'value_per_locale' => 1,
'value_per_channel' => 1, 'value_per_channel' => 1,
@ -215,7 +230,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Meta Description' 'name' => 'Meta Description'
], ],
'type' => 'textarea', 'type' => 'textarea',
'position' => 15, 'position' => 16,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 1, 'value_per_locale' => 1,
'value_per_channel' => 1, 'value_per_channel' => 1,
@ -230,7 +245,7 @@ class AttributeTableSeeder extends Seeder
], ],
'type' => 'text', 'type' => 'text',
'validation' => 'number', 'validation' => 'number',
'position' => 16, 'position' => 17,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -245,7 +260,7 @@ class AttributeTableSeeder extends Seeder
], ],
'type' => 'text', 'type' => 'text',
'validation' => 'number', 'validation' => 'number',
'position' => 17, 'position' => 18,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -260,7 +275,7 @@ class AttributeTableSeeder extends Seeder
], ],
'type' => 'text', 'type' => 'text',
'validation' => 'number', 'validation' => 'number',
'position' => 18, 'position' => 19,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -275,7 +290,7 @@ class AttributeTableSeeder extends Seeder
], ],
'type' => 'text', 'type' => 'text',
'validation' => 'number', 'validation' => 'number',
'position' => 19, 'position' => 20,
'is_required' => 1, 'is_required' => 1,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -289,7 +304,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Color' 'name' => 'Color'
], ],
'type' => 'select', 'type' => 'select',
'position' => 20, 'position' => 21,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,
@ -331,7 +346,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Size' 'name' => 'Size'
], ],
'type' => 'select', 'type' => 'select',
'position' => 21, 'position' => 22,
'is_required' => 0, 'is_required' => 0,
'value_per_locale' => 0, 'value_per_locale' => 0,
'value_per_channel' => 0, 'value_per_channel' => 0,

View File

@ -0,0 +1,68 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('products', function (Blueprint $table) {
$table->increments('id');
$table->string('sku')->unique();
$table->string('type');
$table->integer('parent_id')->unsigned()->nullable();
$table->timestamps();
});
Schema::table('products', function (Blueprint $table) {
$table->foreign('parent_id')->references('id')->on('products')->onDelete('cascade');
});
Schema::create('product_categories', function (Blueprint $table) {
$table->integer('product_id')->unsigned();
$table->integer('category_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
});
Schema::create('product_relations', function (Blueprint $table) {
$table->integer('parent_id')->unsigned();
$table->integer('child_id')->unsigned();
$table->foreign('parent_id')->references('id')->on('products')->onDelete('cascade');
$table->foreign('child_id')->references('id')->on('products')->onDelete('cascade');
});
Schema::create('product_up_sells', function (Blueprint $table) {
$table->integer('parent_id')->unsigned();
$table->integer('child_id')->unsigned();
$table->foreign('parent_id')->references('id')->on('products')->onDelete('cascade');
$table->foreign('child_id')->references('id')->on('products')->onDelete('cascade');
});
Schema::create('product_cross_sells', function (Blueprint $table) {
$table->integer('parent_id')->unsigned();
$table->integer('child_id')->unsigned();
$table->foreign('parent_id')->references('id')->on('products')->onDelete('cascade');
$table->foreign('child_id')->references('id')->on('products')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('products');
Schema::dropIfExists('product_categories');
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductAttributeValueTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('product_attribute_value', function (Blueprint $table) {
$table->increments('id');
$table->text('text_value')->nullable();
$table->boolean('boolean_value')->nullable();
$table->integer('integer_value')->nullable();
$table->double('float_value')->nullable();
$table->dateTime('datetime_value')->nullable();
$table->date('date_value')->nullable();
$table->json('json_value')->nullable();
$table->integer('product_id')->unsigned();
$table->integer('attribute_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('product_attribute_value');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateProductReviewsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('product_reviews', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->integer('rating');
$table->text('comment')->nullable();
$table->string('status');
$table->timestamps();
$table->integer('product_id')->unsigned();
$table->integer('customer_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('product_reviews');
}
}

View File

@ -3,8 +3,17 @@
namespace Webkul\Product\Models; namespace Webkul\Product\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Webkul\Category\Models\Category;
class Product extends Model class Product extends Model
{ {
protected $guarded = ['_token']; protected $guarded = ['_token'];
/**
* The categories that belong to the product.
*/
public function categories()
{
return $this->belongsToMany(Category::class, 'product_categories');
}
} }