Jump to content

How to use module variables in another tpl - product.tpl of my template ?


lukaszwojcik

Recommended Posts

Hello,
I use the productcomments module, it has in its php file variables $averageTotal and $nbComment, which work in the module's .tpl file. I would like to use them in the product prodct.tpl file in the main product description.
How can I use these variables? Can they be made with global variables so that they work in all tpl of my site? How to do it ?
greetings

Link to comment
Share on other sites

  • 3 years later...
On 3/10/2019 at 3:34 PM, lukaszwojcik said:

Hello,
I use the productcomments module, it has in its php file variables $averageTotal and $nbComment, which work in the module's .tpl file. I would like to use them in the product prodct.tpl file in the main product description.
How can I use these variables? Can they be made with global variables so that they work in all tpl of my site? How to do it ?
greetings

 

I need exact help with this issue, same plugin. It works for all products, except the main product, the review/rich snippet is not included on the main product, the code is not working!

 

How can I enable it to work? This is the code, which is unfortunately not working/outputting anything:

 

{if isset($nbComments) && $nbComments && $ratings.avg}"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{$ratings.avg|round:1|escape:'html':'UTF-8'}",
"reviewCount": "{$nbComments|escape:'html':'UTF-8'}"
},{/if}

 

Thank you

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