Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Dynamic link in tpl file

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
C-tec
Smarty n00b


Joined: 11 Jan 2019
Posts: 4

PostPosted: Fri Jan 11, 2019 10:26 am    Post subject: Dynamic link in tpl file Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Jan 11, 2019 7:39 pm    Post subject: Reply with quote

You are using terminology foreign to Smarty.
Please explain your issue clearer.
Back to top
View user's profile Send private message
C-tec
Smarty n00b


Joined: 11 Jan 2019
Posts: 4

PostPosted: Mon Jan 14, 2019 9:03 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Jan 14, 2019 4:31 pm    Post subject: Reply with quote

Instructions look clear.
So, what is your problem?
Back to top
View user's profile Send private message
C-tec
Smarty n00b


Joined: 11 Jan 2019
Posts: 4

PostPosted: Mon Jan 14, 2019 4:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Jan 14, 2019 4:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
C-tec
Smarty n00b


Joined: 11 Jan 2019
Posts: 4

PostPosted: Tue Jan 15, 2019 10:38 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jan 15, 2019 7:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP