techwthquestion Posted October 7, 2019 Share Posted October 7, 2019 (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 October 7, 2019 by techwthquestion 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 8, 2019 Share Posted October 8, 2019 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"); 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. 1 Quote Link to comment Share on other sites More sharing options...
techwthquestion Posted October 8, 2019 Author Share Posted October 8, 2019 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"); 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? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 9, 2019 Share Posted October 9, 2019 (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 October 11, 2019 by brian! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.