Here's a reply from their side:
Any plugin can become compatible with our solution by adding just 2 functions it it's code.
Open the file: plugins/vmcustom/customfieldsforall/customfieldsforall.php
at the end there are 2 functions:
onGenerateCustomfilters
onFilteringCustomfilters
These 2 are called by custom filters. The 1st to check if a plugin can be used for filtering.
The 2nd during filtering.
Here's the full snippet:
public function onGenerateCustomfilters($name,$virtuemart_custom_id,&$data_type)
{
if(empty($name) || empty($virtuemart_custom_id) || $name!=$this->_name)return; //exec only for this plugin
$customfield=Customfield::getInstance($virtuemart_custom_id);
$custom_params=$customfield->getCustomfieldParams($virtuemart_custom_id);
if($custom_params=='color' && $custom_params!='color_hex'){
$data_type='color_name'; //use of color names
}
else $data_type=$custom_params;
if(empty($data_type))$data_type='string';
return true;
}
/**
* Hook for filtering from plugins
*
* The filtering can work either if the custom_values and the product_ids are in the same table
* Or if the custom_values use their own table and the custom_values->product_ids connection is happening in another table using the custom_value_ids
* In both cases there should be a field named virtuemart_custom_id in the custom_values table, that indicates the VM custom_id for these records
*
* @param string $name the plugin name as stored in the custom_element field of the virtuemart_customs table
* @param int $virtuemart_custom_id as stored in the virtuemart_customs table
* @param string $product_customvalues_table the name of the table where the custom_value->product relationship is saved-- Table alias: cfp
* @param string $customvalues_table the name of the table where the custom_values are saved -- Table alias: cf
* @param string $filter_by_field the column by which the filtering will be done. If 2 tables indicates the custom_value id in both of the above tables
* @param string $customvalue_value_field the field name where the custom value is stored in the table $customvalues_table
* @param string $filter_data_type the datatype of the field which will be used for filtering (string|int|float|boolean)
* @param string $sort_by The field by which the values/options will be sorted. name and id cane be applied to all
*/
public function onFilteringCustomfilters($name,$virtuemart_custom_id,&$product_customvalues_table,&$customvalues_table,&$filter_by_field,&$customvalue_value_field,&$filter_data_type,&$sort_by='name')
{
if(empty($name) || empty($virtuemart_custom_id) || $name!=$this->_name)return; //exec only for this plugin
$product_customvalues_table='#__virtuemart_product_custom_plg_customsforall';
//can be the same as above if the custom_values and the product ids are in the same table (as happens in built in custom fields)
$customvalues_table='#__virtuemart_custom_plg_customsforall_values';
$filter_by_field='customsforall_value_id';
$filter_data_type='int';
$customvalue_value_field='customsforall_value_name';
$sort_by='cf.ordering';
return true;
}
/**
* Hook for the stockableCustomfields plugin
* Returns the name of that plugin, so that custom fields from that can be used as stockables
*
* @return string
* @since 3.0
*/
public function onDetectStockables()
{
return $this->_name;
}
}
Please advise the changes I need to make in your code in order to display those.
Regards,
Martin