OpenCartバージョン2.1.3はありませんが、カテゴリページに最初に追加画像を表示する方法は次のとおりです。 category.php
で
を探す:
$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
と交換してください:category.tpl
で次に
$image_results = $this->model_catalog_product->getProductImages($result['product_id']);
if ($image_results) {
$image2 = $this->model_tool_image->resize($image_results[0]['image'], $this->config->get($this->config->get('config_theme') . '_image_product_width'), $this->config->get($this->config->get('config_theme') . '_image_product_height'));
} else {
$image2 = false;
}
$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'thumb2' => $image2,
、foreach
内で使用:
<?php if($product['thumb2']){ ?><img src="<?php echo $product['thumb2']; ?>"><?php } ?>
を
私はこれをOpenCart 2.3.0.2でテストしました
Source