Results 1 to 6 of 6

Thread: Custom Layouts based on Account Type

  1. #1
    robh71 is offline Junior Member
    Join Date
    Nov 2007
    Posts
    2

    Cool Custom Layouts based on Account Type

    I would like to create multiple contact layouts and display the appropriate one based on an Account Type field.

    For example, I have custom fields that I want to see for Real Estate Agents and different custom fields for Mortgage Brokers and I would like to have a default layout for those contacts that do not have one of these types.

    How would I achieve this functionality using SugarCRM?

    Thanks,

    Rob

  2. #2
    sacramentojoe is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    447

    Default Re: Custom Layouts based on Account Type

    Hey Rob, this is an easy fix.
    in your EditView.php files and DetailView.php files there is a spot that looks like this.

    $xtpl=new XTemplate ('modules/Contacts/EditView.html');


    All you have to do is add a check before that.
    if($focus->custom_field_c == 'Realtor'){
    $xtpl=new XTemplate ('modules/Contacts/RealtorEditView.html');
    }elseif($focus->custom_field_c == 'Mortgage Broker'){
    $xtpl=new XTemplate ('modules/Contacts/BrokerEditView.html');
    }else{
    $xtpl=new XTemplate ('modules/Contacts/EditView.html');
    }

    Do the same for DetailView.php except change out the {*}EditView.html to be {*}DetailView.html

    hope this helps, let me know.

  3. #3
    robh71 is offline Junior Member
    Join Date
    Nov 2007
    Posts
    2

    Smile Re: Custom Layouts based on Account Type

    Oh that is just too swank.

    I am so unworthy!

    Thanks,

    Rob

    Quote Originally Posted by sacramentojoe
    Hey Rob, this is an easy fix.
    in your EditView.php files and DetailView.php files there is a spot that looks like this.

    $xtpl=new XTemplate ('modules/Contacts/EditView.html');


    All you have to do is add a check before that.
    if($focus->custom_field_c == 'Realtor'){
    $xtpl=new XTemplate ('modules/Contacts/RealtorEditView.html');
    }elseif($focus->custom_field_c == 'Mortgage Broker'){
    $xtpl=new XTemplate ('modules/Contacts/BrokerEditView.html');
    }else{
    $xtpl=new XTemplate ('modules/Contacts/EditView.html');
    }

    Do the same for DetailView.php except change out the {*}EditView.html to be {*}DetailView.html

    hope this helps, let me know.

  4. #4
    sacramentojoe is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    447

    Default Re: Custom Layouts based on Account Type

    Quote Originally Posted by robh71
    Oh that is just too swank.

    I am so unworthy!

    Thanks,

    Rob
    I'm guessing SWANK is a good thing.

    Let me know if you run into any issues.

    Have a good night/day/weekend.

    Joe

  5. #5
    orzo is offline Sugar Community Member
    Join Date
    May 2005
    Posts
    79

    Default Re: Custom Layouts based on Account Type

    Is this still the best approach or only approach with the new Metadata driven layouts since sugar 5?

  6. #6
    zilker is offline Member
    Join Date
    Jun 2010
    Posts
    10

    Default Re: Custom Layouts based on Account Type

    Hello there, working with version 5.5.3 & needed to know if these instructions are still accurate. EditView.html & DetailView.html don't seem to be located in the modules/Contacts/

    Thanks...

    Quote Originally Posted by sacramentojoe View Post
    Hey Rob, this is an easy fix.
    in your EditView.php files and DetailView.php files there is a spot that looks like this.

    $xtpl=new XTemplate ('modules/Contacts/EditView.html');


    All you have to do is add a check before that.
    if($focus->custom_field_c == 'Realtor'){
    $xtpl=new XTemplate ('modules/Contacts/RealtorEditView.html');
    }elseif($focus->custom_field_c == 'Mortgage Broker'){
    $xtpl=new XTemplate ('modules/Contacts/BrokerEditView.html');
    }else{
    $xtpl=new XTemplate ('modules/Contacts/EditView.html');
    }

    Do the same for DetailView.php except change out the {*}EditView.html to be {*}DetailView.html

    hope this helps, let me know.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. upgraded to 4.5.1e, received "Metadata for table tracker does not exist"
    By sfgeorge in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-09-03, 02:24 PM
  2. Replies: 1
    Last Post: 2006-11-24, 12:08 AM
  3. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  4. Replies: 7
    Last Post: 2006-06-06, 07:56 PM
  5. Lost custom layouts in upgrade to 4.0
    By emass in forum General Discussion
    Replies: 1
    Last Post: 2006-01-17, 01:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •