Answer the question
In order to leave comments, you need to log in
What is the error in products product.php on line 432 - 436?
Tell me, please, the site is on the local, Opencart 3.0.2, when you go to any product, everything is displayed, but at the top of the page it gives an error.
Notice: Undefined variable: result in \domains\storage\modification\catalog\controller\product\product.php on line 436.
Here is the code of these lines:
$images = $this->model_catalog_product->getProductImages($result['product_id']);
if(isset($images[0]['image']) && !empty($images)){
$images = $images[0]['image'];
}else{
$images = $image;
Answer the question
In order to leave comments, you need to log in
Declare $result = [] before if, foreach, etc.
$result = [];
if(...) {
foreach(... as ...) {
$images = $this->model_catalog_product->getProductImages($result['product_id']);
if(isset($images[0]['image']) && !empty($images)){
$images = $images[0]['image'];
} else {
$images = $image;
}
}
The $result variable does not exist. Maybe $result is declared inside foreach or if, so it doesn't exist.
this piece is from some mod. It looks like it's in the wrong place. outside the
foreach ($results as $result) {
so it's impossible to tell. it is necessary to look all function where this piece is inserted.
although to be honest, this piece does not make much sense. in native file it looks like this
$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
foreach ($results as $result) {
$data['images'][] = array(
'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')),
'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_height'))
);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question