innovativeweb Posted December 11, 2019 Share Posted December 11, 2019 Hello I want to design Notification Bar like: https://marketplace.whmcs.com/product/1182/images/screenshots/2094-f74cab3c2eef3cf0cbb3cbbadbdd4aef.png so tell me how can i do so 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 12, 2019 Share Posted December 12, 2019 On 11/12/2019 at 06:54, innovativeweb said: I want to design Notification Bar like: https://marketplace.whmcs.com/product/1182/images/screenshots/2094-f74cab3c2eef3cf0cbb3cbbadbdd4aef.png that screenshot is just a ClientAreaHomepage hook... it's just a case of working out the html to be added to the hook, e.g a bootstrap alert or other div layout, and then building any conditions on what message is shown and to whom. 0 Quote Link to comment Share on other sites More sharing options...
innovativeweb Posted December 12, 2019 Author Share Posted December 12, 2019 (edited) Hello @brian! I want same place and same design as i am showing in https://marketplace.whmcs.com/product/1182/images/screenshots/2094-f74cab3c2eef3cf0cbb3cbbadbdd4aef.png Edited December 12, 2019 by innovativeweb name 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 13, 2019 Share Posted December 13, 2019 22 hours ago, innovativeweb said: I want same place and same design as i am showing in https://marketplace.whmcs.com/product/1182/images/screenshots/2094-f74cab3c2eef3cf0cbb3cbbadbdd4aef.png then buy the Client Notifications addon! 🙄 <?php add_hook('ClientAreaHomepage', 1, function($vars) { return '<div class="alert alert-success"><div class="row"><div class="col-sm-1"><i class="fab fa-whmcs fa-3x"></i></div><div class="col-sm-11">Welcome to WHMCS!<br><small>buy the addon!</small></div></div></div>'; }); you could always log into their demo if you want to steal their div layout code, but you'd likely have to copy and adapt their css too. 3 Quote Link to comment Share on other sites More sharing options...
kang28ivan Posted February 17, 2020 Share Posted February 17, 2020 (edited) On 12/13/2019 at 10:15 PM, brian! said: then buy the Client Notifications addon! 🙄 <?php add_hook('ClientAreaHomepage', 1, function($vars) { return '<div class="alert alert-success"><div class="row"><div class="col-sm-1"><i class="fab fa-whmcs fa-3x"></i></div><div class="col-sm-11">Welcome to WHMCS!<br><small>buy the addon!</small></div></div></div>'; }); you could always log into their demo if you want to steal their div layout code, but you'd likely have to copy and adapt their css too. Hi @brian! Sorry I bump this thread. How to be displayed on specific products? for example I want to display for certain packages used by the user and displayed on the service details page Edited February 17, 2020 by kang28ivan 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 17, 2020 Share Posted February 17, 2020 4 hours ago, kang28ivan said: How to be displayed on specific products? for example I want to display for certain packages used by the user and displayed on the service details page then you wouldn't use this hook, you would instead use ClientAreaProductDetailsOutput hook and specify what output occurs with specific service(s). <?php add_hook('ClientAreaProductDetailsOutput', 1, function($service) { $serviceID = $service['service']->Id; if ($serviceID == '600') { $output .= '<div class="alert alert-success" role="alert"><div class="row"><div class="col-sm-1"><i class="fab fa-whmcs fa-3x"></i></div><div class="col-sm-11">Welcome to WHMCS!<br><small>buy the addon!</small></div></div></div>'; } if ($output) { return $output; } }); it's worth noting that the location of this specific hook output is determined by the Smarty template and not the hook itself - if you were displaying MarketConnect banners on that page, it would display below them. if you have an unpaid/overdue invoice, then there is a default alert shown at the top of the page... ... but that output is specified in the template itself and only triggered if/when hardcoded conditions are passed to the template. if you wanted to output your alert elsewhere on the page, you would be looking at either editing the template to define exactly where the output should be (you could still trigger it, and specify it's content, with a hook), or using another output hook, containing JS to specify the exact location of the output (though can be difficult depending on where you want to output). 3 Quote Link to comment Share on other sites More sharing options...
kang28ivan Posted February 17, 2020 Share Posted February 17, 2020 Thank you @brian! very helpful For serviceID this can multiple service ID separated by commas?? if ($serviceID == '600') 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 17, 2020 Share Posted February 17, 2020 (edited) 35 minutes ago, kang28ivan said: For serviceID this can multiple service ID separated by commas?? two options, you could either use OR or in_array - OR is ok if you only have two values to test against, but once you get beyond two, then it's simpler to use in_array. if (in_array($serviceID, array('573','600'))) { Edited February 17, 2020 by brian! 0 Quote Link to comment Share on other sites More sharing options...
kang28ivan Posted February 17, 2020 Share Posted February 17, 2020 Just now, brian! said: two options, you could either use OR or in_array - OR is ok if you only have two values to test again, once you get beyond two, then it's simpler to use in_array. if (in_array($serviceID, array('573','600'))) { Thank you @brian! 0 Quote Link to comment Share on other sites More sharing options...
kang28ivan Posted March 3, 2020 Share Posted March 3, 2020 On 2/17/2020 at 10:20 PM, brian! said: two options, you could either use OR or in_array - OR is ok if you only have two values to test against, but once you get beyond two, then it's simpler to use in_array. if (in_array($serviceID, array('573','600'))) { Hi @brian! sorry I'm bumping this thread again. once again I want to ask how to display notifications based on the package/product ID or group ID not service ID? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 3, 2020 Share Posted March 3, 2020 9 minutes ago, kang28ivan said: once again I want to ask how to display notifications based on the package/product ID or group ID not service ID? <?php add_hook('ClientAreaProductDetailsOutput', 1, function($service) { $serviceID = $service['service']->Id; $productID = $service['service']->packageId; $groupID = $service['service']->product->productGroupId; if (in_array($groupID, array('10','12'))) { $output .= '<div class="alert alert-success" role="alert"><div class="row"><div class="col-sm-1"><i class="fab fa-whmcs fa-3x"></i></div><div class="col-sm-11">Welcome to WHMCS!<br><small>buy the addon! ;-)</small></div></div></div>'; } if ($output) { return $output; } }); just change/duplicate the if statement to use the correct variable for your needs, e.g serviceID, productID, or groupID... 1 Quote Link to comment Share on other sites More sharing options...
kang28ivan Posted March 3, 2020 Share Posted March 3, 2020 Woo this works fine, thank you very much @brian! 😍 0 Quote Link to comment Share on other sites More sharing options...
Businezz Posted August 16, 2021 Share Posted August 16, 2021 On 3/3/2020 at 9:45 AM, brian! said: <?php add_hook('ClientAreaProductDetailsOutput', 1, function($service) { $serviceID = $service['service']->Id; $productID = $service['service']->packageId; $groupID = $service['service']->product->productGroupId; if (in_array($groupID, array('10','12'))) { $output .= '<div class="alert alert-success" role="alert"><div class="row"><div class="col-sm-1"><i class="fab fa-whmcs fa-3x"></i></div><div class="col-sm-11">Welcome to WHMCS!<br><small>buy the addon! ;-)</small></div></div></div>'; } if ($output) { return $output; } }); just change/duplicate the if statement to use the correct variable for your needs, e.g serviceID, productID, or groupID... Heyy, Question, Cn i move this notification bar, for example above Quick shortcuts section or all the way on the top at the beginning? By default showed all the way on the bottom. Thanks! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 3, 2021 Share Posted October 3, 2021 On 16/08/2021 at 17:05, Businezz said: Question, Cn i move this notification bar, for example above Quick shortcuts section or all the way on the top at the beginning? By default showed all the way on the bottom. technically, that location is defined in the template - so you could move its location (the hookouput foreach) by editing the template, or use a more generic output hook point and use JS to define the ideal location you want. 0 Quote Link to comment Share on other sites More sharing options...
Businezz Posted October 3, 2021 Share Posted October 3, 2021 2 minutes ago, brian! said: technically, that location is defined in the template - so you could move its location (the hookouput foreach) by editing the template, or use a more generic output hook point and use JS to define the ideal location you want. Thanks 🙂 0 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.