-M- Posted October 5, 2015 Share Posted October 5, 2015 (edited) Hi guys, Need some help with this. I am trying to remove a particular text string from my page (configureproduct.tpl), however I am failing miserably. I have the following text-string: "+ 25,00 EUR one-time setup fee" I can obviously change the lange file, however I don't want to do this, because of my other products. Also it will remove the text partially. Is there a way, by Javascript or jQuery to remove this string from the complete page? ...I already tried several things, but no luck at all. Maybe someone else, with more experience to jQuery and/or JS, can solve this one? Ofcourse hiding this text string is also an option, instead of removing. Forgot to mention this. I already tried asking this on Stackoverflow, but people aren't much helpful over there. Probably because it's a silly question, however I cannot get this done. The "best" result I got so far was removing *everything*. Sigh. //edit For example I tried the following, but it doesn't work. <script type="text/javascript"> var string = '+ 25,00 EUR one-time setup fee'; //Replace text with space var new_string = string.replace('+ 25,00 EUR one-time setup fee', ' '); alert(string + '\n' + new_string); </script> Edited October 5, 2015 by MvdL1979 Added an example (which doesn't work). 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 5, 2015 Share Posted October 5, 2015 my first thought would be to modify it in the template using Smarty - either using 'replace' or wrapping it in an {if} statement and removing that text if certain conditions exist. a screenshot and knowing which order form template you're using would have been helpful, but if you can find where it's being generated, it should be simple to tweak. 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 5, 2015 Author Share Posted October 5, 2015 Hi Brian, I mentioned it was in the configureproduct.tpl template file. It's automatically generated under: <div class="form-group"> <label for="inputConfigOption{$configoption.id}">{$configoption.optionname}</label> <select name="configoption[{$configoption.id}]" id="inputConfigOption{$configoption.id}" class="form-control"> {foreach key=num2 item=options from=$configoption.options} <option value="{$options.id}"{if $configoption.selectedvalue eq $options.id} selected="selected"{/if}> {$options.name} </option> {/foreach} </select> I don't think I can remove text partially from that, which is being generated on the fly? That's why I was looking for a JS or JQ solution. But that's me, maybe I am thinking to difficult. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 5, 2015 Share Posted October 5, 2015 I mentioned it was in the configureproduct.tpl template file. yes - but not which one... they're not all exactly the same you know! It's automatically generated under: ok, it's standard_cart. I don't think I can remove text partially from that, which is being generated on the fly?That's why I was looking for a JS or JQ solution. But that's me, maybe I am thinking to difficult. oh it's absolutely possible to remove partial text using Smarty... it's being generated in php and passed to a Smarty variable - once its passed, you can manipulate it however you want (within reason!). first thing to do is add {debug} to the very end of the template code, refresh the page in the browser and you should get a popup window of all the Smarty variables and arrays available to the page. somewhere in that window will be the "+ 25,00 EUR one-time setup fee" string you want to remove - once you know which variable in generating the text, then you can either replace it or wrap it in a condition.. let's say you want to replace it, you can use the following (change $variable to the variable you want to modify).. {$variable|replace:'+ 25,00 EUR one-time setup fee':''} if $variable contains that string, it will be removed; if it doesn't, it will be displayed as normal. the example above would only work for English - if you are using other languages on the client area, you may need multiple replaces... 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 6, 2015 Author Share Posted October 6, 2015 Thank you for explaining Brian. I did check the variables with {debug} and I did found the variable I want to remove/replace, however it's show in the {debug} screen as: name => "Example Server €5,00 EUR + €25,00 EUR ..." It's not written full, I think the English word for this "abbreviated"..? Does this matter, or? Also, there is another thing I am trying. I want to get rid off every €0.00 EUR values. If they aren't calculated, like included or free, it shouldn't display €0.00 EUR at all. Is there an easy way to hide all those €0.00 EUR values in one single go? I did see the values in {debug}, but they are written like 0.00 obviously (so without € and EUR). 0 Quote Link to comment Share on other sites More sharing options...
-M- Posted October 6, 2015 Author Share Posted October 6, 2015 Nevermind. I fixed this in a similar way. TY 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.