/**
  * Gets a single custom by virtuemart_custom_id
  * .
  * @param string $type
  * @param string $mime mime type of custom, use for exampel image
  * @return customobject
  */
 function getCustom()
 {
     if (empty($this->_data)) {
         //     		JTable::addIncludePath(JPATH_VM_ADMINISTRATOR.DS.'tables');
         $this->_data = $this->getTable('customs');
         $this->_data->load($this->_id);
         if (!$this->_id) {
             $field_type = JRequest::getWord('field_type', 0);
             if (!empty($field_type)) {
                 $this->_data->field_type = $field_type[0];
             } else {
                 var_dump($this->_data);
                 var_dump(jrequest::getVar('params'));
                 jexit('program faillure');
             }
             if ($this->_data->custom_jplugin_id = JRequest::getInt('custom_jplugin_id', 0)) {
                 $q = 'SELECT `element` FROM `#__extensions` WHERE `folder` = "vmcustom" AND `enabled`=1 ';
                 $q .= ' AND `extension_id` = ' . $this->_data->custom_jplugin_id;
                 $this->_db->setQuery($q);
                 $this->_data->custom_element = $this->_db->loadResult();
             }
         }
         $customfields = VmModel::getModel('Customfields');
         $this->_data->field_types = $customfields->getField_types();
         //    		vmdebug('getCustom $data',$this->_data);
         if (!empty($this->_data->custom_element)) {
             // set params
             $registry = new JRegistry();
             $registry->loadString($this->_data->custom_params);
             $this->_data->params = $registry->toArray();
             JPluginHelper::importPlugin('vmcustom');
             $dispatcher = JDispatcher::getInstance();
             //    			$varsToPushParam = $dispatcher->trigger('plgVmDeclarePluginParams',array('custom',$this->_data->custom_element,$this->_data->custom_jplugin_id));
             $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsCustom', array('custom', $this->_data->custom_element, $this->_data->custom_jplugin_id, &$this->_data));
             // Get the payment XML.
             $path = JPath::clean(JPATH_PLUGINS . '/vmcustom/' . $this->_data->custom_element . '/' . $this->_data->custom_element . '.xml');
             if (file_exists($path)) {
                 $this->_data->form = JForm::getInstance('plgForm', $path, array(), true, '//config');
                 // $this->_data->xml = simplexml_load_file($path);
                 $this->_data->form->bind($this->_data);
             } else {
                 $this->_data->form = null;
             }
         } else {
             $this->_data->form = null;
             //Todo this is not working, because the custom is using custom_params, while the customfield is using custom_param !
             //VirtueMartModelCustomfields::bindParameterableByFieldType($this->_data);
         }
     }
     return $this->_data;
 }
 /**
  * Create and return the pagination page list string, ie. Previous, Next, 1 2 3 ... x.
  *
  * @return  string  Pagination page list string.
  *
  * @since   11.1
  * overide to use bootstrap in j2.5
  */
 public function getPagesLinks()
 {
     $app = JFactory::getApplication();
     if (JVM_VERSION === 3 || $app->isSite() && jrequest::getVar('tmpl') !== 'component') {
         return parent::getPagesLinks();
     }
     // Build the page navigation list.
     $data = $this->_buildDataObject();
     $list = array();
     $list['prefix'] = $this->prefix;
     $itemOverride = false;
     // Build the select list
     if ($data->all->base !== null) {
         $list['all']['active'] = true;
         $list['all']['data'] = $this->pagination_item_active($data->all);
     } else {
         $list['all']['active'] = false;
         $list['all']['data'] = $this->pagination_item_inactive($data->all);
     }
     if ($data->start->base !== null) {
         $list['start']['active'] = true;
         $list['start']['data'] = $this->pagination_item_active($data->start);
     } else {
         $list['start']['active'] = false;
         $list['start']['data'] = $this->pagination_item_inactive($data->start);
     }
     if ($data->previous->base !== null) {
         $list['previous']['active'] = true;
         $list['previous']['data'] = $this->pagination_item_active($data->previous);
     } else {
         $list['previous']['active'] = false;
         $list['previous']['data'] = $this->pagination_item_inactive($data->previous);
     }
     $list['pages'] = array();
     //make sure it exists
     foreach ($data->pages as $i => $page) {
         if ($page->base !== null) {
             $list['pages'][$i]['active'] = true;
             $list['pages'][$i]['data'] = $this->pagination_item_active($page);
         } else {
             $list['pages'][$i]['active'] = false;
             $list['pages'][$i]['data'] = $this->pagination_item_inactive($page);
         }
     }
     if ($data->next->base !== null) {
         $list['next']['active'] = true;
         $list['next']['data'] = $this->pagination_item_active($data->next);
     } else {
         $list['next']['active'] = false;
         $list['next']['data'] = $this->pagination_item_inactive($data->next);
     }
     if ($data->end->base !== null) {
         $list['end']['active'] = true;
         $list['end']['data'] = $this->pagination_item_active($data->end);
     } else {
         $list['end']['active'] = false;
         $list['end']['data'] = $this->pagination_item_inactive($data->end);
     }
     if ($this->total > $this->limit) {
         return $this->pagination_list_render($list);
     } else {
         return '';
     }
 }