category photos should be working
This commit is contained in:
@@ -45,7 +45,7 @@ class ProductPhotosController extends AppController
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$productPhoto = $this->getTable()->get($id, contain: ['Products', 'ProductSkus']);
|
||||
$productPhoto = $this->getTable()->get($id, contain: ['Products', 'ProductSkus', 'ProductCategories']);
|
||||
$this->set(compact('productPhoto'));
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ class ProductPhotosController extends AppController
|
||||
if (!file_exists($destination)) {
|
||||
throw new ForbiddenException('Failed to move the uploaded image to the appropriate folder. Please try again.');
|
||||
}
|
||||
$postData['product_category_id'] = $product->product_category_id ?? null;
|
||||
$postData['photo_dir'] = $path;
|
||||
$postData['photo_filename'] = $uuid;
|
||||
$productPhoto = $productPhotosTable->patchEntity($productPhoto, $postData);
|
||||
@@ -102,6 +103,8 @@ class ProductPhotosController extends AppController
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
dd($productPhoto->product_category_id);
|
||||
// dd(print_r($productPhoto->getErrors(), true));
|
||||
$this->Flash->error(__('The product photo could not be saved. Please, try again.'));
|
||||
}
|
||||
$products = $productPhotosTable->Products->find('list', limit: 200)->all();
|
||||
|
||||
Reference in New Issue
Block a user