View previous topic :: View next topic |
Author |
Message |
C-tec Smarty n00b
Joined: 11 Jan 2019 Posts: 4
|
Posted: Fri Jan 11, 2019 10:26 am Post subject: Dynamic link in tpl file |
|
|
Hi and thanks in advance. I'm a total novice with Smarty.
Can someone tell me how I can embed the link below into a functioning dynamic link in a .tpl file please - presumably using Smarty tags.
api.3rd-party-company.com/api/DatasheetsPdf?brandNodeId=119288&partNumber={partNumber} |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Jan 11, 2019 7:39 pm Post subject: |
|
|
You are using terminology foreign to Smarty.
Please explain your issue clearer. |
|
Back to top |
|
C-tec Smarty n00b
Joined: 11 Jan 2019 Posts: 4
|
Posted: Mon Jan 14, 2019 9:03 am Post subject: |
|
|
A third party company holds duplicate data of the products from our Prestashop site (they are a kind of comparison site). One of the services they offer is a Datasheet download of the specifications of any given product in PDF format. What I want is a link on each individual product page which, when clicked, will download the PDF in the users browser.
They've given me the following link to place - presumably in the product.tpl file - to enable the facility.
http://api.3rd-party-website.com/api/DatasheetsPdf?brandNodeId=119288&partNumber={$partNumber} |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Jan 14, 2019 4:31 pm Post subject: |
|
|
Instructions look clear.
So, what is your problem? |
|
Back to top |
|
C-tec Smarty n00b
Joined: 11 Jan 2019 Posts: 4
|
Posted: Mon Jan 14, 2019 4:35 pm Post subject: |
|
|
Hi, thanks for your reply.
As I said, I'm a total novice with Smarty.
I'd need the linking text to say "Download product datasheet" with a pdf icon just before it. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Jan 14, 2019 4:37 pm Post subject: |
|
|
Documentation is at the https://www.smarty.net/documentation
Read it, check examples, follow them with your code.
If your code doesn't work, post it and specify, what's wrong with it/not working up to your expectation. |
|
Back to top |
|
C-tec Smarty n00b
Joined: 11 Jan 2019 Posts: 4
|
Posted: Tue Jan 15, 2019 10:38 am Post subject: |
|
|
I've made a bit of progress with the following line of code:
<a href="http://api.3rd-party-website.com/api/DatasheetsPdf?brandNodeId=119288&partNumber={$product->reference}">pdf download</a>
The url references the right product but it doesn't actually download the PDF - it downloads a file called datasheetspdf.json.
**Edit
I've since been informed that the url above returns/contains the url for the pdf download.
If you look at the link below, the link to the Pdf is displayed on the page - I think in json format.
http://api.electrika.com/api/DatasheetsPdf?brandNodeId=119288&partNumber=CFP702-4
Could you tell me how to access this data please? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jan 15, 2019 7:04 pm Post subject: |
|
|
I would suggest writing a JavaScript code to retrieve the necessary information then.
It would be more reliable, more useful for your project and less of a strain on the API server. |
|
Back to top |
|
|