Merge branch 'master' of https://github.com/bagisto/bagisto
This commit is contained in:
commit
161fb5853c
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
return array (
|
||||
'save' => 'Speichern',
|
||||
'copy-of' => 'Kopie von',
|
||||
'create' => 'Erstellen',
|
||||
'update' => 'Update',
|
||||
'delete' => 'Löschen',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
return [
|
||||
'save' => 'Save',
|
||||
'copy-of' => 'Copy of',
|
||||
'create' => 'Create',
|
||||
'update' => 'Update',
|
||||
'delete' => 'Delete',
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@
|
|||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="getOptionValidation(row, '{{ $locale->code }}')" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as=""{{ $locale->name . ' (' . $locale->code . ')' }}""/>
|
||||
<input type="text" v-validate="getOptionValidation(row, '{{ $locale->code }}')" v-model="row['locales']['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as=""{{ $locale->name . ' (' . $locale->code . ')' }}""/>
|
||||
<span class="control-error" v-if="errors.has(localeInputName(row, '{{ $locale->code }}'))">@{{ errors.first(localeInputName(row, '{!! $locale->code !!}')) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -383,10 +383,10 @@
|
|||
addOptionRow: function (isNullOptionRow) {
|
||||
const rowCount = this.optionRowCount++;
|
||||
const id = 'option_' + rowCount;
|
||||
let row = {'id': id};
|
||||
let row = {'id': id, 'locales': {}};
|
||||
|
||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
||||
row['{{ $locale->code }}'] = '';
|
||||
row['locales']['{{ $locale->code }}'] = '';
|
||||
@endforeach
|
||||
|
||||
row['notRequired'] = '';
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@
|
|||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
||||
<td>
|
||||
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
|
||||
<input type="text" v-validate="getOptionValidation(row, '{{ $locale->code }}')" v-model="row['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as=""{{ $locale->name . ' (' . $locale->code . ')' }}""/>
|
||||
<input type="text" v-validate="getOptionValidation(row, '{{ $locale->code }}')" v-model="row['locales']['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as=""{{ $locale->name . ' (' . $locale->code . ')' }}""/>
|
||||
<span class="control-error" v-if="errors.has(localeInputName(row, '{{ $locale->code }}'))">@{{ errors.first(localeInputName(row, '{!! $locale->code !!}')) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -434,7 +434,8 @@
|
|||
'sort_order': @json($option->sort_order),
|
||||
'swatch_value': @json($option->swatch_value),
|
||||
'swatch_value_url': @json($option->swatch_value_url),
|
||||
'notRequired': ''
|
||||
'notRequired': '',
|
||||
'locales': {}
|
||||
};
|
||||
|
||||
@if (empty($option->label))
|
||||
|
|
@ -444,7 +445,7 @@
|
|||
@endif
|
||||
|
||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
||||
row['{{ $locale->code }}'] = @json($option->translate($locale->code)['label'] ?? '');
|
||||
row['locales']['{{ $locale->code }}'] = @json($option->translate($locale->code)['label'] ?? '');
|
||||
@endforeach
|
||||
|
||||
this.optionRows.push(row);
|
||||
|
|
@ -465,10 +466,10 @@
|
|||
addOptionRow: function (isNullOptionRow) {
|
||||
const rowCount = this.optionRowCount++;
|
||||
const id = 'option_' + rowCount;
|
||||
let row = {'id': id};
|
||||
let row = {'id': id, 'locales': {}};
|
||||
|
||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
||||
row['{{ $locale->code }}'] = '';
|
||||
row['locales']['{{ $locale->code }}'] = '';
|
||||
@endforeach
|
||||
|
||||
row['notRequired'] = '';
|
||||
|
|
|
|||
|
|
@ -118,10 +118,10 @@
|
|||
height: 200,
|
||||
width: "100%",
|
||||
plugins: 'image imagetools media wordcount save fullscreen code table lists link hr',
|
||||
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor alignleft aligncenter alignright alignjustif| link hr |numlist bullist outdent indent | removeformat | code | table',
|
||||
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify | link hr |numlist bullist outdent indent | removeformat | code | table',
|
||||
image_advtab: true,
|
||||
valid_elements : '*[*]'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endpush
|
||||
|
|
|
|||
|
|
@ -85,10 +85,21 @@ class CartRuleController extends Controller
|
|||
|
||||
$copiedCartRule = $originalCartRule
|
||||
->replicate()
|
||||
->fill(['status' => 0]);
|
||||
->fill([
|
||||
'status' => 0,
|
||||
'name' => __('admin::app.copy-of') . ' ' . $originalCartRule->name,
|
||||
]);
|
||||
|
||||
$copiedCartRule->save();
|
||||
|
||||
foreach ($copiedCartRule->channels as $channel) {
|
||||
$copiedCartRule->channels()->save($channel);
|
||||
}
|
||||
|
||||
foreach ($copiedCartRule->customer_groups as $group) {
|
||||
$copiedCartRule->customer_groups()->save($group);
|
||||
}
|
||||
|
||||
return view($this->_config['view'], [
|
||||
'cartRule' => $copiedCartRule,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class CreateProductCustomerGroupPricesTable extends Migration
|
|||
$table->integer('product_id')->unsigned();
|
||||
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
|
||||
|
||||
$table->integer('customer_group_id')->nullble()->unsigned();
|
||||
$table->integer('customer_group_id')->unsigned()->nullable();
|
||||
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,14 +18,15 @@ class SearchRepository extends Repository
|
|||
/**
|
||||
* Create a new repository instance.
|
||||
*
|
||||
* @param Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
* @param \Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
* @param \Illuminate\Container\Container $app
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
ProductRepository $productRepository,
|
||||
App $app
|
||||
)
|
||||
{
|
||||
) {
|
||||
parent::__construct($app);
|
||||
|
||||
$this->productRepository = $productRepository;
|
||||
|
|
@ -38,8 +39,6 @@ class SearchRepository extends Repository
|
|||
|
||||
public function search($data)
|
||||
{
|
||||
$products = $this->productRepository->searchProductByAttribute($data['term']);
|
||||
|
||||
return $products;
|
||||
return $this->productRepository->searchProductByAttribute($data['term'] ?? '');
|
||||
}
|
||||
}
|
||||
|
|
@ -605,8 +605,8 @@ abstract class AbstractType
|
|||
}
|
||||
|
||||
if ($price->value < $lastPrice) {
|
||||
if ($price->value_type == 'percentage') {
|
||||
$lastPrice = $product->price * ($price->value / 100);
|
||||
if ($price->value_type == 'discount') {
|
||||
$lastPrice = $product->price - ($product->price * $price->value) / 100;
|
||||
} else {
|
||||
$lastPrice = $price->value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class Bundle extends AbstractType
|
|||
ProductRepository $productRepository,
|
||||
ProductAttributeValueRepository $attributeValueRepository,
|
||||
ProductInventoryRepository $productInventoryRepository,
|
||||
productImageRepository $productImageRepository,
|
||||
ProductImageRepository $productImageRepository,
|
||||
ProductBundleOptionRepository $productBundleOptionRepository,
|
||||
ProductBundleOptionProductRepository $productBundleOptionProductRepository,
|
||||
ProductImage $productImageHelper,
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class ProductRepository extends Repository
|
|||
*/
|
||||
public function searchProductsFromCategory($params)
|
||||
{
|
||||
$term = $params['term'];
|
||||
$term = $params['term'] ?? '';
|
||||
$categoryId = $params['category'];
|
||||
|
||||
$results = app(ProductFlatRepository::class)->scopeQuery(function($query) use($term, $categoryId, $params) {
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
@section('title', __('Service Unavailable'))
|
||||
@section('code', '503')
|
||||
@section('message', __($exception->getMessage() ?: 'Service Unavailable'))
|
||||
@section('message', __($exception->getMessage() ?: 'Srvice Unavailable'))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Tests\Functional\CartRule;
|
||||
|
||||
use FunctionalTester;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\CartRule\Models\CartRule;
|
||||
|
||||
class CartRuleCopyCest
|
||||
|
|
@ -16,19 +17,44 @@ class CartRuleCopyCest
|
|||
'status' => 1,
|
||||
]);
|
||||
|
||||
$count = count(cartRule::all());
|
||||
DB::table('cart_rule_channels')->insert([
|
||||
'cart_rule_id' => $original->id,
|
||||
'channel_id' => 1,
|
||||
]);
|
||||
|
||||
DB::table('cart_rule_customer_groups')->insert([
|
||||
'cart_rule_id' => $original->id,
|
||||
'customer_group_id' => 1,
|
||||
]);
|
||||
|
||||
$count = count(CartRule::all());
|
||||
|
||||
$I->amOnAdminRoute('admin.cart-rules.copy', ['id' => $original->id]);
|
||||
|
||||
$I->seeRecord(CartRule::class, [
|
||||
'id' => $original->id + 1,
|
||||
'status' => 0,
|
||||
'name' => $original->name,
|
||||
'name' => 'Copy of ' . $original->name,
|
||||
]);
|
||||
|
||||
$I->assertCount($count + 1, CartRule::all());
|
||||
|
||||
$I->assertEquals(
|
||||
DB::table('cart_rule_channels')
|
||||
->pluck('cart_rule_id', 'channel_id')
|
||||
->toArray(),
|
||||
[1 => $original->id + 1]
|
||||
);
|
||||
|
||||
$I->assertEquals(
|
||||
DB::table('cart_rule_customer_groups')
|
||||
->pluck('cart_rule_id', 'customer_group_id')
|
||||
->toArray(),
|
||||
[1 => $original->id + 1]
|
||||
);
|
||||
|
||||
$I->seeResponseCodeIsSuccessful();
|
||||
|
||||
$I->seeCurrentRouteIs('admin.cart-rules.copy');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue