test fixes for product skus add
This commit is contained in:
@@ -4,8 +4,7 @@ use function BenTools\CartesianProduct\combinations;
|
||||
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\ProductSku $productSku
|
||||
* @var \Cake\Collection\CollectionInterface|string[] $products
|
||||
* @var \App\Model\Entity\ProductSku[] $productSkus
|
||||
*/
|
||||
|
||||
|
||||
@@ -26,6 +25,7 @@ use function BenTools\CartesianProduct\combinations;
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Add?</th>
|
||||
<th>SKU</th>
|
||||
<th>Barcode</th>
|
||||
<th>Price</th>
|
||||
@@ -35,7 +35,6 @@ use function BenTools\CartesianProduct\combinations;
|
||||
foreach ($variantNameMapping as $singleVariantName) : ?>
|
||||
<th><?= $singleVariantName; ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th>Add?</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -44,17 +43,22 @@ use function BenTools\CartesianProduct\combinations;
|
||||
$labelFalse = ['label' => false];
|
||||
foreach (combinations($toGetCartesianProductsFrom) as $c => $combination) : ?>
|
||||
<tr>
|
||||
<td><?= $this->Form->control('skus.' . $cnt . '.sku', $labelFalse); ?></td>
|
||||
<td><?= $this->Form->control('skus.' . $cnt . '.barcode', $labelFalse); ?></td>
|
||||
<td><?= $this->Form->control('skus.' . $cnt . '.price', $labelFalse); ?></td>
|
||||
<td><?= $this->Form->control('skus.' . $cnt . '.cost', $labelFalse); ?></td>
|
||||
<?php foreach ($variantNameMapping as $singleVariantId => $singleVariantName) : ?>
|
||||
<td><?= $this->Form->control($cnt . '.add', ['label' => false, 'type' => 'checkbox', 'checked' => true]); ?></td>
|
||||
<td><?= $this->Form->control($cnt . '.sku', $labelFalse); ?></td>
|
||||
<td><?= $this->Form->control($cnt . '.barcode', $labelFalse); ?></td>
|
||||
<td><?= $this->Form->control($cnt . '.price', $labelFalse); ?></td>
|
||||
<td><?= $this->Form->control($cnt . '.cost', $labelFalse); ?></td>
|
||||
<?php
|
||||
$variantCnt = 0;
|
||||
foreach ($variantNameMapping as $singleVariantId => $singleVariantName) : ?>
|
||||
<td>
|
||||
<?= $this->Form->hidden('skus.' . $cnt . '.variants.' . $singleVariantId, ['value' => $combination[$singleVariantId] ?? null]); ?>
|
||||
<?= $this->Form->hidden($cnt . '.product_skus_variant_values.' . $variantCnt . '.product_category_variant_id', ['value' => $singleVariantId ?? null]); ?>
|
||||
<?= $this->Form->hidden($cnt . '.product_skus_variant_values.' . $variantCnt . '.product_category_variant_option_id', ['value' => $combination[$singleVariantId] ?? null]); ?>
|
||||
<?= $optionMapping[$combination[$singleVariantId]]; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
<td><?= $this->Form->control('add', ['label' => false, 'type' => 'checkbox', 'checked' => true]); ?></td>
|
||||
<?php
|
||||
$variantCnt++;
|
||||
endforeach; ?>
|
||||
</tr>
|
||||
<?php
|
||||
$cnt++;
|
||||
|
||||
Reference in New Issue
Block a user