you have to edit three pages(model, controller, template), After adding download file from admin in product
Add this In opencart2\catalog\controller\product\product.php
inside index() function or after line 159
$download_m = $this->model_catalog_product->download_m($product_id);
if(!empty($download_m)){
$data['download_m'] = $this->url->link('account/download/download', 'download_id=' . $download_m['download_id'], 'SSL');}
Add this in opencart2\catalog\model\catalog\product.php
in this class ModelCatalogProduct extends Model {
public function download_m($product_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'");
$sql = "SELECT * FROM " . DB_PREFIX . "product_to_download WHERE product_id = '" . (int)$product_id . "'";
if ($query->num_rows) {
return array(
'product_id' => $query->row['product_id'],
'download_id' => $query->row['download_id']
);
}
}
At last Add in
opencart2\catalog\view\theme\default\template\product\product.tpl
After < h1>< ?php echo $heading_title; ?> or line 138
<?php if(!empty($download_m)){ ?>
<li><a href="<?php echo $download_m; ?>">download here</a></li>
<?php } ?>
