Jump to content

Removing text string from page (configureproduct.tpl)...?


-M-

Recommended Posts

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 by MvdL1979
Added an example (which doesn't work).
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :|

Link to comment
Share on other sites

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. :idea:

 

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...

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated