Filters with googlemap visualization

Status
Not open for further replies.

ricobzh

New Member
Hi guys, and thanks for the awesome job! I was able to do almost everything I wanted with Fabrik, except this:

I want to display a googlemap visualization with two connections. It's working well except for the filters!
I would like to display only the filters of the first list, not the second one.
Also I would like to change the order of the filter, without changing the order of the data in the list.

I tried everyting I could, including using the content plugin... but no luck so far!

Any idea?

Thanks!

Erik
 
I assume if you set the 2nd list to show no filters then there shouldn't be filters in the viz (not tested)

In any case you can create a custom viz template:
copy the folder plugins\fabrik_visualization\googlemap\views\googlemap\tmpl\default
rename
edit default_filter.php

Select this custom template in your viz.

See also http://fabrikar.com/wiki/index.php/3.x_List_Templates
 
I tried the first solution... It's not working!
I Will try the template one and let you know!

Thanks!
 
Little bit better!

Looks better, although now I see nothing in the filters but it may be a good beginning!
Going back to the white board!

Thanks again!
 

Attachments

  • Untitled.png
    Untitled.png
    45.6 KB · Views: 319
ok.. I played with custom templates and I think this is definitively the solution. However, I'm not a good PHP developer!
Do you kow where I could find a custom template displaying ony certain search fields for a given list?

Ex:
For my visualization, I would like to have:
Googlemap using 2 lists
Custom template that displays only some filters from list 1:
NAME - CITY - COUNTRY

I think that with a sample I can manage to do it!!! But I googled a lot and found almost nothing!

Thanks!
 
Actually I just found a nice piece of code by Rob - I removed the loop to display only one filter block for one table, but then when I want to add my filters, $filter = $this->filters['jos_caap_suppliers___Name']; is empty!!!!!!

Any idea?

I attached my template code.
 

Attachments

  • default_filter.txt
    1.4 KB · Views: 261
For debugging put
var_dump($this->filters);exit;
before
$filter =...

This should display a blank page showing you the filter array including element names and content
 
Sounds like it is there:
["jos_caap_suppliers___Name"]=> object(stdClass)#1901 (3) { ["label"]=> string(4) "Name" ["element"]=> string(29643) "" ["required"]=> string(1) "0" }
I can see the dropdown with all the data in it....

But not when I build the filters.

echo $filter->label echo $filter->label and echo $filter->element return nothing!
Strange!
 
Actually I'm missing the first part of the array I guess!

This is my code:

