<?php
/**
 * Marketplace - Component Marketplace 
 * ******************************************************************
 *
 * PHP version 7.0
 *
 * @category   Component
 * @package    Joomla
 * @author     WebKul software private limited <support@webkul.com>
 * @copyright  2010 WebKul software private limited
 * @license    http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @version    GIT:5.2
 * @filesource http://store.webkul.com
 * @link       Technical Support:  webkul.uvdesk.com
 * ******************************************************************
 */
defined('_JEXEC') or die('Restricted access');
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
if (!class_exists('Vmconfig')) {
    include JPATH_ADMINISTRATOR.
        '/components/com_virtuemart/helper/config.php';
}
/**
 * JFormFieldVmcategory class
 * 
 * @category Component
 * @package  Joomla
 * @author   WebKul software private limited <support@webkul.com>
 * @license  http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @link     Technical Support:  webkul.uvdesk.com
 */
class JFormFieldVmcategory extends JFormFieldList
{
    protected $type = 'Vmcategory';
    /**
     * GetOptions function
     *
     * @return void
     */
    public function getOptions()
    {
        $vmlang=VmConfig::$vmlang;
        $options=array();
        $db     = JFactory::getDbo();
        $query  = $db->getQuery(true);
        $query->select('virtuemart_category_id AS value, category_name AS text');
        $query->from('`#__virtuemart_categories_'.$vmlang.'`');
        $db->setQuery($query);
        $options=$db->loadObjectList();
        return array_merge(parent::getOptions(), $options);
    }
}
