remove variant type id (enum) from variants table, use internal id for category field on variants form

This commit is contained in:
2025-06-30 21:25:47 -07:00
parent 5fb215c7fd
commit c9d34f7115
8 changed files with 10 additions and 52 deletions

View File

@@ -74,7 +74,7 @@ class ProductCategoryVariantsController extends AppController
}
$this->Flash->error(__('The product category variant could not be saved. Please, try again.'));
}
$productCategories = $productCategoryVariantsTable->ProductCategories->find('list')->all();
$productCategories = $productCategoryVariantsTable->ProductCategories->find('list', keyField: 'internal_id', valueField: 'name')->all();
$products = $productCategoryVariantsTable->Products->find('list')->all();
$this->set(compact('productCategoryVariant', 'productCategories', 'products'));
}
@@ -99,8 +99,8 @@ class ProductCategoryVariantsController extends AppController
}
$this->Flash->error(__('The product category variant could not be saved. Please, try again.'));
}
$productCategories = $productCategoryVariantsTable->ProductCategories->find('list', limit: 200)->all();
$products = $productCategoryVariantsTable->Products->find('list', limit: 200)->all();
$productCategories = $productCategoryVariantsTable->ProductCategories->find('list', keyField: 'internal_id', valueField: 'name')->all();
$products = $productCategoryVariantsTable->Products->find('list', limit: 200)->where(['product_category_id' => $productCategoryVariant->product_category_id])->all();
$this->set(compact('productCategoryVariant', 'productCategories', 'products'));
}