Jump to content

Hide terminated products in client area?


mino

Recommended Posts

10 minutes ago, mino said:

Is it possible to hide terminated products from the client in the client area? with hook or other methode ? I want them to still be visible in the admin area but not the client area.

on the My Products & Services table ? I would have thought it would just need a hook to unset terminated products from the $services array...

Link to comment
Share on other sites

<?php

# Remove Terminated Products From Services Array Hook
# Written by brian! 

function clients_services_remove_terminated_hook($vars) {

	$services = $vars['services'];
	foreach($services as $key => $service) {
		if ($service['status'] == "Terminated") {
			unset($services[$key]);
		}
	}	
	return array("services" => $services);
}
add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook");
?>

you might need another hook to remove the Terminated link from the sidebar if you're showing that sidebar on your site... or even simpler, you should be able to hide it using custom.css thanks.png

Link to comment
Share on other sites

2 minutes ago, brian! said:

<?php

# Remove Terminated Products From Services Array Hook
# Written by brian! 

function clients_services_remove_terminated_hook($vars) {

	$services = $vars['services'];
	foreach($services as $key => $service) {
		if ($service['status'] == "Terminated") {
			unset($services[$key]);
		}
	}	
	return array("services" => $services);
}
add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook");
?>

you might need another hook to remove the Terminated link from the sidebar if you're showing that sidebar on your site. 

 

just in table need to hide, im test its work fine

thank you brian

Link to comment
Share on other sites

6 minutes ago, brian! said:

<?php

# Remove Terminated Products From Services Array Hook
# Written by brian! 

function clients_services_remove_terminated_hook($vars) {

	$services = $vars['services'];
	foreach($services as $key => $service) {
		if ($service['status'] == "Terminated") {
			unset($services[$key]);
		}
	}	
	return array("services" => $services);
}
add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook");
?>

you might need another hook to remove the Terminated link from the sidebar if you're showing that sidebar on your site. 

if you need hide other status ex: product cancel

how to add please

Link to comment
Share on other sites

1 hour ago, mino said:

Please @brian! if you need hide other status ex: product cancel

See the following modification

<?php

# Remove Products From Services Array Hook
# Written by brian! 

function clients_services_remove_terminated_hook($vars) {
    $hideStatus = array ('Terminated', 'Cancelled'); // add status which you want to hide here..
    $services = $vars['services'];
    foreach($services as $key => $service) {
        if (in_array($service['status'], $hideStatus)) {
            unset($services[$key]);
        }
    }
    return array("services" => $services);
}
add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook");
Edited by string
Somehow the community code editor does not like me. Formats code strange.
Link to comment
Share on other sites

9 hours ago, string said:

See the following modification


<?php

# Remove Products From Services Array Hook
# Written by brian! 

function clients_services_remove_terminated_hook($vars) {
    $hideStatus = array ('Terminated', 'Cancelled'); // add status which you want to hide here..
    $services = $vars['services'];
    foreach($services as $key => $service) {
        if (in_array($service['status'], $hideStatus)) {
            unset($services[$key]);
        }
    }
    return array("services" => $services);
}
add_hook("ClientAreaPageProductsServices", 1, "clients_services_remove_terminated_hook");

Thank you @string

Link to comment
Share on other sites

many thanks @string - I was on my way out when I replied to the thread (it was Saturday night after all!) so didn't see the further questions from @mino until this morning...

in case anyone else uses this hook in the future, if you wanted to hide the "Terminated" & "Cancelled" filters in the sidebar using css, you should only need to use..

#Primary_Sidebar-My_Services_Status_Filter-Terminated,
#Primary_Sidebar-My_Services_Status_Filter-Cancelled
{display: none;}

... i'm sure most will find that simpler than writing another hook. 🙂

Link to comment
Share on other sites

  • 3 weeks later...
1 hour ago, web2008 said:

Is it possible to do the same with Cancelled Domains?

yes - similar hook, you just have to change the array used and the hook point called...

<?php

# Remove Cancelled Domains From Array Hook
# Written by brian! 

function clients_domains_hide_cancelled_hook($vars) {
    $hideStatus = array ('Cancelled');
    $domains = $vars['domains'];
    foreach($domains as $key => $domain) {
        if (in_array($domain['status'], $hideStatus)) {
            unset($domains[$key]);
        }
    }
    return array("domains" => $domains);
}
add_hook("ClientAreaPageDomains", 1, "clients_domains_hide_cancelled_hook");

and then to hide the cancelled filter, you could remove it with another hook or hide it with css..

#Primary_Sidebar-My_Domains_Status_Filter-clientareacancelled
{display: none;}
Link to comment
Share on other sites

17 hours ago, plusplushosting said:

.just wondering if is possible add a button in the client side where clients can hide/show the terminated/cancelled products/domains? Or that is something cant be done with hooks?

don't the sidebar filters effectively do this already? e.g if I only want to see terminated products, I can click on the "Terminated" filter link; similarly for cancelled...

or are you thinking of some toggle setting on the sidebar ? if so, I guess that could be done as the hook could pull the current toggle value from the sidebar; adjust the array as required and refresh the page...

Link to comment
Share on other sites

14 minutes ago, brian! said:

don't the sidebar filters effectively do this already? e.g if I only want to see terminated products, I can click on the "Terminated" filter link; similarly for cancelled... 

yes, im an idiot :-)...ok then...is there any way that on any area, i mean (domains, invoices, services) by default when load the page show the (active, unpaid and active) domains, invoices and services?

Link to comment
Share on other sites

  • 2 weeks later...
18 hours ago, championc said:

Could this same method be used to allow all Custom Client Fields to be displayed using clientareaproductdetails.tpl ?  At present, all Admin Only fields are omitted whereas I want to include them.

not specifically this type of hook, but you could use a hook to do this if you had to (though I don't think that you need too) - see your other thread on this.

Link to comment
Share on other sites

  • 9 months later...
1 hour ago, upalm said:

But is there a way to hide the expired products under 'Submit Ticket's' too? As the expired products just clutters the 'submitticket.php'

are you talking about the related services dropdown?

F1WqUwP.png

if so, I posted a hook a year ago in the thread below than can be used to hide specific statuses (and optionally sort their order so that the active services are shown first)...

in your case, you would just change the line below in the hook to include all of the statuses that you want to hide...

$cancelled = array('Cancelled','Terminated','Expired','Grace Period (Expired)');
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Thanks for sharing these hooks, Brian!  Is there a way to not show the "Terminated" and "Cancelled" services in the default unfiltered list of all services (no filters checked), BUT still allow the client to click the "Terminated" or "Cancelled" filters and still view those statuses?  That way, the client still has the option to see the terminated and cancelled services, if they wish.

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