_tablepkey = 'id'; $this->tableFields = array_keys($this->getTableSQLFields()); $this->varsToPush = array( 'custom_specification_name1'=> array('', 'char'), 'custom_specification_default1'=> array('', 'string'), 'custom_specification_name2'=> array('', 'char'), 'custom_specification_default2'=> array('', 'string'), ); $this->setConfigParameterable('custom_params',$this->varsToPush); // self::$_this = $this; } /** * Create the table for this plugin if it does not yet exist. * @author Val�rie Isaksen */ public function getVmPluginCreateTableSQL() { return $this->createTableSQL('Product Specification Table'); } function getTableSQLFields() { $SQLfields = array( 'id' => 'int(11) unsigned NOT NULL AUTO_INCREMENT', 'virtuemart_product_id' => 'int(11) UNSIGNED DEFAULT NULL', 'virtuemart_custom_id' => 'int(11) UNSIGNED DEFAULT NULL', 'custom_specification_default1' => 'varchar(1024) NOT NULL DEFAULT \'\' ', 'custom_specification_default2' => 'varchar(1024) NOT NULL DEFAULT \'\' ' ); return $SQLfields; } /* * (only to add if you want Searchable Plugin) * * Render the search in category * @ $selectList the list contain all the possible plugin(+customparent_id) * @ &$searchCustomValues The HTML to render as search fields * */ public function plgVmSelectSearchableCustom(&$selectList,&$searchCustomValues,$virtuemart_custom_id) { $db =JFactory::getDBO(); $db->setQuery('SELECT `virtuemart_custom_id`, `custom_title` FROM `#__virtuemart_customs` WHERE `custom_element` ="'.$this->_name.'"'); if ($this->selectList = $db->loadAssocList() ) { foreach ($this->selectList as $selected_custom_id) { if ($virtuemart_custom_id == $selected_custom_id['virtuemart_custom_id']) { $searchCustomValues.=''; } } $selectList = array_merge((array)$this->selectList,$selectList); } return true; } /* * (only to add if you want Searchable Plugin) * * Extend the search in category * @ $where the list contain all the possible plugin(+customparent_id) * @ $PluginJoinTables The plg_name table to join on the search * (in normal case must be = to $this->_name) */ public function plgVmAddToSearch(&$where,&$PluginJoinTables,$custom_id) { if ($keyword = vmRequest::uword('custom_specification_name1', null, ' ')) { $db = JFactory::getDBO(); if ($this->_name != $this->GetNameByCustomId($custom_id)) return; $keyword = '"%' . $db->getEscaped( $keyword, true ) . '%"' ; $where[] = $this->_name .'.`custom_specification_default1` LIKE '.$keyword; $PluginJoinTables[] = $this->_name ; } return true; } // get product param for this plugin on edit function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) { if ($field->custom_element != $this->_name) return ''; // $this->tableFields = array ( 'id', 'virtuemart_custom_id', 'custom_specification_default1', 'custom_specification_default2' ); $this->getCustomParams($field); $this->getPluginCustomData($field, $product_id); // $data = $this->getVmPluginMethod($field->virtuemart_custom_id); // VmTable::bindParameterable($field,$this->_xParams,$this->_varsToPushParam); // $html =' '; $html ='
'; $html .='
'.$this->params->custom_specification_name1.'
'; $html .=''; $html .='
'.$this->params->custom_specification_name2.'
'; $html .=''; $html .=''; $html .='
'; // $field->display = $retValue .= $html ; $row++; return true ; } /** * @ idx plugin index * @see components/com_virtuemart/helpers/vmCustomPlugin::onDisplayProductFE() * @author Patrick Kohl * Display product */ function plgVmOnDisplayProductFE($product,&$idx,&$group) { // default return if it's not this plugin if ($group->custom_element != $this->_name) return ''; $this->_tableChecked = true; $this->getCustomParams($group); $this->getPluginCustomData($group, $product->virtuemart_product_id); // Here the plugin values //$html =JTEXT::_($group->custom_title) ; $group->display .= $this->renderByLayout('default',array($this->params,&$idx,&$group ) ); return true; } function plgVmOnStoreProduct($data,$plugin_param){ // $this->tableFields = array ( 'id', 'virtuemart_product_id', 'virtuemart_custom_id', 'custom_specification_default1', 'custom_specification_default2' ); return $this->OnStoreProduct($data,$plugin_param); } /** * We must reimplement this triggers for joomla 1.7 * vmplugin triggers note by Max Milbers */ public function plgVmOnStoreInstallPluginTable($psType) { return $this->onStoreInstallPluginTable($psType); } 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); } } // No closing tag