Jump to content

Place tpl at any place on website - even if hook does not exist in template


Recommended Posts

Hello,

I am developing a module that will display something on the product page, in area, where there is no hook available. I would like to create a module allowing to insert product content easily.

However I would prefer not to instruct the Users to edit the corresponding .tpl file in their theme folder to add a custom hook for my module.

I have checked and there are various available hooks on the product page, however there is no hook in the area that I am interested in.

What is the acceptable module behaviour in such situation?

Could I place the content somehwere nearby on the product page and then move it with JS on document load event to the exact place where I want it to be? I think this is less than ideal solution looking from the SEO perspective, as Google doesn't necessarily render the page on how it looks like after JS has taken it's effect and I want my module to be SEO friendly too.

Only other option to do what I need, would be to assign the variables to the custom hook that the User would then have to add, but this is bad because it requires a little bit of basic knowledge from Users and I don't want that - I just want the module to work right after the installation. 

Link to comment
Share on other sites

What do you mean both?

Inserting smarty variable into the .tpl by Users is bad, because it requires manual alteration of the files and basic knowledge that not everybody has. 

Moving the content into the desired place with JS is also bad, because the content is rendered elsewhere and then only moved with JS to the proper place so it's displayed the right way. However Google renders content pre-JS alteration and also it would require onload event which could possibly slow the site down.

I am asking about the correct and recommended behaviour, I couldn't find anything in PS docs. 

Link to comment
Share on other sites

There is no recommended behaviour on this manner, you can not do this without user intervention or without automatically altering the TPL files (which can lead to issues if not done correctly, or if the theme has big differences from the default one).

What I mean by both is you can let the user choose which of the methods to use, in the configuration form of your module:
1. If he knows how, let him modify the tpl file manually;
2. If he does not know how, use the javascript method but inform him about the consequences.

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