OpenCart 🇺🇦

Схема

public array getProductImages ( int $product_id )

Аргументы

Аргумент Возможный тип Описание
$product_id int

Описание

Получить список картинок для продукта

Пример использования:

// вызов из catalog/controller/product/product.php
$this->data['images'] = array();

$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);

foreach ($results as $result) {
	$this->data['images'][] = array(
		'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')),
		'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'))
	);
}

Исходный код

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "' ORDER BY sort_order ASC");

return $query->rows;