PHP:
<?php
/**
 * Default Google Map Viz Filter Template
 *
* @package      Joomla.Plugin
* @subpackage   Fabrik.visualization.googlemap
* @copyright    Copyright (C) 2005 Fabrik. All rights reserved.
* @license      GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die('Restricted access');
?>

<?php if ($this->showFilters)
{
?>
<form method="post" name="filter" action="<?php echo $this->filterFormURL; ?>">
<?php
	foreach ($this->filters as $table => $filters)
	{
		if ($table == 'Organizations')
		{
		?>
	  <table class="filtertable fabrikTable fabrikList">

	   <thead>
	  	<tr>
	  		<th><?php echo 'Filetrs' ?></th>
	  		<th style="text-align:right"><a href="#" class="clearFilters"><?php echo JText::_('CLEAR'); ?></a></th>
	  	</tr>
	  </thead>

	  <tfoot>
	  	<tr>
	  		<th colspan="2" style="text-align:right;">
	  			<input type="submit" class="button" value="<?php echo JText::_('GO') ?>" />
	  		</th>
	  	</tr>
	  </tfoot>

	  <tbody>
	  <?php
		$filter = $this->filters['jos_caap_suppliers___Name'];
		$required = $filter->required == 0 ? ' class="notempty"' : '';  
		?>
        <tr class="fabrik_row oddRow<?php echo (0 % 2);?>">
            <td<?php echo $required ?>><?php echo $filter->label;?></td>
            <td style="text-align:right;"><?php echo $filter->element;?></td>
        </tr>
	  </tbody>

	  </table>
	  <?php
		}
	}
	?>

</form>
<?php
}

And this is the var_dump:

Code:
array(2) { ["My Partners"]=> array(7) { ["jos_caap_suppliers___Name"]=> object(stdClass)#1876 (3) { ["label"]=> string(4) "Name" ["element"]=> string(1807) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___City"]=> object(stdClass)#1875 (3) { ["label"]=> string(4) "City" ["element"]=> string(1673) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Province"]=> object(stdClass)#1471 (3) { ["label"]=> string(8) "Province" ["element"]=> string(1497) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Type"]=> object(stdClass)#623 (3) { ["label"]=> string(17) "Organization Type" ["element"]=> string(1613) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Winter_Storage"]=> object(stdClass)#1408 (3) { ["label"]=> string(14) "Winter Storage" ["element"]=> string(1479) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Green_House"]=> object(stdClass)#1409 (3) { ["label"]=> string(11) "Green House" ["element"]=> string(1473) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Expandability"]=> object(stdClass)#1347 (3) { ["label"]=> string(13) "Expandability" ["element"]=> string(1371) "" ["required"]=> string(1) "0" } } ["Organizations"]=> array(11) { ["all"]=> object(stdClass)#1902 (3) { ["label"]=> string(3) "All" ["element"]=> string(427) "  " ["required"]=> string(0) "" } ["jos_caap_suppliers___Name"]=> object(stdClass)#1901 (3) { ["label"]=> string(4) "Name" ["element"]=> string(29643) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___City"]=> object(stdClass)#1900 (3) { ["label"]=> string(4) "City" ["element"]=> string(14695) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Province"]=> object(stdClass)#1888 (3) { ["label"]=> string(8) "Province" ["element"]=> string(1497) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Type"]=> object(stdClass)#1667 (3) { ["label"]=> string(17) "Organization Type" ["element"]=> string(1613) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Winter_Storage"]=> object(stdClass)#1668 (3) { ["label"]=> string(14) "Winter Storage" ["element"]=> string(1479) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Green_House"]=> object(stdClass)#1669 (3) { ["label"]=> string(11) "Green House" ["element"]=> string(1473) "" ["required"]=> string(1) "0" } ["jos_caap_suppliers___Expandability"]=> object(stdClass)#1670 (3) { ["label"]=> string(13) "Expandability" ["element"]=> string(1371) "" ["required"]=> string(1) "0" } ["jos_caap_products_availability___Product_Type"]=> object(stdClass)#1671 (3) { ["label"]=> string(12) "Product Type" ["element"]=> string(1890) "" ["required"]=> string(1) "0" } ["jos_caap_products_availability___Product"]=> object(stdClass)#1672 (3) { ["label"]=> string(7) "Product" ["element"]=> string(7982) "" ["required"]=> string(1) "0" } ["jos_caap_products_availability___Availability_EN"]=> object(stdClass)#1673 (3) { ["label"]=> string(12) "Availability" ["element"]=> string(1937) "" ["required"]=> string(1) "0" } } }
 
Solved!

My PHP is not really good!
Found the problem - I did not understand the concept of multi-arrays!

So here is the code now if anyone needs it!

Thanks again guys for posting here! This is how I fixed my problem!

PHP:
<?php
/**
 * Default Google Map Viz Filter Template
 *
* @package      Joomla.Plugin
* @subpackage   Fabrik.visualization.googlemap
* @copyright    Copyright (C) 2005 Fabrik. All rights reserved.
* @license      GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die('Restricted access');
?>

<?php if ($this->showFilters)
{
?>
<form method="post" name="filter" action="<?php echo $this->filterFormURL; ?>">
<?php
	foreach ($this->filters as $table => $filters)
	{
		if ($table == 'Organizations')
		{
		?>
	  <table class="filtertable fabrikTable fabrikList">

	   <thead>
	  	<tr>
	  		<th><?php echo 'Filters' ?></th>
	  		<th style="text-align:right"><a href="#" class="clearFilters"><?php echo JText::_('CLEAR'); ?></a></th>
	  	</tr>
	  </thead>

	  <tfoot>
	  	<tr>
	  		<th colspan="2" style="text-align:right;">
	  			<input type="submit" class="button" value="<?php echo JText::_('GO') ?>" />
	  		</th>
	  	</tr>
	  </tfoot>

	  <tbody>
	  <?php
	  /**var_dump($this->filters);exit; **/
		$filter = $this->filters['Organizations']['jos_caap_suppliers___Name'];
		/** $filter = $this->filter['jos_caap_suppliers___Name'];**/
		$required = $filter->required == 0 ? ' class="notempty"' : '';  
		?>
        <tr class="fabrik_row oddRow<?php echo (0 % 2);?>">
            <td<?php echo $required ?>><?php echo $filter->label;?></td>
            <td style="text-align:right;"><?php echo $filter->element;?></td>
        </tr>
	  </tbody>

	  </table>
	  <?php
		}
	}
	?>

</form>
<?php
}
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top