Jump to content
HEROCLOUDS

warning before checkout

Recommended Posts

17 minutes ago, HEROCLOUDS said:

how can i show a warning message like this?

editing viewcart.tpl would be the simplest way - using a hook would be another way, but the template's not expecting it, so you'd either have to hijack an existing alert variable, or create a new one... but if you create a new variable, you'd have to edit the template to output the text anyway... so you might as well ignore using hooks and just edit the template.

it's the block of code starting <div class="col-md-8"> where this message would be displayed, so just create an alert <div> similar to the ones already there to display your message.

Share this post


Link to post
Share on other sites

for a more complete answer, I should add that you could use a ShoppingCartViewCartOutput hook, but it's output will be shown in a different location than the one you specified.

q6PZkQX.png

Share this post


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

editing viewcart.tpl would be the simplest way - using a hook would be another way, but the template's not expecting it, so you'd either have to hijack an existing alert variable, or create a new one... but if you create a new variable, you'd have to edit the template to output the text anyway... so you might as well ignore using hooks and just edit the template.

it's the block of code starting <div class="col-md-8"> where this message would be displayed, so just create an alert <div> similar to the ones already there to display your message.

Hi @brian!  , I`m using   whmcs six template without any customization, i want to show a warning message in my  whmcs cart view like that website(screenshot), 🙄
can you share that hook? (i'm not good in coding) 🤔 

Share this post


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

for a more complete answer, I should add that you could use a ShoppingCartViewCartOutput hook, but it's output will be shown in a different location than the one you specified.

q6PZkQX.png

yes!!!! 
@brian! its what i asked😍 
give me that hook please🙂
 

Share this post


Link to post
Share on other sites
9 minutes ago, HEROCLOUDS said:

can you share that hook?

it's only 3 lines and basically what's in the docs...

<?php
add_hook('ShoppingCartViewCartOutput', 1, function($vars) {
	$return = '<div class="alert alert-warning text-center" role="alert"><b>Please Note:</b> please choose the correct currency before proceeding.</div>';
	return $return;
});

i'd be tempted to say if your site is multilingual that you should use a Language Override in that output.... but if not, don't worry about doing that.

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