From 6a5be61d39ce1eb88d404bcd7d9d175854ceb34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Sch=C3=B6ne?= Date: Thu, 31 Oct 2024 07:56:34 +0100 Subject: [PATCH] Add user group access rights --- Classes/Domain/Model/Product/Product.php | 12 +++++++ ...tproducts_domain_model_product_product.php | 34 +++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Model/Product/Product.php b/Classes/Domain/Model/Product/Product.php index 4b3f6244..e828aacd 100644 --- a/Classes/Domain/Model/Product/Product.php +++ b/Classes/Domain/Model/Product/Product.php @@ -44,6 +44,8 @@ class Product extends AbstractProduct protected bool $isNetPrice = false; protected float $price = 0.0; + + protected $feGroup = ''; /** * @var ObjectStorage @@ -467,4 +469,14 @@ public function getMinPrice(): float return $minPrice; } + + public function getFeGroup(): string + { + return $this->feGroup; + } + + public function setFeGroup($feGroup): void + { + $this->feGroup = $feGroup; + } } diff --git a/Configuration/TCA/tx_cartproducts_domain_model_product_product.php b/Configuration/TCA/tx_cartproducts_domain_model_product_product.php index 95db9859..75967db9 100644 --- a/Configuration/TCA/tx_cartproducts_domain_model_product_product.php +++ b/Configuration/TCA/tx_cartproducts_domain_model_product_product.php @@ -29,6 +29,7 @@ 'disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime', + 'fe_group' => 'fe_group', ], 'searchFields' => 'sku,title,teaser,description,price,', 'iconfile' => 'EXT:cart_products/Resources/Public/Icons/tx_cartproducts_domain_model_product_product.svg', @@ -73,7 +74,11 @@ 'showitem' => 'hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:hidden_formlabel', ], 'access' => [ - 'showitem' => 'starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel', + 'showitem' => ' + starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, + endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel, + --linebreak--, + fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel,', ], 'be_variant_attributes' => [ 'showitem' => 'be_variant_attribute1, be_variant_attribute2, be_variant_attribute3, --linebreak--, be_variants', @@ -163,7 +168,32 @@ ], ], ], - + 'fe_group' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.fe_group', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectMultipleSideBySide', + 'size' => 5, + 'maxitems' => 20, + 'items' => [ + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login', + 'value' => -1, + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login', + 'value' => -2, + ], + [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups', + 'value' => '--div--', + ], + ], + 'exclusiveKeys' => '-1,-2', + 'foreign_table' => 'fe_groups', + ], + ], 'product_type' => [ 'exclude' => 1, 'label' => $_LLL . ':tx_cartproducts_domain_model_product_product.product_type',