Jump to content

Add Custom text on Product details page


Recommended Posts

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
Link to comment
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.

Link to comment
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? 

Link to comment
Share on other sites

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!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

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