@ 2015-10-28T11:47:11Z <?php
// Find id's of previous and next product in featured module
$products = $this->model_catalog_product->getProducts();
$product_id = (int)$this->request->get['product_id'];
$key = array_search($product_id, array_column($products, 'product_id'));
$products = array_values($products);
if ($key === 0) {
$temp = end($products);
$data['prev_product_id'] = $temp['product_id'];
} else {
$data['prev_product_id'] = $products[$key - 1]['product_id'];
}
if ($key === count($products) - 1) {
$temp = reset($products);
$data['next_product_id'] = $temp['product_id'];
} else {
$data['next_product_id'] = $products[$key + 1]['product_id'];
}
// Find last image of previous product
$prev_product_images = $this->model_catalog_product->getProductImages($data['prev_product_id']);
$prev_product_last_image = end($prev_product_images);
if ($prev_product_last_image) {
$data['prev_product_image'] = $this->model_tool_image->placeholder_image($prev_product_last_image['image']);
} else {
$data['prev_product_image'] = '';
}
// Find first image of next product
$next_product_images = $this->model_catalog_product->getProductImages($data['next_product_id']);
$next_product_first_image = current($next_product_images);
if ($next_product_first_image) {
$data['next_product_image'] = $this->model_tool_image->placeholder_image($next_product_first_image['image']);
} else {
$data['next_product_image'] = '';
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.27 , 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 Fatal error: Uncaught Error: Using $this when not in object context in /in/NUvf3:3
Stack trace:
#0 {main}
thrown in /in/NUvf3 on line 3
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 Fatal error: Using $this when not in object context in /in/NUvf3 on line 3
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.9 Fatal error: Call to a member function on a non-object in /in/NUvf3 on line 3
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Fatal error: Call to a member function on a non-object in /in/NUvf3 on line 3
preferences:dark mode live preview
347.26 ms | 401 KiB | 454 Q