block the copying of products with the type 'booking'
This commit is contained in:
parent
4d9bbc138f
commit
d66dca2b13
|
|
@ -1203,17 +1203,19 @@ return [
|
|||
],
|
||||
|
||||
'response' => [
|
||||
'being-used' => ':source في :name يتم استخدام هذا المورد',
|
||||
'cannot-delete-default' => 'لا يمكن حذف القناة الافتراضية',
|
||||
'create-success' => 'إنشاء الاسم بنجاح:name',
|
||||
'update-success' => 'تحديث الاسم بنجاح :name ',
|
||||
'delete-success' => 'حذف الاسم بنجاح :name',
|
||||
'delete-failed' => ':name حدث خطأ أثناء حذف',
|
||||
'last-delete-error' => 'مطلوب name: واحد على الأقل',
|
||||
'user-define-error' => 'لا يستطيع حذف نظام :name',
|
||||
'attribute-error' => 'في المنتجات القابلة للتكوين :name يستخدم ' ,
|
||||
'attribute-product-error' => 'في المنتجات :name يستخدم ' ,
|
||||
'customer-associate' => 'لا يمكن حذف :name لأن العميل مرتبط بهذه المجموعة.',
|
||||
'being-used' => ':source في :name يتم استخدام هذا المورد',
|
||||
'product-copied' => 'تم نسخ المنتج',
|
||||
'booking-can-not-be-copied' => 'لا يمكن نسخ منتجات الحجز',
|
||||
'cannot-delete-default' => 'لا يمكن حذف القناة الافتراضية',
|
||||
'create-success' => 'إنشاء الاسم بنجاح:name',
|
||||
'update-success' => 'تحديث الاسم بنجاح :name ',
|
||||
'delete-success' => 'حذف الاسم بنجاح :name',
|
||||
'delete-failed' => ':name حدث خطأ أثناء حذف',
|
||||
'last-delete-error' => 'مطلوب name: واحد على الأقل',
|
||||
'user-define-error' => 'لا يستطيع حذف نظام :name',
|
||||
'attribute-error' => 'في المنتجات القابلة للتكوين :name يستخدم ',
|
||||
'attribute-product-error' => 'في المنتجات :name يستخدم ',
|
||||
'customer-associate' => 'لا يمكن حذف :name لأن العميل مرتبط بهذه المجموعة.',
|
||||
'currency-delete-error' => 'يتم تعيين هذه العملة كعملة أساسية القناة لذلك لا يمكن حذفها.',
|
||||
'upload-success' => 'بنجاح :name تم تحميل',
|
||||
'delete-category-root' => 'لا يستطيع حذف الجذر الفئة',
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1202,17 +1202,19 @@ return [
|
|||
],
|
||||
|
||||
'response' => [
|
||||
'being-used' => 'This resource :name is getting used in :source',
|
||||
'cannot-delete-default' => 'Cannot delete the default channel',
|
||||
'create-success' => ':name created successfully.',
|
||||
'update-success' => ':name updated successfully.',
|
||||
'delete-success' => ':name deleted successfully.',
|
||||
'delete-failed' => 'Error encountered while deleting :name.',
|
||||
'last-delete-error' => 'At least one :name is required.',
|
||||
'user-define-error' => 'Can not delete system :name',
|
||||
'attribute-error' => ':name is used in configurable products.',
|
||||
'attribute-product-error' => ':name is used in products.',
|
||||
'customer-associate' => ':name can not be deleted because customer is associated with this group.',
|
||||
'being-used' => 'This resource :name is getting used in :source',
|
||||
'product-copied' => 'The Product has been copied',
|
||||
'booking-can-not-be-copied' => 'Booking Products can not be copied .',
|
||||
'cannot-delete-default' => 'Cannot delete the default channel',
|
||||
'create-success' => ':name created successfully.',
|
||||
'update-success' => ':name updated successfully.',
|
||||
'delete-success' => ':name deleted successfully.',
|
||||
'delete-failed' => 'Error encountered while deleting :name.',
|
||||
'last-delete-error' => 'At least one :name is required.',
|
||||
'user-define-error' => 'Can not delete system :name',
|
||||
'attribute-error' => ':name is used in configurable products.',
|
||||
'attribute-product-error' => ':name is used in products.',
|
||||
'customer-associate' => ':name can not be deleted because customer is associated with this group.',
|
||||
'currency-delete-error' => 'This currency is set as channel base currency so it can not be deleted.',
|
||||
'upload-success' => ':name uploaded successfully.',
|
||||
'delete-category-root' => 'Cannot delete the root category',
|
||||
|
|
|
|||
|
|
@ -249,6 +249,8 @@ class ProductController extends Controller
|
|||
{
|
||||
$copiedProduct = $this->productRepository->copy($productId);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.product-copied'));
|
||||
|
||||
return redirect()->to(route('admin.catalog.products.edit', ['id' => $copiedProduct->id]));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ class Product extends Model implements ProductContract
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the product variants that owns the product.
|
||||
* Get the product flat entries that are associated with product.
|
||||
* May be one for each locale and each channel.
|
||||
*/
|
||||
public function product_flats()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Webkul\Product\Repositories;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Product\Models\Product;
|
||||
use Illuminate\Pagination\Paginator;
|
||||
|
|
@ -477,6 +478,10 @@ class ProductRepository extends Repository
|
|||
{
|
||||
$originalProduct = $this->loadOriginalProduct($sourceProductId);
|
||||
|
||||
if ($originalProduct->type === 'booking') {
|
||||
throw new Exception(trans('admin::app.response.booking-can-not-be-copied'));
|
||||
}
|
||||
|
||||
$copiedProduct = $this->persistCopiedProduct($originalProduct);
|
||||
|
||||
$this->persistAttributeValues($originalProduct, $copiedProduct);
|
||||
|
|
@ -656,5 +661,11 @@ class ProductRepository extends Repository
|
|||
$copiedProduct->images()->save($image);
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($attributesToSkip['variants'])) {
|
||||
foreach ($originalProduct->variants as $variant) {
|
||||
$this->copy($variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue