- Posts: 10
- Thank you received: 0
Direct download product by catalog list
- richirasega
-
Topic Author
- Offline
Less
More
10 years 10 months ago #225315
by richirasega
Direct download product by catalog list was created by richirasega
-- HikaShop version -- : 2.6.0
Hello,
is there a way to set or override the hikashop catalog behaviour to make the user download a product as file/pdf directly by the category list without the need to load the product page ?
How ?
What happens if there are more then one pdf/file per product ?
Thank's in advance for anyt suggestion.
Hello,
is there a way to set or override the hikashop catalog behaviour to make the user download a product as file/pdf directly by the category list without the need to load the product page ?
How ?
What happens if there are more then one pdf/file per product ?
Thank's in advance for anyt suggestion.
Please Log in or Create an account to join the conversation.
10 years 10 months ago #225318
by nicolas
Replied by nicolas on topic Direct download product by catalog list
Hi,
Well, with custom coding it's possible. It would require to edit the view displaying the products on the listings and there add custom code to load the files data from the products, and then generate the links like on the product page view.
If you're not a developer it will require hiring one to do it for you.
You can potentially contact our partners for that:
www.hikashop.com/home/our-partners.html
Well, with custom coding it's possible. It would require to edit the view displaying the products on the listings and there add custom code to load the files data from the products, and then generate the links like on the product page view.
If you're not a developer it will require hiring one to do it for you.
You can potentially contact our partners for that:
www.hikashop.com/home/our-partners.html
Please Log in or Create an account to join the conversation.
- richirasega
-
Topic Author
- Offline
Less
More
- Posts: 10
- Thank you received: 0
10 years 10 months ago #225376
by richirasega
Replied by richirasega on topic Direct download product by catalog list
Hi, I'm a developer then it could be possible,
could you give some tip to do this ? For example how to load the files data feom the products List view ?
could you give some tip to do this ? For example how to load the files data feom the products List view ?
Please Log in or Create an account to join the conversation.
10 years 10 months ago #225387
by nicolas
Replied by nicolas on topic Direct download product by catalog list
Hi,
The data used on the product page is loaded by the function "show" in the file components/com_hikashop/views/product/view.html.php
So if you look there, you'll see that the code loading the images and files data of the product is:
Then, you can look at the file components/com_hikashop/views/product/tmpl/show_block_product_files.php which is where the download links are created based on the loaded data.
Finally, you can just edit the view file used on the listing (by default, the file "listing_img_title" of the view "product") via the menu Display>Views and there, load the data, and then generate the links based on the way it's done on the product page.
The data used on the product page is loaded by the function "show" in the file components/com_hikashop/views/product/view.html.php
So if you look there, you'll see that the code loading the images and files data of the product is:
Code:
$query = 'SELECT * FROM '.hikashop_table('file').' WHERE file_ref_id IN ('.implode(',',$ids).') AND file_type IN (\'product\',\'file\') ORDER BY file_ordering ASC, file_id ASC';
$database->setQuery($query);
$product_files = $database->loadObjectList();
if(!empty($product_files)) {
$productClass->addFiles($element,$product_files);
}
Finally, you can just edit the view file used on the listing (by default, the file "listing_img_title" of the view "product") via the menu Display>Views and there, load the data, and then generate the links based on the way it's done on the product page.
Please Log in or Create an account to join the conversation.
- richirasega
-
Topic Author
- Offline
Less
More
- Posts: 10
- Thank you received: 0
10 years 7 months ago #236913
by richirasega
Replied by richirasega on topic Direct download product by catalog list
Hello again,
is there a way to avoid force pdf download and let the browser decide what to do with the file for example by opening with the plugin ...
is there a way to avoid force pdf download and let the browser decide what to do with the file for example by opening with the plugin ...
Please Log in or Create an account to join the conversation.
10 years 7 months ago #236931
by nicolas
Replied by nicolas on topic Direct download product by catalog list
Hi,
The download links are normal download links. And HikaShop tells the browser that the file should be handled as a download.
It's then up to the browser to choose what to do with it. So the download will be handled differently based on which browser you're using and how you configured it.
The download links are normal download links. And HikaShop tells the browser that the file should be handled as a download.
It's then up to the browser to choose what to do with it. So the download will be handled differently based on which browser you're using and how you configured it.
Please Log in or Create an account to join the conversation.
- richirasega
-
Topic Author
- Offline
Less
More
- Posts: 10
- Thank you received: 0
10 years 6 months ago #237177
by richirasega
Replied by richirasega on topic Direct download product by catalog list
Well I trust it,
but I don't know why it just prompt to download the pdfs instead of open in another browser window
This is an example of a product image with download link:
All the computers prompt to download the files even if on other sites they just open it with the browser.
I can also send you a private message with a direct link to the demo site.
Thank you
but I don't know why it just prompt to download the pdfs instead of open in another browser window
This is an example of a product image with download link:
Code:
<a href="index.php?option=com_hikashop&ctrl=product&task=download&file_id=114&Itemid=103&lang=it" title="my product" class="hikashop_product_file_link">
<img class="hikashop_product_listing_image" title="" alt="datario_doppio_tmffd" src="/media/com_hikashop/upload/thumbnails/100x100f/myimage.jpg">
</a>
All the computers prompt to download the files even if on other sites they just open it with the browser.
I can also send you a private message with a direct link to the demo site.
Thank you
Please Log in or Create an account to join the conversation.
10 years 6 months ago #237235
by nicolas
Replied by nicolas on topic Direct download product by catalog list
Hi,
That's normal. As I said, these are download links, not display links. So they trigger the download system of your browser.
If you want to have the browser handle the downloads as PDF, you can change the line:
header('Content-Type: application/octet-stream');
to:
header('Content-Type: application/pdf');
in the file administrator/components/com_hikashop/classes/file.php
That's normal. As I said, these are download links, not display links. So they trigger the download system of your browser.
If you want to have the browser handle the downloads as PDF, you can change the line:
header('Content-Type: application/octet-stream');
to:
header('Content-Type: application/pdf');
in the file administrator/components/com_hikashop/classes/file.php
Please Log in or Create an account to join the conversation.
- richirasega
-
Topic Author
- Offline
Less
More
- Posts: 10
- Thank you received: 0
10 years 6 months ago #237311
by richirasega
Replied by richirasega on topic Direct download product by catalog list
Well thank you but:
1) I've to update also "content-disposition" to "inline" instead of "attachment"
2) there are some of this kind of header setting in the file.php, should I change everywhere ?
3) the file will open in the same window, should I change the "target" attribute on the "a" element or there's a way here by the header ?
4) There's a way to make an override of this patch ? I know that by next upgrades I'll loose it
5) I think it will be good to include this solution for pdfs to open inline in next component releases
1) I've to update also "content-disposition" to "inline" instead of "attachment"
2) there are some of this kind of header setting in the file.php, should I change everywhere ?
3) the file will open in the same window, should I change the "target" attribute on the "a" element or there's a way here by the header ?
4) There's a way to make an override of this patch ? I know that by next upgrades I'll loose it
5) I think it will be good to include this solution for pdfs to open inline in next component releases
Please Log in or Create an account to join the conversation.
10 years 6 months ago #237317
by nicolas
Replied by nicolas on topic Direct download product by catalog list
Hi,
1. OK
2. No, just there.
3. You'll have to add a target attribute in the a tag yes.
4. You can override the whole file and extend that class with a system plugin:
www.hikashop.com/forum/2-general-talk-ab...custom-features.html
5. That's not possible. Usually merchants want to force the download of the files for the download links so that customers can easily keep a copy of the file. If the files open automatically some customers, not well versed in computing don't know how to save what they see and thus think that they can't get their purchased download, and only see it. I actually don't recommend that you do it like you want for your own good
1. OK
2. No, just there.
3. You'll have to add a target attribute in the a tag yes.
4. You can override the whole file and extend that class with a system plugin:
www.hikashop.com/forum/2-general-talk-ab...custom-features.html
5. That's not possible. Usually merchants want to force the download of the files for the download links so that customers can easily keep a copy of the file. If the files open automatically some customers, not well versed in computing don't know how to save what they see and thus think that they can't get their purchased download, and only see it. I actually don't recommend that you do it like you want for your own good
Please Log in or Create an account to join the conversation.
- richirasega
-
Topic Author
- Offline
Less
More
- Posts: 10
- Thank you received: 0
10 years 6 months ago #237731
by richirasega
Replied by richirasega on topic Direct download product by catalog list
5) Yes I understand your point, I think this could be a good feature fot the "just-catalog" feature of hikashop.
Those merchants who uses hikashop to make catalog and not for ecommerce usually attach pdfs to preview detailed infos of each produtc, then it's a good way to open it in browser, keeping people reading in the browser without leaving the site and without the need to dig in the computer to find the saved file.
Thank you !
Those merchants who uses hikashop to make catalog and not for ecommerce usually attach pdfs to preview detailed infos of each produtc, then it's a good way to open it in browser, keeping people reading in the browser without leaving the site and without the need to dig in the computer to find the saved file.
Thank you !
Please Log in or Create an account to join the conversation.
Time to create page: 0.070 seconds