Jump to content

Hook on order page


ZoukLover

Recommended Posts

Dear,

I need to display some content on the order page. Can someone provide any help?

 

I have added this: includes/hooks/example.php

add_hook('ViewOrderDetailsPage', 1, function($vars) {
    $return = [];

        $return[] = '<a href="https://www.whmcs.com/">WHMCS</a>';
        $return[] = '<a href="https://www.enom.com/">eNom</a>';


    return $return;
})
 

Link to comment
Share on other sites

3 hours ago, ZoukLover said:

I need to display some content on the order page.

if you check out the hooks docs, then the 'ViewOrderDetailsPage' hook doesn't return anything (arrays or HTML) - so I don't think this is an applicable hook for what you're trying to do.

perhaps you should try ShoppingCartCheckoutCompletePage as that would be more suitable if we're both talking about the same page.

Link to comment
Share on other sites

Hi,

 

Did a quick replace but still nothing shows:

 

<?php

if (!defined("WHMCS"))
    die("This file cannot be accessed directly");


add_hook('ShoppingCartCheckoutCompletePage', 1, function($vars) {
    $return = [];

        $return[] = '<a href="https://www.whmcs.com/">WHMCS</a>';
        $return[] = '<a href="https://www.enom.com/">eNom</a>';


    return $return;
})
 

Link to comment
Share on other sites

20 minutes ago, ZoukLover said:

Did a quick replace but still nothing shows:

that hook returns HTML, not an array - so you could do it like this...

<?php

if (!defined("WHMCS"))
    die("This file cannot be accessed directly");

add_hook('ShoppingCartCheckoutCompletePage', 1, function($vars) {
	
	$return = '<a href="https://www.whmcs.com/">WHMCS</a><br><a href="https://www.enom.com/">eNom</a>';	
	return $return;
});

Ufn4in5.png

Link to comment
Share on other sites

7 minutes ago, ZoukLover said:

I see that we are talking about a different page.

ok, the reason why you were trying ViewOrderDetailsPage makes sense - I missed that it was an admin hook. 🙄

24 minutes ago, ZoukLover said:

there wouldn't be an equivalent hook to do this on that admin page - possibly the best you could do (without resorting to js) would be to use an AdminAreaFooterOutput hook...

B0gSKNY.png

but you would only have very limited options in where these buttons / links were located...

Link to comment
Share on other sites

if it helps, below is the hook I quickly wrote to add those links (as BS buttons, but you could change them to links if you prefer) to that page...

<?php

add_hook('AdminAreaFooterOutput', 1, function($vars) {
	if ($vars['filename'] === 'orders' && $_GET['action'] === 'view') {
		$return = '<div class="text-center"><a href="https://www.whmcs.com/" class="btn btn-info">WHMCS</a>&nbsp;<a href="https://www.enom.com/" class="btn btn-primary">eNom</a></div>';	
		return $return;
	}
});
Link to comment
Share on other sites

Hi,

 

I have have the button on the products page. But still need help no the function

function imsimodule_ordem_servico()
{
///// need instruction to open new window with a url 


}


function imsimodule_AdminCustomButtonArray() {
   $buttonarray = array(
 "Ordem de Servico" => "ordem_servico",
);
return $buttonarray;
}


 

 

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