variant options coming along - add test passing

This commit is contained in:
2025-07-05 20:48:40 -07:00
parent 5adc791c20
commit 59a38758e9
11 changed files with 110 additions and 24 deletions

View File

@@ -0,0 +1,20 @@
<?php
use App\View\AppView;
use Cake\Datasource\EntityInterface;
/**
* @var AppView $this
* @var EntityInterface $productCategoryAttributeOption
*/
$this->setLayout('ajax');
$prefix = $prefix ?? '';
if ($this->request->getQuery('prefix') !== null) {
$prefix = 'product_category_variant_options.' . $this->request->getQuery('prefix') . '.';
}
echo '<hr class="my-2">';
echo $this->element('ProductCategoryVariants/product_category_variant_option_form', [
'prefix' => $prefix
]);
?>

View File

@@ -43,6 +43,34 @@
<td><?= $productCategoryVariant->enabled ? __('Yes') : __('No'); ?></td>
</tr>
</table>
<div class="related">
<h4><?= __('Related Product Category Variant Options') ?></h4>
<?php if (!empty($productCategoryVariant->product_category_variant_options)) : ?>
<div class="table-responsive">
<table>
<tr>
<th><?= __('Variant Value') ?></th>
<th><?= __('Variant Label') ?></th>
<th><?= __('Enabled') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
<?php foreach ($productCategoryVariant->product_category_variant_options as $productCategoryVariantOption) : ?>
<tr>
<td><?= h($productCategoryVariantOption->variant_value) ?></td>
<td><?= h($productCategoryVariantOption->variant_label) ?></td>
<td><?= h($productCategoryVariantOption->enabled) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['controller' => 'ProductCategoryVariantOptions', 'action' => 'view', $productCategoryVariantOption->id]) ?>
<?= $this->Html->link(__('Edit'), ['controller' => 'ProductCategoryVariantOptions', 'action' => 'edit', $productCategoryVariantOption->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['controller' => 'ProductCategoryVariantOptions', 'action' => 'delete', $productCategoryVariantOption->id], ['confirm' => __('Are you sure you want to delete # {0}?', $productCategoryVariantOption->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>

View File

@@ -8,15 +8,15 @@ $prefix = $prefix ?? '';
\Cake\Log\Log::debug('$prefix');
\Cake\Log\Log::debug($prefix);
?>
<div class="container product-category-attribute-options-container" data-test="1" data-prefix="<?= $prefix; ?>">
<div class="container product-category-variant-options-container" data-test="1" data-prefix="<?= $prefix; ?>">
<div class="row">
<div class="col">
<?= $this->Form->control($prefix . 'attribute_value', [
<?= $this->Form->control($prefix . 'variant_value', [
'label' => 'Value',
]); ?>
</div>
<div class="col">
<?= $this->Form->control($prefix . 'attribute_label', [
<?= $this->Form->control($prefix . 'variant_label', [
'label' => 'Label',
]); ?>
</div>