wip first not first or fail attributes form
This commit is contained in:
@@ -167,6 +167,9 @@ class ProductCategoryAttributesController extends AppController
|
|||||||
return $this->redirect(['action' => 'index']);
|
return $this->redirect(['action' => 'index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function form()
|
public function form()
|
||||||
{
|
{
|
||||||
$productCategoryAttributes = $this->getTable()->getAllCategoryAttributesForCategoryId($this->request->getQuery('product_category_id', '-1'));
|
$productCategoryAttributes = $this->getTable()->getAllCategoryAttributesForCategoryId($this->request->getQuery('product_category_id', '-1'));
|
||||||
|
|||||||
@@ -113,8 +113,11 @@ class ProductCategoryAttributesTable extends Table
|
|||||||
|
|
||||||
public function getAllCategoryAttributesForCategoryId(string $internalCategoryId)
|
public function getAllCategoryAttributesForCategoryId(string $internalCategoryId)
|
||||||
{
|
{
|
||||||
$category = $this->ProductCategories->find()->where(['internal_id' => $internalCategoryId])->firstOrFail();
|
$category = $this->ProductCategories->find()->where(['internal_id' => $internalCategoryId])->first();
|
||||||
$categories = $this->ProductCategories->find('path', for: $category->id)->all();
|
$categories = [];
|
||||||
|
if ($category) {
|
||||||
|
$categories = $this->ProductCategories->find('path', for: $category->id)->all();
|
||||||
|
}
|
||||||
|
|
||||||
return $categories;
|
return $categories;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user