select options for products + skus, photos form
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user