Jump to content

Custom HTML in footer depending on category page


Recommended Posts

Hello,

 

I'm trying to include some HTML in the footer of a category page for SEO.This HTML will be customized in each category.

I bought a module to include extra HTML blocks that includes variables like {category_name} but I don't know how to access this variables.

 

I would like to do something like

 

<div id="CategoryCustomHTML"> </div>
 
<script>
     if({category_name}=="bracelets")
            document.getElementById("CategoryCustomHTML").innerHTML=HTML1;
     else if({category_name}=="rings")
            document.getElementById("CategoryCustomHTML").innerHTML=HTML2;
     ...
</script>

 

 

Thanks,

Paula

Link to comment
Share on other sites

maybe your module has an option to display contents on selected category pages?

it will be much easier to achieve what you expect

 

if variable {category_name} exist, the code you attached should work, but in that way it will be a little hard to define contents for many categories

Link to comment
Share on other sites

Hello Vekia,

 

thanks for yout reply.

 

(See attached the module interface)

The module can be configured to be shown on selected page type (category, cart, index, address, etc.) but it hasn't an option to configure a specific category name or ID like your module has (I discovered your HTML module too late :-( )

 

The problem is that I'm new to HTML, PHP and javascript and I don't know what can be wrong.

 

I tried this simple example to show the category name in each category but nothing happens.

I don't know if nobody is filling the variable, the syntax is incorrect, the variables are created by the module or are global variables of prestashop, the variables doesn't exists, ...

 

<div id="CategoryCustomHTML"> </div>
 
<script> 
     document.getElementById("CategoryCustomHTML").innerHTML={category_name};
</script>

 

 

This is the unique help of the module. I tried to contact the developer but I didn't get any answer.

 

Enter the HTML or Javascript code here for this HTML block.You can use the following variables to display dynamic content.

Global: {language_iso_code}, {content_only_url_param}, {shop_url}, {shop_name}, {customer_lastname}, {customer_firstname}, {meta_title}, {meta_description}, {meta_keywords}

Product pages: {product_name}, {product_link}, {product_description}, {product_description_short}, {product_description_html}, {product_description_short_html}

Category pages: {category_name}, {category_link}, {category_description}, {category_description_html}

Manufacturer pages: {manufacturer_name}, {manufacturer_link}, {manufacturer_description}, {manufacturer_description_short}, {manufacturer_description_html}, {manufacturer_description_short_html}

Supplier pages: {supplier_name}, {supplier_link}, {supplier_description}, {supplier_description_html}

 

post-1115579-0-44811900-1471536739_thumb.jpg

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