-- HikaShop version -- : 4.2.3
-- Joomla version -- : 3.9.16
-- PHP version -- : 7.2.24
-- Browser(s) name and version -- : Chrome
Hi,
I want to attach a file (zip, pdf…) to the products that the client can download. I know of a built-in HikaShop system that does just that. I upload the file to the product and make it free to download. The problem is that I want to know how many times a file has been downloaded. This is not possible in HikaShop.
That's why I'm thinking of using the jDownloads component. It has a plugin that with a specific string / {jd_file file == 1} / previews a download button / <a href="/component/jdownloads/send/…" alt="Download" class="jdbutton jmedium"> Download </ a> /. And the component provides statistics for downloads.
I created a Custom field - Table-> product, Field type-> text, Column name-> dw_file, Label-> Download, Front-end-> NO. There I enter the string / {jd_file file == 1} / in the product.
I found in the forum:
$fieldsClass = hikashop_get('class.field');
$fields = $fieldsClass->getFields('frontcomp', $this->row, 'category');
foreach ($fields as $fieldName => $oneExtraField) {
if ($oneExtraField->field_namekey == 'dw_file')
$myfile = $fieldsClass->show($val,$this->row->$key);
}
…
<div> <?php>echo $myfile;?></div>
I put this code in product-> listing_img_title and product-> show_default, but I can't figure out why it doesn't work.
I ask for your assistance.
Best Regards