wp4all Posted March 22, 2019 Share Posted March 22, 2019 Hi @ all, is it possible to change / translate or replace the result of an Data Feed ? Why I'm asking is I would like to use the data feed to show the price on an external Page but I won't show the Prefix. <script language="javascript" src="feeds/productsinfo.php?pid=1&get=price&billingcycle=monthly"></script> In my little stupid world I would use : document.body.innerHTML = document.body.innerHTML.replace(/€/g, ' '); which works already but this affects the entire page. Thanks and best regards Christian 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 22, 2019 Share Posted March 22, 2019 Hi Christian, 2 hours ago, wp4all said: is it possible to change / translate or replace the result of an Data Feed ? yes, but you're thinking of it entirely the wrong way. 2 hours ago, wp4all said: Why I'm asking is I would like to use the data feed to show the price on an external Page but I won't show the Prefix. that's simple enough. 2 hours ago, wp4all said: In my little stupid world I would use... which works already but this affects the entire page. then it's time for you to leave your stupid world and enter my insane world! the solution is that instead of letting the data feed return the default price, e.g €100 EUR, and then trying to translate/manipulate/edit the result, you modify the feed code to suit your needs and return what you want from it! now, you should never modify existing data feeds because they will be overwritten by the WHMCS automatic updater - so create a new data feed in the feeds folder, post your code in there, modify it and use that... to save you time, i've quickly updated the productsinfo feed you mentioned and i've attached it to this post... just rename it to something else and remember to change your references (filename, productid, billingcycle, currency etc) in your template code that calls the feed(s). I have added 3 options - to either output the price with a suffix; with a prefix, or with neither... full string = <script language="javascript" src="feeds/productsinfo.php?pid=1&get=price&billingcycle=annually¤cy=1"></script><br> suffixed = <script language="javascript" src="feeds/productsinfo.php?pid=1&get=price&billingcycle=annually¤cy=1&output=suffix"></script><br> prefixed = <script language="javascript" src="feeds/productsinfo.php?pid=1&get=price&billingcycle=annually¤cy=1&output=prefix"></script><br> price only = <script language="javascript" src="feeds/productsinfo.php?pid=1&get=price&billingcycle=annually¤cy=1&output=number"></script><br> full string = £100.00 GBP suffixed = 100.00 GBP prefixed = £100.00 price only = 100.00 productsinfo.php 1 Quote Link to comment Share on other sites More sharing options...
wp4all Posted March 22, 2019 Author Share Posted March 22, 2019 Hi @brian!, 8 minutes ago, brian! said: then it's time for you to leave your stupid world and enter my insane world! I like to descend into your world again and again Sometimes i just think too complicated I have the feeling 🙄 Thanks Brian 0 Quote Link to comment Share on other sites More sharing options...
Beekingo Posted September 20, 2020 Share Posted September 20, 2020 Hey, how can i get that file? Look unavailable right now 😪 Thanks! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.