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

New with creating plugin for Virtuemart - stuck on creating

Started by Lenmen, February 17, 2015, 10:38:16 AM

Previous topic - Next topic

Lenmen

Hello everyone,

The first thing I have to announce is that I am a new with Virtuemart. At the moment I am struggling with making my own plugin for a custom field. The begin screen of selecting my plugin looks working fine. Image below



The next thing I thought was that on the edit screen on the product I would have the same options on the tab custom fields. But what I did expected didn't happend. I tried to test my code but nothing worked as I wanted.

Below the picture of the image on the edit screen



Below here the code I use for the plugin

Constructor

      parent::__construct($subject, $config);

//tmp settings
$this->_debug = true;
$this->_loggable = true;

// Create table
//$this->getVmPluginTableObject();

$this->tablepkey = 'id';
$this->tableFields = array_keys($this->getTableSQLFields());
$this->varsToPush = array(
'Day_iso' => array(array('test', 'test2'), 'dropdown'),
'Type' => array(0, 'int'),
'Created_at' => array('', 'date'),
'Updated_at' => array('', 'date'),
);

//$this->vmPlugin = new vmPlugin($subject, $config);

//$this->createPluginTableObject('#__product_expires', $this->getTableSQLFields(), 'id', 'id');

$this->setConfigParameterable('custom_params', $this->varsToPush);
$this->onStoreInstallPluginTable($this->_psType);   


plgVmOnProductEdit

if ($field->custom_element != $this->_name) return 'empty';
// $this->tableFields = array ( 'id', 'virtuemart_custom_id', 'custom_specification_default1', 'custom_specification_default2' );
$html = 'ON EDIT';
$retValue .= $html;
$row++;
return $html;


Other functions

function plgVmSetOnTablePluginParamsCustom($name, $id, &$table){
return $this->setOnTablePluginParams($name, $id, $table);
}

function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){
return $this->declarePluginParams('custom', $name, $id, $data);
}

/**
* Custom triggers note by Max Milbers
*/
function plgVmOnDisplayEdit($virtuemart_custom_id,&$customPlugin){
return $this->onDisplayEditBECustom($virtuemart_custom_id,$customPlugin);
}

function plgVmOnDisplayProductFE($product,&$idx,&$group) {
return FALSE;
}


What I am trying to do is to make a dropdown list like you saw on the first page. But I don't know where to look. I did take some look at the manuals but I got stuck.

I would appreciate your help.

Greetings,

Lenmen