subscribtion category variants / system category variants

This commit is contained in:
2025-11-04 01:50:05 -08:00
parent 868f9dbcce
commit a471be8ff9
13 changed files with 254 additions and 12 deletions

View File

@@ -2,11 +2,30 @@
/**
* @var array $productCategories
* @var array $products
* @var \CakeProducts\Model\Entity\ProductCategoryVariant|\Cake\Datasource\EntityInterface $productCategoryVariant
*/
echo $this->Form->control('name');
echo $this->Form->control('product_category_id', ['options' => $productCategories, 'empty' => true]);
echo $this->Form->control('product_id', ['options' => $products, 'empty' => true]);
echo $this->Form->control('enabled');
$nameOptions = [];
$categoryOptions = ['options' => $productCategories, 'empty' => true];
$enabledOptions = [];
if ($productCategoryVariant->is_system_variant) {
$nameOptions = [
'disabled' => true,
'readonly' => true,
];
$categoryOptions = $categoryOptions + [
'disabled' => true,
'readonly' => true,
];
$enabledOptions = [
'disabled' => true,
'readonly' => true,
];
}
echo $this->Form->control('name', $nameOptions);
echo $this->Form->control('product_category_id', $categoryOptions);
echo $this->Form->control('enabled', $enabledOptions);
?>
<legend><?= __('Variant Options') . '<small class="ms-2">' . $this->Html->link('Add Option', '#', [
'id' => 'add-option-button',