Custom fields are not displayed through the VM Mul

More
8 years 7 months ago #29708 by nordmograph
Yes, only VM core custom fields can be aded to the form + Some Nordmograph VMcustom plugins such as VM2tags (though not vmcustom anymore), vm2geolocator etc...

What vmcustom plugin would you like to be supported ?

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

Please Log in or Create an account to join the conversation.

More
8 years 7 months ago #29709 by 50price
Hope it won't be treated as some advert, but these guys have a bunch of plugins supporting different product types which I am using but cannot make them visible for Vendors:

breakdesigns.net/extensions

Hope that makes it clear.

Regards,
Martin

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #29732 by 50price
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

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #29772 by 50price
Hi,

I would appreciate if I could get an update on this.

Thanks,
Martin

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #29775 by nordmograph
Hi Martin,

I really don't get a clue on what you want to achive here.

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #29781 by 50price
I would like to know if it's possible to assit me in displaying this custom plugin.
According to them it is a piece of cake but I have no exact idea how to do this and where in your module to add those changes.

Regards,
Martin

Please Log in or Create an account to join the conversation.

Time to create page: 0.345 seconds
Powered by Kunena Forum
Disclaimer: Nordmograph is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.