Jump to content

Conditional "IF" not working


jd250

Recommended Posts

Hello.

I'm using that code in header.tpl, for instance:

{if $category->id == 12}<title>CUSTOM TITLE FOR CATEGORY 12</title>{else}<title>{$meta_title|escape:'html':'UTF-8'}</title>{/if}

{if $category->id == 23}<title>CUSTOM TITLE FOR CATEGORY 33</title>{else}<title>{$meta_title|escape:'html':'UTF-8'}</title>{/if}

It changes for each category the meta-title BUT also in all products inside that category. I think it's because products grabs category ID too.

But I'm trying to fix that. Why I want to use this? Because I have many categories and in several ones, meta title + prestashop shop name is ok for SEO but I have two categories with long title and when category adds meta title, lenght are very long. So this is the reason why I want to force title in that categoris.

In fact, I do this but with CMS id and it works ok

{if $cms->id == 38}<title>My long customt itle</title>{else}<title>{$meta_title|escape:'html':'UTF-8'}</title>{/if}

 

Do you know how can I fix that? Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

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
×
×
  • Create New...