product attributes on edit product
This commit is contained in:
@@ -40,15 +40,32 @@ echo $this->Form->control('product_type_id');
|
||||
?>
|
||||
<hr>
|
||||
<h4 class="mb-4">Product Attributes</h4>
|
||||
<div id="product-attributes-container" class="container">
|
||||
<?php if (false && $product->hasValue('product_attributes')) : ?>
|
||||
<?php
|
||||
<div
|
||||
id="product-attributes-container"
|
||||
class="container"
|
||||
<?php if ($product->isNew()) : ?>
|
||||
|
||||
hx-get="<?= $this->Url->build([
|
||||
'controller' => 'ProductCategoryAttributes',
|
||||
'action' => 'form',
|
||||
]); ?>"
|
||||
hx-trigger="change target:#product_category_id from:body"
|
||||
hx-target="this"
|
||||
hx-include="#form, #product_category_id"
|
||||
hx-swap="innerHTML"
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php if ($product->hasValue('product_attributes')) : ?>
|
||||
<?php
|
||||
$cnt = 0;
|
||||
foreach ($product->product_attributes as $productAttribute) {
|
||||
$prefix = 'product_attributes.' . $cnt . '.';
|
||||
|
||||
echo '<hr class="my-2">';
|
||||
|
||||
echo $this->element('ProductCategoryAttributes/product_form', [
|
||||
'productCategoryAttribute' => $productAttribute->hasValue('product_category_attribute') ? $productAttribute->product_category_attribute : null,
|
||||
'productAttribute' => $productAttribute,
|
||||
'cnt' => $cnt,
|
||||
]);
|
||||
$cnt++;
|
||||
} ?>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user