commit
e32c78568f
|
|
@ -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('catalog.product.delete.after', 'Webkul\Admin\Listeners\Product@afterProductDelete');
|
||||
}
|
||||
}
|
||||
|
|
@ -467,6 +467,7 @@ return [
|
|||
'default-locale' => 'Default Locale',
|
||||
'currencies' => 'Currencies',
|
||||
'base-currency' => 'Base Currency',
|
||||
'root-category' => 'Root Category',
|
||||
'inventory_sources' => 'Inventory Sources',
|
||||
'design' => 'Design',
|
||||
'theme' => 'Theme',
|
||||
|
|
|
|||
|
|
@ -56,6 +56,18 @@
|
|||
<span class="control-error" v-if="errors.has('inventory_sources[]')">@{{ errors.first('inventory_sources[]') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('root_category_id') ? 'has-error' : '']">
|
||||
<label for="root_category_id" class="required">{{ __('admin::app.settings.channels.root-category') }}</label>
|
||||
<select v-validate="'required'" class="control" id="root_category_id" name="root_category_id" data-vv-as=""{{ __('admin::app.settings.channels.root-category') }}"">
|
||||
@foreach(app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
|
||||
<option value="{{ $category->id }}" {{ old('root_category_id') == $category->id ? 'selected' : '' }}>
|
||||
{{ $category->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('root_category_id')">@{{ errors.first('root_category_id') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="hostname">{{ __('admin::app.settings.channels.hostname') }}</label>
|
||||
<input class="control" id="hostname" name="hostname" value="{{ old('hostname') }}" placeholder="https://www.example.com"/>
|
||||
|
|
|
|||
|
|
@ -59,6 +59,19 @@
|
|||
<span class="control-error" v-if="errors.has('inventory_sources[]')">@{{ errors.first('inventory_sources[]') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('root_category_id') ? 'has-error' : '']">
|
||||
<label for="root_category_id" class="required">{{ __('admin::app.settings.channels.root-category') }}</label>
|
||||
<?php $selectedOption = old('root_category_id') ?: $channel->root_category_id ?>
|
||||
<select v-validate="'required'" class="control" id="root_category_id" name="root_category_id" data-vv-as=""{{ __('admin::app.settings.channels.root-category') }}"">
|
||||
@foreach(app('Webkul\Category\Repositories\CategoryRepository')->getRootCategories() as $category)
|
||||
<option value="{{ $category->id }}" {{ $selectedOption == $category->id ? 'selected' : '' }}>
|
||||
{{ $category->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('root_category_id')">@{{ errors.first('root_category_id') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="hostname">{{ __('admin::app.settings.channels.hostname') }}</label>
|
||||
<input type="text" class="control" id="hostname" name="hostname" value="{{ $channel->hostname }}" placeholder="https://www.example.com"/>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace Webkul\Attribute\Http\Controllers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
|
||||
|
||||
|
||||
|
|
@ -38,8 +37,6 @@ class AttributeController extends Controller
|
|||
*/
|
||||
public function __construct(Attribute $attribute)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->attribute = $attribute;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
@ -78,12 +75,8 @@ class AttributeController extends Controller
|
|||
'type' => 'required'
|
||||
]);
|
||||
|
||||
Event::fire('catalog.attribute.create.before');
|
||||
|
||||
$attribute = $this->attribute->create(request()->all());
|
||||
|
||||
Event::fire('catalog.attribute.create.after', $attribute);
|
||||
|
||||
session()->flash('success', 'Attribute created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -117,12 +110,8 @@ class AttributeController extends Controller
|
|||
'type' => 'required'
|
||||
]);
|
||||
|
||||
Event::fire('catalog.attribute.update.before', $id);
|
||||
|
||||
$attribute = $this->attribute->update(request()->all(), $id);
|
||||
|
||||
Event::fire('catalog.attribute.update.after', $attribute);
|
||||
|
||||
session()->flash('success', 'Attribute updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -142,12 +131,8 @@ class AttributeController extends Controller
|
|||
session()->flash('error', 'Can not delete system attribute.');
|
||||
} else {
|
||||
try {
|
||||
Event::fire('catalog.attribute.delete.before', $id);
|
||||
|
||||
$this->attribute->delete($id);
|
||||
|
||||
Event::fire('catalog.attribute.delete.after', $id);
|
||||
|
||||
session()->flash('success', 'Attribute deleted successfully.');
|
||||
} catch(\Exception $e) {
|
||||
session()->flash('error', 'Attribute is used in configurable products.');
|
||||
|
|
@ -162,33 +147,30 @@ class AttributeController extends Controller
|
|||
*
|
||||
* @return response \Illuminate\Http\Response
|
||||
*/
|
||||
public function massDestroy() {
|
||||
public function massDestroy()
|
||||
{
|
||||
$suppressFlash = false;
|
||||
|
||||
if(request()->isMethod('post')) {
|
||||
if (request()->isMethod('post')) {
|
||||
$indexes = explode(',', request()->input('indexes'));
|
||||
|
||||
foreach($indexes as $key => $value) {
|
||||
foreach ($indexes as $key => $value) {
|
||||
$attribute = $this->attribute->findOrFail($value);
|
||||
|
||||
try {
|
||||
if(!$attribute->is_user_defined) {
|
||||
if (!$attribute->is_user_defined) {
|
||||
continue;
|
||||
} else {
|
||||
Event::fire('catalog.attribute.delete.before', $value);
|
||||
|
||||
$this->attribute->delete($value);
|
||||
|
||||
Event::fire('catalog.attribute.delete.after', $value);
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$suppressFlash = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$suppressFlash)
|
||||
if (!$suppressFlash)
|
||||
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
|
||||
else
|
||||
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'attributes']));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace Webkul\Attribute\Http\Controllers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
|
||||
|
||||
|
|
@ -39,8 +38,6 @@ class AttributeFamilyController extends Controller
|
|||
*/
|
||||
public function __construct(AttributeFamily $attributeFamily)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->attributeFamily = $attributeFamily;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
@ -83,12 +80,8 @@ class AttributeFamilyController extends Controller
|
|||
'name' => 'required'
|
||||
]);
|
||||
|
||||
Event::fire('catalog.attribute_family.create.before');
|
||||
|
||||
$attributeFamily = $this->attributeFamily->create(request()->all());
|
||||
|
||||
Event::fire('catalog.attribute_family.create.after', $attributeFamily);
|
||||
|
||||
session()->flash('success', 'Family created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -124,12 +117,8 @@ class AttributeFamilyController extends Controller
|
|||
'name' => 'required'
|
||||
]);
|
||||
|
||||
Event::fire('catalog.attribute_family.update.before', $id);
|
||||
|
||||
$attributeFamily = $this->attributeFamily->update(request()->all(), $id);
|
||||
|
||||
Event::fire('catalog.attribute_family.update.after', $attributeFamily);
|
||||
|
||||
session()->flash('success', 'Family updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -145,17 +134,13 @@ class AttributeFamilyController extends Controller
|
|||
{
|
||||
$attributeFamily = $this->attributeFamily->find($id);
|
||||
|
||||
if($this->attributeFamily->count() == 1) {
|
||||
if ($this->attributeFamily->count() == 1) {
|
||||
session()->flash('error', 'At least one family is required.');
|
||||
} else if ($attributeFamily->products()->count()) {
|
||||
session()->flash('error', 'Attribute family is used in products.');
|
||||
} else {
|
||||
Event::fire('catalog.attribute_family.delete.before', $id);
|
||||
|
||||
$this->attributeFamily->delete($id);
|
||||
|
||||
Event::fire('catalog.attribute_family.delete.after', $id);
|
||||
|
||||
session()->flash('success', 'Family deleted successfully.');
|
||||
}
|
||||
|
||||
|
|
@ -170,24 +155,20 @@ class AttributeFamilyController extends Controller
|
|||
public function massDestroy() {
|
||||
$suppressFlash = false;
|
||||
|
||||
if(request()->isMethod('delete')) {
|
||||
if (request()->isMethod('delete')) {
|
||||
$indexes = explode(',', request()->input('indexes'));
|
||||
|
||||
foreach($indexes as $key => $value) {
|
||||
foreach ($indexes as $key => $value) {
|
||||
try {
|
||||
Event::fire('catalog.attribute_family.delete.before', $value);
|
||||
|
||||
$this->attributeFamily->delete($value);
|
||||
|
||||
Event::fire('catalog.attribute_family.delete.after', $value);
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
$suppressFlash = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$suppressFlash)
|
||||
if (!$suppressFlash)
|
||||
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success'));
|
||||
else
|
||||
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'Attribute Family']));
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Attribute\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeGroupRepository;
|
||||
use Illuminate\Container\Container as App;
|
||||
|
|
@ -61,6 +62,8 @@ class AttributeFamilyRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
Event::fire('catalog.attribute_family.create.before');
|
||||
|
||||
$attributeGroups = isset($data['attribute_groups']) ? $data['attribute_groups'] : [];
|
||||
unset($data['attribute_groups']);
|
||||
$family = $this->model->create($data);
|
||||
|
|
@ -81,6 +84,8 @@ class AttributeFamilyRepository extends Repository
|
|||
}
|
||||
}
|
||||
|
||||
Event::fire('catalog.attribute_family.create.after', $attributeFamily);
|
||||
|
||||
return $family;
|
||||
}
|
||||
|
||||
|
|
@ -94,6 +99,8 @@ class AttributeFamilyRepository extends Repository
|
|||
{
|
||||
$family = $this->find($id);
|
||||
|
||||
Event::fire('catalog.attribute_family.update.before', $id);
|
||||
|
||||
$family->update($data);
|
||||
|
||||
$previousAttributeGroupIds = $family->attribute_groups()->pluck('id');
|
||||
|
|
@ -141,6 +148,21 @@ class AttributeFamilyRepository extends Repository
|
|||
$this->attributeGroup->delete($attributeGroupId);
|
||||
}
|
||||
|
||||
Event::fire('catalog.attribute_family.update.after', $family);
|
||||
|
||||
return $family;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
Event::fire('catalog.attribute_family.delete.before', $id);
|
||||
|
||||
parent::delete($id);
|
||||
|
||||
Event::fire('catalog.attribute_family.delete.after', $id);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Attribute\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||
use Illuminate\Container\Container as App;
|
||||
|
||||
|
|
@ -50,6 +51,8 @@ class AttributeRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
Event::fire('catalog.attribute.create.before');
|
||||
|
||||
$data = $this->validateUserInput($data);
|
||||
|
||||
$options = isset($data['options']) ? $data['options'] : [];
|
||||
|
|
@ -62,6 +65,8 @@ class AttributeRepository extends Repository
|
|||
}
|
||||
}
|
||||
|
||||
Event::fire('catalog.attribute.create.after', $attribute);
|
||||
|
||||
return $attribute;
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +82,8 @@ class AttributeRepository extends Repository
|
|||
|
||||
$attribute = $this->find($id);
|
||||
|
||||
Event::fire('catalog.attribute.update.before', $id);
|
||||
|
||||
$attribute->update($data);
|
||||
|
||||
$previousOptionIds = $attribute->options()->pluck('id');
|
||||
|
|
@ -101,9 +108,24 @@ class AttributeRepository extends Repository
|
|||
$this->attributeOption->delete($optionId);
|
||||
}
|
||||
|
||||
Event::fire('catalog.attribute.update.after', $attribute);
|
||||
|
||||
return $attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
Event::fire('catalog.attribute.delete.before', $id);
|
||||
|
||||
parent::delete($id);
|
||||
|
||||
Event::fire('catalog.attribute.delete.after', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return array
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace Webkul\Category\Http\Controllers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Category\Repositories\CategoryRepository as Category;
|
||||
|
||||
/**
|
||||
|
|
@ -37,8 +36,6 @@ class CategoryController extends Controller
|
|||
*/
|
||||
public function __construct(Category $category)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->category = $category;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
@ -79,12 +76,8 @@ class CategoryController extends Controller
|
|||
'image.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
||||
Event::fire('catalog.category.create.before');
|
||||
|
||||
$category = $this->category->create(request()->all());
|
||||
|
||||
Event::fire('catalog.category.create.after', $category);
|
||||
|
||||
session()->flash('success', 'Category created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -126,12 +119,8 @@ class CategoryController extends Controller
|
|||
'image.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
||||
Event::fire('catalog.category.update.before', $id);
|
||||
|
||||
$this->category->update(request()->all(), $id);
|
||||
|
||||
Event::fire('catalog.category.update.after', $id);
|
||||
|
||||
session()->flash('success', 'Category updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
|
||||
namespace Webkul\Category\Repositories;
|
||||
|
||||
use Webkul\Category\Models\Category;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Container\Container as App;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Webkul\Category\Models\Category;
|
||||
use Webkul\Category\Models\CategoryTranslation;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
|
||||
|
|
@ -43,6 +44,8 @@ class CategoryRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
Event::fire('catalog.category.create.before');
|
||||
|
||||
if (isset($data['locale']) && $data['locale'] == 'all') {
|
||||
$model = app()->make($this->model());
|
||||
|
||||
|
|
@ -59,6 +62,8 @@ class CategoryRepository extends Repository
|
|||
|
||||
$this->uploadImages($data, $category);
|
||||
|
||||
Event::fire('catalog.category.create.after', $category);
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +80,17 @@ class CategoryRepository extends Repository
|
|||
: Category::orderBy('position', 'ASC')->get()->toTree();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get root categories
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRootCategories()
|
||||
{
|
||||
return Category::withDepth()->having('depth', '=', 0)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* get visible category tree
|
||||
*
|
||||
|
|
@ -135,13 +151,30 @@ class CategoryRepository extends Repository
|
|||
{
|
||||
$category = $this->find($id);
|
||||
|
||||
Event::fire('catalog.category.update.before', $id);
|
||||
|
||||
$category->update($data);
|
||||
|
||||
$this->uploadImages($data, $category);
|
||||
|
||||
Event::fire('catalog.category.update.after', $id);
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
Event::fire('catalog.category.delete.before', $id);
|
||||
|
||||
parent::delete($id);
|
||||
|
||||
Event::fire('catalog.category.delete.after', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param mixed $category
|
||||
|
|
|
|||
|
|
@ -551,13 +551,13 @@ class Cart {
|
|||
$cart = $this->cart->find(session()->get('cart')->id);
|
||||
}
|
||||
|
||||
if($cart != null) {
|
||||
if($cart->items->count() == 0) {
|
||||
$this->cart->delete($cart->id);
|
||||
// if($cart != null) {
|
||||
// if($cart->items->count() == 0) {
|
||||
// $this->cart->delete($cart->id);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
return $cart && $cart->is_active ? $cart : null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AlterChannelsCategoryTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('channels', function (Blueprint $table) {
|
||||
$table->integer('root_category_id')->nullable()->unsigned();
|
||||
$table->foreign('root_category_id')->references('id')->on('categories')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -38,8 +38,6 @@ class ChannelController extends Controller
|
|||
*/
|
||||
public function __construct(Channel $channel)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->channel = $channel;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
@ -79,6 +77,7 @@ class ChannelController extends Controller
|
|||
'default_locale_id' => 'required',
|
||||
'currencies' => 'required|array|min:1',
|
||||
'base_currency_id' => 'required',
|
||||
'root_category_id' => 'required',
|
||||
'logo.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'favicon.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
|
@ -124,6 +123,7 @@ class ChannelController extends Controller
|
|||
'default_locale_id' => 'required',
|
||||
'currencies' => 'required|array|min:1',
|
||||
'base_currency_id' => 'required',
|
||||
'root_category_id' => 'required',
|
||||
'logo.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'favicon.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ class CurrencyController extends Controller
|
|||
*/
|
||||
public function __construct(Currency $currency)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->currency = $currency;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ class ExchangeRateController extends Controller
|
|||
*/
|
||||
public function __construct(ExchangeRate $exchangeRate, Currency $currency)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->exchangeRate = $exchangeRate;
|
||||
|
||||
$this->currency = $currency;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ class LocaleController extends Controller
|
|||
*/
|
||||
public function __construct(Locale $locale)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->locale = $locale;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ class SubscriptionController extends Controller
|
|||
|
||||
public function __construct(Subscribers $subscribers)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->subscribers = $subscribers;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Illuminate\Support\Facades\Storage;
|
||||
use Webkul\Core\Models\Locale;
|
||||
use Webkul\Core\Models\Currency;
|
||||
use Webkul\Category\Models\Category;
|
||||
use Webkul\Inventory\Models\InventorySource;
|
||||
|
||||
class Channel extends Model
|
||||
{
|
||||
protected $fillable = ['code', 'name', 'description', 'theme', 'home_page_content', 'footer_content', 'hostname', 'default_locale_id', 'base_currency_id'];
|
||||
protected $fillable = ['code', 'name', 'description', 'theme', 'home_page_content', 'footer_content', 'hostname', 'default_locale_id', 'base_currency_id', 'root_category_id'];
|
||||
|
||||
/**
|
||||
* Get the channel locales.
|
||||
|
|
@ -55,6 +56,14 @@ class Channel extends Model
|
|||
return $this->belongsTo(Currency::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base currency
|
||||
*/
|
||||
public function root_category()
|
||||
{
|
||||
return $this->belongsTo(Category::class, 'root_category_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logo image url.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ class ProductController extends Controller
|
|||
Product $product,
|
||||
ProductGrid $productGrid)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->attributeFamily = $attributeFamily;
|
||||
|
||||
$this->category = $category;
|
||||
|
|
@ -142,14 +140,8 @@ 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');
|
||||
|
||||
$product = $this->product->create(request()->all());
|
||||
|
||||
//after store of the product
|
||||
Event::fire('catalog.product.create.after', $product);
|
||||
|
||||
session()->flash('success', 'Product created successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect'], ['id' => $product->id]);
|
||||
|
|
@ -181,12 +173,8 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function update(ProductForm $request, $id)
|
||||
{
|
||||
Event::fire('catalog.product.update.before', $id);
|
||||
|
||||
$product = $this->product->update(request()->all(), $id);
|
||||
|
||||
Event::fire('catalog.product.update.after', $product);
|
||||
|
||||
session()->flash('success', 'Product updated successfully.');
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
|
@ -200,12 +188,8 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
Event::fire('catalog.product.delete.before', $id);
|
||||
|
||||
$this->product->delete($id);
|
||||
|
||||
Event::fire('catalog.product.delete.after', $id);
|
||||
|
||||
session()->flash('success', 'Product deleted successfully.');
|
||||
|
||||
return redirect()->back();
|
||||
|
|
@ -216,22 +200,12 @@ class ProductController extends Controller
|
|||
*
|
||||
* @return response
|
||||
*/
|
||||
public function massDestroy() {
|
||||
$data = request()->all();
|
||||
$productIds = explode(',', $data['indexes']);
|
||||
public function massDestroy()
|
||||
{
|
||||
$productIds = explode(',', request()->input('indexes'));
|
||||
|
||||
if(count($productIds)) {
|
||||
foreach($productIds as $productId) {
|
||||
$product = $this->product->find($productId);
|
||||
|
||||
if(!is_null($product)) {
|
||||
Event::fire('catalog.product.delete.before', $productId);
|
||||
|
||||
$product->delete();
|
||||
|
||||
Event::fire('catalog.product.delete.after', $productId);
|
||||
}
|
||||
}
|
||||
foreach ($productIds as $productId) {
|
||||
$this->product->delete($productId);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.catalog.products.mass-delete-success'));
|
||||
|
|
@ -244,36 +218,22 @@ class ProductController extends Controller
|
|||
*
|
||||
* @return response
|
||||
*/
|
||||
public function massUpdate() {
|
||||
public function massUpdate()
|
||||
{
|
||||
$data = request()->all();
|
||||
$attribute = 'status';
|
||||
|
||||
$productIds = explode(',', $data['indexes']);
|
||||
|
||||
if(!isset($data['massaction-type'])) {
|
||||
if (!isset($data['massaction-type'])) {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if(count($productIds)) {
|
||||
foreach($productIds as $productId) {
|
||||
$product = $this->product->find($productId);
|
||||
$productIds = explode(',', $data['indexes']);
|
||||
|
||||
if($data['update-options'] == 0 && $data['selected-option-text'] == 'In Active') {
|
||||
Event::fire('catelog.product.update.before', $productId);
|
||||
|
||||
$result = $this->product->updateAttribute($product, $attribute, $data['update-options']);
|
||||
|
||||
if($result)
|
||||
Event::fire('catelog.product.update.after', $product);
|
||||
} else if($data['update-options'] == 1 && $data['selected-option-text'] == 'Active') {
|
||||
Event::fire('catelog.product.update.before', $productId);
|
||||
|
||||
$result = $this->product->updateAttribute($product, $attribute, $data['update-options']);
|
||||
|
||||
if($result)
|
||||
Event::fire('product.update.after', $product);
|
||||
}
|
||||
}
|
||||
foreach ($productIds as $productId) {
|
||||
$this->product->update([
|
||||
'channel' => null,
|
||||
'locale' => null,
|
||||
'status' => $data['update-options']
|
||||
], $productId);
|
||||
}
|
||||
|
||||
session()->flash('success', trans('admin::app.catalog.products.mass-update-success'));
|
||||
|
|
@ -284,7 +244,8 @@ class ProductController extends Controller
|
|||
/*
|
||||
* To be manually invoked when data is seeded into products
|
||||
*/
|
||||
public function sync() {
|
||||
public function sync()
|
||||
{
|
||||
Event::fire('products.datagrid.sync', true);
|
||||
|
||||
return redirect()->route('admin.catalog.products.index');
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Product\Repositories;
|
||||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||
|
|
@ -111,6 +112,9 @@ class ProductRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
//before store of the product
|
||||
Event::fire('catalog.product.create.before');
|
||||
|
||||
$product = $this->model->create($data);
|
||||
|
||||
$nameAttribute = $this->attribute->findOneByField('code', 'status');
|
||||
|
|
@ -137,6 +141,10 @@ class ProductRepository extends Repository
|
|||
}
|
||||
}
|
||||
|
||||
//after store of the product
|
||||
Event::fire('catalog.product.create.after', $product);
|
||||
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
|
|
@ -148,6 +156,8 @@ class ProductRepository extends Repository
|
|||
*/
|
||||
public function update(array $data, $id, $attribute = "id")
|
||||
{
|
||||
Event::fire('catalog.product.update.before', $id);
|
||||
|
||||
$product = $this->find($id);
|
||||
|
||||
if($product->parent_id && $this->checkVariantOptionAvailabiliy($data, $product)) {
|
||||
|
|
@ -221,9 +231,24 @@ class ProductRepository extends Repository
|
|||
|
||||
$this->productImage->uploadImages($data, $product);
|
||||
|
||||
Event::fire('catalog.product.update.after', $product);
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
Event::fire('catalog.product.delete.before', $id);
|
||||
|
||||
parent::delete($id);
|
||||
|
||||
Event::fire('catalog.product.delete.after', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $product
|
||||
* @param array $permutation
|
||||
|
|
@ -350,29 +375,6 @@ class ProductRepository extends Repository
|
|||
return $variant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change an attribute's value of the product
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function updateAttribute($product, $attribute, $value) {
|
||||
$attribute = $this->attribute->findOneByField('code', 'status');
|
||||
|
||||
$attributeValue = $this->attributeValue->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'attribute_id' => $attribute->id,
|
||||
]);
|
||||
|
||||
$result = $this->attributeValue->update([
|
||||
ProductAttributeValue::$attributeTypeFields[$attribute->type] => $value
|
||||
], $attributeValue->id);
|
||||
|
||||
if($result)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param mixed $product
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js?id=dc2ea56a854d779e7089",
|
||||
"/css/shop.css": "/css/shop.css?id=7aa91d217344fc8f4f53"
|
||||
"/css/shop.css": "/css/shop.css?id=d5e0d64663045e5aa78b"
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ class CategoryComposer
|
|||
{
|
||||
$categories = [];
|
||||
|
||||
foreach ($this->category->getVisibleCategoryTree() as $category) {
|
||||
foreach ($this->category->getVisibleCategoryTree(core()->getCurrentChannel()->root_category_id) as $category) {
|
||||
if($category->slug)
|
||||
array_push($categories, $category);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,6 +328,10 @@ input {
|
|||
.account-items-list {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
.grid-container {
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
//no search results
|
||||
.search-result-status {
|
||||
|
|
@ -1770,8 +1774,6 @@ section.product-detail {
|
|||
|
||||
.description {
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 15px;
|
||||
border-bottom: solid 1px rgba(162, 162, 162, 0.2);
|
||||
|
||||
ul {
|
||||
padding-left: 40px;
|
||||
|
|
@ -1779,6 +1781,11 @@ section.product-detail {
|
|||
}
|
||||
}
|
||||
|
||||
.quantity {
|
||||
padding-top: 15px;
|
||||
border-top: solid 1px rgba(162, 162, 162, 0.2);
|
||||
}
|
||||
|
||||
.full-description {
|
||||
ul {
|
||||
padding-left: 40px;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
{{ __('shop::app.customer.forgot-password.page_title') }}
|
||||
@stop
|
||||
|
||||
@section('css')
|
||||
@push('css')
|
||||
<style>
|
||||
.button-group {
|
||||
margin-bottom: 25px;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
@stop
|
||||
@endpush
|
||||
|
||||
@section('content-wrapper')
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<meta name="description" content="{{ core()->getCurrentChannel()->description }}"/>
|
||||
@show
|
||||
|
||||
@yield('css')
|
||||
@stack('css')
|
||||
|
||||
{!! view_render_event('bagisto.shop.layout.head') !!}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
@section('seo')
|
||||
<meta name="description" content="{{ $category->meta_description }}"/>
|
||||
<meta name="description" content="{{ $category->meta_keywords }}"/>
|
||||
<meta name="keywords" content="{{ $category->meta_keywords }}"/>
|
||||
@stop
|
||||
|
||||
@section('content-wrapper')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
@section('seo')
|
||||
<meta name="description" content="{{ trim($product->meta_description) != "" ? $product->meta_description : str_limit(strip_tags($product->description), 120, '') }}"/>
|
||||
<meta name="description" content="{{ $product->meta_keywords }}"/>
|
||||
<meta name="keywords" content="{{ $product->meta_keywords }}"/>
|
||||
@stop
|
||||
|
||||
@section('content-wrapper')
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ class TaxCategoryController extends Controller
|
|||
TaxMap $taxMap
|
||||
)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->taxCategory = $taxCategory;
|
||||
|
||||
$this->taxRate = $taxRate;
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ class TaxRateController extends Controller
|
|||
*/
|
||||
public function __construct(TaxRate $taxRate)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->taxRate = $taxRate;
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Icon-star</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Icon-star" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon id="Star" fill="#0031F0" points="11.0839804 15.75 6.08780574 18.3766445 7.04199019 12.8133222 3 8.87335555 8.58589307 8.06167777 11.0839804 3 13.5820677 8.06167777 19.1679608 8.87335555 15.1259706 12.8133222 16.080155 18.3766445"></polygon>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 711 B |
|
|
@ -298,3 +298,10 @@
|
|||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
|
||||
.star-blue-icon {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
background-image: url("../images/Icon-star.svg");
|
||||
}
|
||||
|
|
@ -29,8 +29,6 @@ class AccountController extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ class UserController extends Controller
|
|||
*/
|
||||
public function __construct(Admin $admin, Role $role)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->admin = $admin;
|
||||
|
||||
$this->role = $role;
|
||||
|
|
|
|||
Loading…
Reference in New Issue