diff --git a/mirzaev/skillparts/system/controllers/ProductController.php b/mirzaev/skillparts/system/controllers/ProductController.php index 0656eb1..3b2ba50 100644 --- a/mirzaev/skillparts/system/controllers/ProductController.php +++ b/mirzaev/skillparts/system/controllers/ProductController.php @@ -604,7 +604,7 @@ class ProductController extends Controller // Товар обновлён $return['main'] = $this->renderPartial('index', compact('model')); - $return['redirect'] = '/product/' . $model->catn; + $return['redirect'] = "/product/$model->prod/$model->catn"; } } @@ -790,7 +790,7 @@ class ProductController extends Controller } } - public function actionWriteImage(string $catn): array|string|null + public function actionWriteImage(string $prod, string $catn): array|string|null { // Инициализация $return = [ @@ -847,7 +847,7 @@ class ProductController extends Controller ]; $index = yii::$app->request->post('index') ?? yii::$app->request->get('index'); - if (empty($catn) || empty($index) || empty($prod)) { + if (empty($catn) || !isset($index) || empty($prod)) { // Не получены обязательные параметры yii::$app->response->statusCode = 500; diff --git a/mirzaev/skillparts/system/views/product/index.php b/mirzaev/skillparts/system/views/product/index.php index 9b56fc9..0bb60fd 100644 --- a/mirzaev/skillparts/system/views/product/index.php +++ b/mirzaev/skillparts/system/views/product/index.php @@ -67,7 +67,7 @@ use app\models\Product; // Инициализация $checked = ''; - foreach (!empty($model['imgs']) && is_array($model['imgs']) ? $model['imgs'] : [] as $key => $image) { + foreach (!empty($model['imgs']) && is_array($model['imgs']) ? $model['imgs'] : [null] as $key => $image) { // Перебор изображений для генерации полных версий // Инициализация