Agifford Posted January 8, 2013 Share Posted January 8, 2013 This will seem so ridiculous, but I am such a newbie to PHP and anything other than HTML so I am LOST as to how to get my project working (on which my job depends right now). We use SUGAR CRM to manage our customers. I created an HTML front end in Joomla CMS with a design view similar to that of SUGAR. When the client logs in, they can view their sugar account information through the front end of Joomla. I have been provided a series of REST calls from developers at sugar, for the SUGAR API to retrieve information, and I have figured out how to call to objects (for instance using the variable <span class="sugar_field" id="name"><?=$rest->account->name ?></span>) , as the variable and the php code of <?php include_once('sugar/RestAPI/SugarRestAPI.php'); $rest = new SugarRestAPI(); $rest->retrieve_account(); $rest->retrieve_contacts(); ?> This would then retrieve the user account name. I however am now trying to pull all the contacts in SUGAR associated with an account, which I was able to do by creating a FOREACH loop. (since there are a variable amount of contacts per account) I want to create a "detail view" of the contact once it is clicked on (so I am assuming I would link the name of the contact to the "detail view" so that when the name is clicked on, it gives you the details of the contact, which can then have option to edit the contact from that screen. since there is no set number of contacts that can be associated with any given account, how do I reference the data from Contact1, contact2, contact3 ect to be displayed on any given "Detail view" page? I am assuming I cant use the variable <?=$rest->contacts[0]->first_name ?> because this assigns a specific ID and I am not sure which ID will need to be detailed out as the user might click on the detail view for ID 1. does this make sense? I was told the solution is this: You could add a counter to the foreach loop: $i = 0; foreach($rest->contacts as $contact) { // your link will have a dynamic href, so something like http://www.example.c...lview.php?id=$i $i++; } When you go to the detail view you can just use $rest->contacts[$_GET['id']]->first_name But I HAVE NO IDEA how to implement this into my code. Can someone help me? I also have no idea how to allow the information to POST back to SUGAR CRM once the form field is edited. I apologize for the beginner questions... but I would be so appreciative if someone might be able to hold my hand through this a little bit. Im a quick learner but I have no idea where to start!!! Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.