News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Two Issues With VMUserField Plug-in Functionality....

Started by jeffda, November 28, 2012, 01:25:57 AM

Previous topic - Next topic

jeffda

While developing a custom userfield plug-in, I've come across the following issues:

1) When adding a Shopper Field, after selecting the custom plug-in from the drop-down, the extra plug-in parameters section doesn't load any additionally required CSS/JavaScript libraries.

2) The extra plug-in parameters' form fields do not load the parameters from the database.

Possible fixes for item #2:


  • /administrator/components/com_virtuemart/views/userfields/view.html.php (Line 79): Change "$userField)" to "$userField->params)" or "$userField->get( 'params' ))"
  • /administrator/components/com_virtuemart/views/userfields/view.html.php (Method: renderUserfieldPlugin): Replace with the following:

function renderUserfieldPlugin($element = null, $params = null)
{
if (is_null( $element ) || is_null( $params )) {
$db = JFactory::getDBO();

if (JVM_VERSION===1) {
$table = '#__plugins';
$jelement = 'element';
} else {
$table = '#__extensions';
$jelement = 'element';
}
$q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `' . $jelement . '` = "'.$element.'"';
$db ->setQuery($q);
$this->plugin = $db ->loadObject();

$element = $this->plugin->element;
$params = $this->plugin->params;
}

$this->loadHelper('parameterparser');
$parameters = new vmParameters($params, $element, 'plugin', 'vmuserfield');
$lang = JFactory::getLanguage();
$filename = 'plg_vmuserfield_' .  $element;
$lang->load($filename, JPATH_ADMINISTRATOR);

return $parameters->render();
}


...and /administrator/components/com_virtuemart/views/userfields/view.html.php (Line 79) to:

$userFieldPlugin = self::renderUserfieldPlugin();

... /administrator/components/com_virtuemart/views/userfields/view.json.php (Line 49) also needs to be changed.