CRM Open Source Business & Social CRM Software

Results 1 to 3 of 3

Thread: Creating a custom button for Contact Search

  1. #1
    geraldclark is offline Sugar Community Member
    Join Date
    Nov 2008
    Posts
    22

    Default Creating a custom button for Contact Search

    Hello,

    I am new to SugarCRM and I have little PHP background but I am trying to create a custom button in the contacts module. I am not sure how to explain it but I will do my best.

    What I would like to happen is for a user to click on the "Contacts" tab and search for a list of contacts. When he has a list of search results to be able to click a button that says "Export Contacts to Webservice". When the button is clicked i would like to generate an array of all the contacts selected from the search and send them to a webservice. Is this possible? I can't seem to find anything on it.

    Thanks in advance.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,262

    Default Re: Creating a custom button for Contact Search

    Hi Gerald

    It is possible and I believe in a upgrade safe way.

    You can create a custom view.list.php for Contacts.
    Inside this custom view.list.php you define a new ListView object which extends the ListViewSmarty.
    This new ListView object can implement the buildExportLink function, which can render a new button into Pagination. This button can the the one you are talking about.
    When clicked in the button can handle all selected elements into mass element and send then to a php script which will send then to a webservice.

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    geraldclark is offline Sugar Community Member
    Join Date
    Nov 2008
    Posts
    22

    Default Re: Creating a custom button for Contact Search

    Andopes,

    Thank you very much for your response. I am still very unsure of what I am doing. I have created the "view.list.php" in my custom\modules\Contacts\views directory. Then I created a new class within the view.list.php file as shown below.

    Code:
    class NewViewList extends listViewSmarty 
    {         
        
    function NewViewList()        
    {  			
    parent::listViewSmarty();
    }   
    		  		   
    }
    I am unsure of what I do next. do I add a function along the lines of:

    Code:
    function process($file, $data, $htmlVar) 	
    {
    
    parent::process($file, $data, $htmlVar) ;
     	        
    if (isset($_REQUEST['module']) && ($_REQUEST['module']=='Contacts')
    {
    $this->ss->assign('WebServiceLink', $this->buildWebServiceLink($this->data['pageData']['offsets']['total']));
    }
    
    }
    this does not seem to do anything? Do I need to recreate the whole view.list.php file or can i just do
    require_once('include/MVC/View/views/view.list.php');?

    Currently I am just testing sugar so i went and edited the actual files just to see if i could add another button.

    I opened ListViewDisplay.php and added the function

    Code:
    function buildWebServiceLink($totalCount)
    { 
    global $app_strings;
    $script = '<input class="button" type="button" value="WebService" onclick="">'; 		return $script; 
    }
    I then went into ListViewSmarty.php and added this to the function process

    Code:
    if($_REQUEST['module']=='Contacts')
    {
    $this->ss->assign('WebServiceLink', $this->buildWebServiceLink($this->data['pageData']['offsets']['total']));
    }
    and finally i altered ListViewPagination.tpl to have {$WebServiceLink} below {$composeEmailLink}

    this does generate a button but i'm guessing is not upgrade safe. Can you give me a little more detail on this process? Are there any tutorials on this?
    Last edited by geraldclark; 2008-11-26 at 07:05 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 2009-10-06, 09:57 AM
  2. Replies: 1
    Last Post: 2008-02-06, 10:00 AM
  3. SugarOS-4.5.1c Installation ERROR
    By hazen in forum Installation and Upgrade Help
    Replies: 8
    Last Post: 2007-08-02, 07:16 PM
  4. Sugar CRM on XP / MySQL / Apache (No IIS)
    By play4god in forum Installation and Upgrade Help
    Replies: 3
    Last Post: 2007-05-12, 04:36 AM
  5. Contact Search Form - Custom Dropdown Field
    By aram in forum General Discussion
    Replies: 2
    Last Post: 2005-05-01, 04:57 AM

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
  •