Basic Info
Form->control('name');
echo $this->Form->control('product_catalog_id', [
'empty' => 'Select a Catalog',
'options' => $productCatalogs,
'hx-trigger' => 'change, load delay:500ms',
'hx-get' => $this->Url->build([
'controller' => 'ProductCategories',
'action' => 'select',
'?' => ['form' => 'product'],
0 => $productCategory ? $productCategory->product_catalog_id : '',
]),
'hx-target' => '#product_category_id',
]);
echo $this->Form->control('product_category_id', [
'options' => [],
'empty' => true,
'id' => 'product_category_id',
'hx-trigger' => 'change, load delay:1s',
'hx-get' => $this->Url->build([
'controller' => 'ProductCategoryAttributes',
'action' => 'form',
'?' => ['form' => 'product'],
0 => $productCategory ? $productCategory->product_catalog_id : '',
]),
'hx-target' => '#product-attributes-container',
]);
echo $this->Form->control('product_type_id');
?>
Product Attributes
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"
>
hasValue('product_attributes')) : ?>
product_attributes as $productAttribute) {
$prefix = 'product_attributes.' . $cnt . '.';
echo $this->element('ProductCategoryAttributes/product_form', [
'productCategoryAttribute' => $productAttribute->hasValue('product_category_attribute') ? $productAttribute->product_category_attribute : null,
'productAttribute' => $productAttribute,
'cnt' => $cnt,
]);
$cnt++;
} ?>