Jump to content
  • 0
MerseyRay

How to change text on product flags?

Question

How can I change the wording on the product flag "ON SALE!"

In previous PS it was in the product.tpl, but now I cant find where to do it.

I know its a UL that is populated somewhere but I can not find it.

Thanks in advance

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 1

It is still in product.tpl, around line 59

{block name='product_flags'}
                <ul class="product-flags">
                  {foreach from=$product.flags item=flag}
                    <li class="product-flag {$flag.type}">{$flag.label}</li>
                  {/foreach}
                </ul>
              {/block}

But you cannot change the text in the template file no more. I think that they moved the logic into the ProductController or other core file, and you may need to override the class that generates the text.

You could try to put the logic back into the template file, but first see what {$flag.type} returns for the "On sale" flag and then do something like this:

{block name='product_flags'}
  <ul class="product-flags">
    {foreach from=$product.flags item=flag}
    	{if $flag.type == 'on_sale'}
    		<li class="product-flag {$flag.type}">{l s='My custom text' d='Shop.Theme.Catalog'}</li>
    	{elseif $flag.type == 'other_flag_you_want_to_customize'}
    		<li class="product-flag {$flag.type}">{l s='My Other cutom text' d='Shop.Theme.Catalog'}</li>
    	{else}
        	<li class="product-flag {$flag.type}">{$flag.label}</li>
    	{/if}
    {/foreach}
  </ul>
{/block}

But, remember that first you need to figure out what each {$flag.type} returns, by putting this smarty variable in the product page someplace and see exactly what it prints for each situation.

You can also see what other variables are available for comparassion in the if statement by putting {$flag|var_dump} somewhere in the product page.

Edited by horiatb

Share this post


Link to post
Share on other sites
  • 0

In my experience you do not need to edit product.tpl, you just need to find that translations in the default theme (classic), If you cant find those terms in the theme translations you will find them in the classic theme translations. It's a common error.

 

 

 

 

Share this post


Link to post
Share on other sites
  • 0

As Oserrano already mentioned correcty you can change this text in the Theme Translations e.g. at Shop.Theme.Catalog

Share this post


Link to post
Share on other sites
  • 0
3 hours ago, JBW said:

As Oserrano already mentioned correcty you can change this text in the Theme Translations e.g. at Shop.Theme.Catalog

Not working :( No effect. Did u test you solution?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More