I’m trying to build a three step custom module for Drupal 7.
First page is a postcode search
Second page is a list of property addresses relating to the postcode
Third page is the full bin calendar details for that property.
The actual information is not that important, the important part that i’m struggling with is displaying the list of addresses on page2 after the user has submitted the postcode. This list will be a list of links that will link to page3.
Any advice would be much appreciated.
Thanks
Steven
I wouldn’t try to wrap all of that up into a custom module. What you’re describing is something that’s usually built using a combination of the Location module or Geofield and Views. Create a content type called “Property”, add a Location or Geofield provide the container for the locative info and then you’ll use Views to provide the search and display.
I’m not sure what you mean by “full bin calendar”. Is this for booking vacations? If so, I’d either build a calendar around an entity with a relationship to the property or use the Calendar module and tailor it to my needs.
I think there are too many moving parts to try to wrap it all up in a custom module. You could maybe build it into an installation profile like a turnkey installation.
Thanks but I should have gave a bit more detail.
We already have the data stored on an internal SQL server and we need to use this information.
We have all the addresses needed with each property having a unique Id.
We have all the bin collection dates stored against a property also stored in the SQL database.
So I guess I wouldn’t need the location Module.
Here’s where I am so far.
I have a custom module called bin_collections.
bin_collections.info
bin_collections.module
I have managed to create a postcode search that searches our SQL DB and returns the list of addresses on screen. I do have a problem with this as I can’t work out how to display a list of results on screen. I have used a simple loop that adds each address to the green message box. This isn’t ideal and I need a way of displaying the list in the main body of the page.
foreach($list as $record){
drupal_set_message($record[‘data’]);
}
From this list of linked addresses I manage to do another search to the SQL database and pull out all the bin collection information. I am again struggling to display this data in the main body. The data is an associative nested array.
I need to know how to display the results in the main body. I’ve tried the below code:
$output = array(
'first_para' => array(
'#type' => 'markup',
'#markup' => '<p>Your collection dates.</p>',
),
'content' => array(
'#items' => $list,
'#theme' => 'item_list',
),
);
return $output;
But this doesn’t work for the nested array.
Any and all help much appreciated.