Jump to content

Add custom text box with dynamic text on every product page.


Recommended Posts

I want to add a couple of lines of dynamic text to my product description.

Like this text

What is the price of "product name" in Singapore?
The latest price of "product name" in Singapore is "product price" You can buy the "product name" at best price from our "store name" or visit "store address"

I don't want to visit every product page to add this.

And I want google to capture the question (attached picture)

How can I do it?

Custom Box 1.jpg

Custom Box 2.jpg

Link to comment
Share on other sites

How to add dynamic text?
Create a module and a custom hook that will be inserted into the TPL of the product.tpl template.

Or add text to ./themes/classic/templates/catalog/product.tpl.

Find:

{block name='product_description'}
    <div class="product-description">{$product.description nofilter}</div>
{/block}

change to:

{block name='product_description'}
    <div class="product-description">{$product.description nofilter}</div>
    <div class="product-description">
      <h3>{l s='What is the price of' d='Shop.Theme.Catalog'} {$product.name} {l s='in Singapore?' d='Shop.Theme.Catalog'}</h3>
      <p>
        {l s='The latest price of' d='Shop.Theme.Catalog'} {$product.price} {l s='You can buy the' d='Shop.Theme.Catalog'}  {$product.name} {l s='at best price from our' d='Shop.Theme.Catalog'} {$shop.name} {l s='or visit' d='Shop.Theme.Catalog'} <a href="{$urls.base_url} ">{$shop.name}</a>.
      </p>
    </div>
{/block}

 

result:

obrazek.png.24fd2c54818e22a3366aa1daede06706.png

Edited by 4you.software (see edit history)
  • Like 1
Link to comment
Share on other sites

On 9/16/2022 at 3:29 PM, 4you.software said:

How to add dynamic text?
Create a module and a custom hook that will be inserted into the TPL of the product.tpl template.

Or add text to ./themes/classic/templates/catalog/product.tpl.

Find:

{block name='product_description'}
    <div class="product-description">{$product.description nofilter}</div>
{/block}

change to:

{block name='product_description'}
    <div class="product-description">{$product.description nofilter}</div>
    <div class="product-description">
      <h3>{l s='What is the price of' d='Shop.Theme.Catalog'} {$product.name} {l s='in Singapore?' d='Shop.Theme.Catalog'}</h3>
      <p>
        {l s='The latest price of' d='Shop.Theme.Catalog'} {$product.price} {l s='You can buy the' d='Shop.Theme.Catalog'}  {$product.name} {l s='at best price from our' d='Shop.Theme.Catalog'} {$shop.name} {l s='or visit' d='Shop.Theme.Catalog'} <a href="{$urls.base_url} ">{$shop.name}</a>.
      </p>
    </div>
{/block}

 

result:

obrazek.png.24fd2c54818e22a3366aa1daede06706.png

Thank You, I will try it and let you know.

  • Like 1
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...