Jump to content
techwthquestion

Add Custom text on Product details page

Recommended Posts

Posted (edited)

Hello,

How can add Custom text on Product  details page as per the Group name.. For example if group is shared,  I want to show text "Text SHARED DEMO" , If group is reseller then text would be "Text : RESELLER DEMO"

Do I need to use hook or should I page changes directly in overview.tpl file? 

Edited by techwthquestion

Share this post


Link to post
Share on other sites
17 hours ago, techwthquestion said:

How can add Custom text on Product  details page as per the Group name.. For example if group is shared,  I want to show text "Text SHARED DEMO" , If group is reseller then text would be "Text : RESELLER DEMO" 

Do I need to use hook or should I page changes directly in overview.tpl file?  

if you're replacing, or adding to, text that is already there, you might be able to do it with a hook - though that is always dependent upon *where* you want to output the text.

for example, let's assume that a product details [age contained a product from a product group of "Shared Hosting"... the basic hook below would add some text below that and before the product name...

<?php

# Product Details Additional Text Hook
# Written by brian!

function product_details_additional_text_hook($vars)
{
	if ($vars['groupname'] == "Shared Hosting") {
		$groupname = $vars['groupname']."<br>Brian's Special Department";
		return array("groupname" => $groupname);
	}
}
add_hook("ClientAreaProductDetailsPreModuleTemplate", 1, "product_details_additional_text_hook");

aGN5dt5.png

basically, the hook is just replacing an existing variable with itself plus additional text...

if you wanted to add text in the template, then I suspect it would more likely be clientareaproductdetails.tpl rather than overview.tpl - but as always, that depends where the text is that you want to update.

Share this post


Link to post
Share on other sites
15 minutes ago, brian! said:

if you're replacing, or adding to, text that is already there, you might be able to do it with a hook - though that is always dependent upon *where* you want to output the text.

for example, let's assume that a product details [age contained a product from a product group of "Shared Hosting"... the basic hook below would add some text below that and before the product name...


<?php

# Product Details Additional Text Hook
# Written by brian!

function product_details_additional_text_hook($vars)
{
	if ($vars['groupname'] == "Shared Hosting") {
		$groupname = $vars['groupname']."<br>Brian's Special Department";
		return array("groupname" => $groupname);
	}
}
add_hook("ClientAreaProductDetailsPreModuleTemplate", 1, "product_details_additional_text_hook");

aGN5dt5.png

basically, the hook is just replacing an existing variable with itself plus additional text...

if you wanted to add text in the template, then I suspect it would more likely be clientareaproductdetails.tpl rather than overview.tpl - but as always, that depends where the text is that you want to update.

Hello Sir,

Thank you for your reply. 

Actually, I have created a small box to show connection information. I have added my code in overview.tpl and it is working. I need to show custom text in that bax. Its a simple html code I have used. 

I want to show different text as per the group type. So Can you modify code and tell me how can I use to for my custom text box? 

Share this post


Link to post
Share on other sites
Posted (edited)
On 08/10/2019 at 18:46, techwthquestion said:

I want to show different text as per the group type. So Can you modify code and tell me how can I use to for my custom text box? 

in your html box, you could do use Smarty to output your conditional text...

{if $groupname eq "Shared Hosting"}SHARED DEMO{elseif $groupname eq "Reseller Hosting"}RESELLER DEMO{/if}

note that the text in the quotes must be the same as your Product Group name.

Edited by brian!

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated