attributes form wip

This commit is contained in:
2025-04-02 01:27:25 -07:00
parent 732819ff73
commit 2f80ba1fa3
4 changed files with 48 additions and 70 deletions

View File

@@ -114,11 +114,16 @@ class ProductCategoryAttributesTable extends Table
public function getAllCategoryAttributesForCategoryId(string $internalCategoryId)
{
$category = $this->ProductCategories->find()->where(['internal_id' => $internalCategoryId])->first();
$categories = [];
if ($category) {
$categories = $this->ProductCategories->find('path', for: $category->id)->all();
}
return $categories;
$this->ProductCategories->behaviors()->get('Tree')->setConfig([
'scope' => [
'product_catalog_id' => $category->product_catalog_id ?? 1,
],
]);
return $category ? $this->ProductCategories
->find('path', for: $category->id)
->contain(['ProductCategoryAttributes', 'ProductCategoryAttributes.ProductCategoryAttributeOptions'])
->toArray() : [];
}
}