select options for products + skus, photos form

This commit is contained in:
2025-10-12 02:20:02 -07:00
parent 30aad1dea4
commit 9f1959a0ee
7 changed files with 102 additions and 8 deletions

View File

@@ -197,4 +197,22 @@ class ProductsController extends AppController
return $this->redirect(['action' => 'index']);
}
/**
* @return \Cake\Http\Response|null|void Renders view
*/
public function select()
{
$productsTable = $this->getTable();
$productCategory = $productsTable->ProductCategories->find()
->where(['id' => $this->request->getQuery('product_category_id', '-1')])
->first();
$products = $productsTable
->find('list')
->where(['product_category_id' => $productCategory->internal_id ?? '-1'])
->orderBy(['Products.name'])
->toArray();
$this->set(compact('products'));
}
}