2025-04-15 09:39:35 +00:00
|
|
|
<?php
|
2025-09-05 09:51:43 +00:00
|
|
|
|
|
|
|
use function BenTools\CartesianProduct\combinations;
|
|
|
|
|
2025-04-15 09:39:35 +00:00
|
|
|
/**
|
|
|
|
* @var \App\View\AppView $this
|
2025-09-05 09:51:43 +00:00
|
|
|
* @var \App\Model\Entity\ProductSku $productSku
|
|
|
|
* @var \Cake\Collection\CollectionInterface|string[] $products
|
2025-04-15 09:39:35 +00:00
|
|
|
*/
|
2025-09-05 09:51:43 +00:00
|
|
|
|
|
|
|
|
2025-04-15 09:39:35 +00:00
|
|
|
?>
|
|
|
|
<div class="row">
|
|
|
|
<aside class="column">
|
|
|
|
<div class="side-nav">
|
|
|
|
<h4 class="heading"><?= __('Actions') ?></h4>
|
2025-09-05 09:51:43 +00:00
|
|
|
<?= $this->Html->link(__('List Product SKUs'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
|
2025-04-15 09:39:35 +00:00
|
|
|
</div>
|
|
|
|
</aside>
|
|
|
|
<div class="column column-80">
|
|
|
|
<div class="productSkus form content">
|
2025-09-05 09:51:43 +00:00
|
|
|
<?= $this->Form->create($productSkus) ?>
|
2025-04-15 09:39:35 +00:00
|
|
|
<fieldset>
|
2025-09-05 09:51:43 +00:00
|
|
|
<legend><?= __('Add Product Skus') ?></legend>
|
|
|
|
<div id="product-skus-container" class="container">
|
|
|
|
<table class="table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>SKU</th>
|
|
|
|
<th>Barcode</th>
|
|
|
|
<th>Price</th>
|
|
|
|
<th>Cost</th>
|
|
|
|
<?php
|
|
|
|
$cnt = 0;
|
|
|
|
foreach ($variantNameMapping as $singleVariantName) : ?>
|
|
|
|
<th><?= $singleVariantName; ?></th>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
<th>Add?</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
$cnt = 0;
|
|
|
|
$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->hidden('skus.' . $cnt . '.variants.' . $singleVariantId, ['value' => $combination[$singleVariantId] ?? null]); ?>
|
|
|
|
<?= $optionMapping[$combination[$singleVariantId]]; ?>
|
|
|
|
</td>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
<td><?= $this->Form->control('add', ['label' => false, 'type' => 'checkbox', 'checked' => true]); ?></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
$cnt++;
|
|
|
|
endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2025-04-15 09:39:35 +00:00
|
|
|
</fieldset>
|
|
|
|
<?= $this->Form->button(__('Submit')) ?>
|
|
|
|
<?= $this->Form->end() ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|