Jump to content

Building new clientareahome.tpl


Jomart_123

Recommended Posts

im trying to build a new customer home page (clientarea.php)  as per image bellow, i need to pull customers data and add them to area marked in red, some of my customers have multiple website hosted on my server so i need to give them an option to select deferent websites (from the drop up menu) and to display data accordingly.

I think all the data that i need are stored on tblhosting + tbldomains tables but im not sure how to make every thing to work (using hooks, models ????? if models = Where to store the model files??? ) and then i need to know how to pass these data to clientareahome.tpl file.

IM TOTALY STOCKED ,   ...

I hope someone have the time to look this up for me? ASAP :-) 

 

7d44a96b1f356fcbd0d00c2597652db6_interfa

 

Link to comment
Share on other sites

On 11/24/2017 at 14:09, Jomart_123 said:

I think all the data that i need are stored on tblhosting + tbldomains tables but im not sure how to make every thing to work (using hooks, models ????? if models = Where to store the model files??? ) and then i need to know how to pass these data to clientareahome.tpl file.

if we just take products as a basic example, a variation on the previous hook would be all that's required...

<?php
use Illuminate\Database\Capsule\Manager as Capsule;

function hook_pullingCustomerData2($vars){

	$client = Menu::context('client');
	$hostingData = Capsule::table('tblhosting')
			->where('userid', $client->id)
			->where('domain','<>','')
			->select('id','domain')
			->get();
	$encodedata = json_encode($hostingData);
	$decodedata = json_decode($encodedata, true);

	return array("HostingData" => $decodedata);
}
add_hook("ClientAreaPageHome", 1, "hook_pullingCustomerData2");

that will give you a list of serviceIDs and the domain used by each...

and then in the template, to create an automatic dropdown from that array...

<select name="hosting" onchange="location = this.value;">
<option value="">{$LANG.cartproductdomainchoose}</option>
{foreach from=$HostingData item=hosting}
   <option value="clientarea.php?action=productdetails&id={$hosting.id}">{$hosting.domain}</option>
{/foreach}
</select>

just bear in mind that multiple products/services may use the same domain, so you may see duplicates in this list - so one option would be to pass the service name (which is more complicated as you'd have to query tblproducts for the name) along with the domain... if this won't affect you, don't worry about it.

then you can create a similar hook for tbldomains and do the same with a list of domain names to manage.

although in theory you could do both products and domains in the same list, there would certainly be duplicates.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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