/** * Get the available fields * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.3 */ protected function getOptions() { // Get the template ID $jinput = JFactory::getApplication()->input; $session = JFactory::getSession(); $sess_template_id = $session->get('com_csvi.select_template', 0); if ($sess_template_id !== 0) { $sess_template_id = unserialize($sess_template_id); } $template_id = $jinput->get('template_id', $sess_template_id, 'int'); // Load the selected template require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/template.php'; $template = new CsviTemplate(); $template->load($template_id); // Load the available fields require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/availablefields.php'; $availablefields_model = new CsviModelAvailablefields(); $fields = $availablefields_model->getAvailableFields($template->get('operation', 'options'), $template->get('component', 'options'), 'array'); if (!is_array($fields)) { $avfields = array(); } else { $avfields = array(); foreach ($fields as $field) { $avfields[$field] = $field; } } return array_merge(parent::getOptions(), $avfields); }
/** * Specify the options to load * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $template = $jinput->get('template', null, null); $db = JFactory::getDbo(); $query = $db->getQuery(true); $orderuser = $template->get('orderuser', 'order', array(), 'array'); if (!empty($orderuser)) { $query->select($db->qn('user_id', 'value')); $query->select($db->qn('name', 'text')); $query->from($db->qn('#__akeebasubs_subscriptions', 's')); $query->leftJoin($db->qn('#__users', 'u') . ' ON ' . $db->qn('s.user_id') . ' = ' . $db->qn('u.id')); $query->where($db->qn('s.user_id') . ' IN (' . implode(',', $orderuser) . ')'); $query->order($db->qn('name')); $query->group($db->qn('user_id')); $db->setQuery($query); $customers = $db->loadObjectList(); if (empty($customers)) { $customers = array(); } return array_merge(parent::getOptions(), $customers); } else { return parent::getOptions(); } }
/** * Specify the options to load * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $template = $jinput->get('template', null, null); $db = JFactory::getDbo(); $query = $db->getQuery(true); $orderproduct = $template->get('orderproduct', 'order', array(), 'array'); if (!empty($orderproduct)) { $query->select($db->quoteName('s') . '.' . $db->quoteName('akeebasubs_level_id', 'value')); $query->select($db->quoteName('title', 'text')); $query->from($db->quoteName('#__akeebasubs_subscriptions', 's')); $query->leftJoin($db->quoteName('#__akeebasubs_levels', 'l') . ' ON ' . $db->quoteName('s') . '.' . $db->quoteName('akeebasubs_level_id') . ' = ' . $db->quoteName('l') . '.' . $db->quoteName('akeebasubs_level_id')); $query->where($db->quoteName('s') . '.' . $db->quoteName('akeebasubs_level_id') . ' IN (' . implode(',', $orderproduct) . ')'); $query->order($db->quoteName('title')); $query->group($db->quoteName('s') . '.' . $db->quoteName('akeebasubs_level_id')); $db->setQuery($query); $products = $db->loadObjectList(); if (empty($products)) { $products = array(); } return array_merge(parent::getOptions(), $products); } else { return parent::getOptions(); } }
/** * Get the available fields * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.3 */ protected function getOptions() { // Load the available replacements $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS value, name AS text')->from('#__csvi_replacements')->order('ordering'); $db->setQuery($query); $replacements = $db->loadObjectList(); if (!is_array($replacements)) { $replacements = array(); } return array_merge(parent::getOptions(), $replacements); }
/** * Specify the options to load based on default site language * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $options = array(); $conf = JFactory::getConfig(); $lang = strtolower(str_replace('-', '_', $conf->get('language'))); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('virtuemart_manufacturer_id') . ' AS value,' . $db->quoteName('mf_name') . ' AS text'); $query->from($db->quoteName('#__virtuemart_manufacturers_' . $lang)); $db->setQuery($query); $options = $db->loadObjectList(); return array_merge(parent::getOptions(), $options); }
/** * Specify the options to load * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $options = array(); $db = JFactory::getDbo(); $db->setQuery('SELECT a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level' . ' FROM #__usergroups AS a' . ' LEFT JOIN ' . $db->qn('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt' . ' GROUP BY a.id, a.title, a.lft, a.rgt' . ' ORDER BY a.lft ASC'); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseNotice(500, $db->getErrorMsg()); return null; } foreach ($options as &$option) { $option->text = str_repeat('- ', $option->level) . $option->text; } return array_merge(parent::getOptions(), $options); }
/** * Specify the options to load based on default site language * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { // Get the default administrator language $params = JComponentHelper::getParams('com_languages'); $lang = strtolower(str_replace('-', '_', $params->get('administrator'))); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('virtuemart_paymentmethod_id AS value, payment_name AS text'); $query->from('#__virtuemart_paymentmethods_' . $lang); $db->setQuery($query); $methods = $db->loadObjectList(); if (empty($methods)) { $methods = array(); } return array_merge(parent::getOptions(), $methods); }
/** * Get the used payment processor names * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { // Get the default administrator language $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('processor', 'value')); $query->select($db->quoteName('processor', 'text')); $query->from($db->quoteName('#__akeebasubs_subscriptions')); $query->group($db->quoteName('processor')); $db->setQuery($query); $methods = $db->loadObjectList(); if (empty($methods)) { $methods = array(); } return array_merge(parent::getOptions(), $methods); }
/** * Specify the options to load based on default site language * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $conf = JFactory::getConfig(); $jinput = JFactory::getApplication()->input; $template = $jinput->get('template', null, null); $lang = strtolower($template->get('language', 'general', str_replace('-', '_', $conf->get('language')))); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->qn('virtuemart_manufacturer_id') . ' AS value,' . $db->qn('mf_name') . ' AS text'); $query->from($db->qn('#__virtuemart_manufacturers_' . $lang)); $db->setQuery($query); $options = $db->loadObjectList(); if (empty($options)) { $options = array(); } return array_merge(parent::getOptions(), $options); }
/** * Specify the options to load * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $jinput = JFactory::getApplication()->input; $jform = $jinput->get('jform', array(), 'array'); $trans = array(); if (!empty($jform) && isset($jform['options'])) { $db = JFactory::getDbo(); $q = "SELECT t.template_type_name\n\t\t\t\tFROM `#__csvi_template_types` AS t\n\t\t\t\tWHERE t.template_type = " . $db->Quote($jform['options']['action']) . "\n\t\t\t\tAND t.component = " . $db->Quote($jform['options']['component']); $db->setQuery($q); $types = $db->loadResultArray(); // Get translations foreach ($types as $type) { $trans[$type] = JText::_('COM_CSVI_' . strtoupper($type)); } } else { $trans = parent::getOptions(); } return $trans; }
/** * Specify the options to load * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $template = $jinput->get('template', null, null); $db = JFactory::getDbo(); $orderuser = $template->get('orderuser', 'order', array(), null); $userids = implode(',', $orderuser); if (!empty($userids)) { $q = "SELECT DISTINCT user_id,\n\t\t\t\tIF (LENGTH(TRIM(CONCAT(first_name, ' ', middle_name, ' ', last_name))) = 0, '" . JText::_('COM_CSVI_EXPORT_ORDER_USER_EMPTY') . "',\n\t\t\t\tIF (TRIM(CONCAT(first_name, ' ', middle_name, ' ', last_name)) is NULL, '" . JText::_('COM_CSVI_EXPORT_ORDER_USER_EMPTY') . "', CONCAT(first_name, ' ', middle_name, ' ', last_name))) AS user_name\n\t\t\t\tFROM #__virtuemart_order_userinfos\n\t\t\t\tWHERE user_id IN (" . $userids . ")\n\t\t\t\tORDER BY user_name;"; $db->setQuery($q); $customers = $db->loadObjectList(); if (empty($customers)) { $customers = array(); } return array_merge(parent::getOptions(), $customers); } else { return parent::getOptions(); } }
/** * Specify the options to load * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $jinput = JFactory::getApplication()->input; $jform = $jinput->get('jform', array(), 'array'); $trans = array(); if (!empty($jform) && isset($jform['options'])) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->qn('template_type_name'))->from($db->qn('#__csvi_template_types'))->where($db->qn('template_type') . ' = ' . $db->q($jform['options']['action']))->where($db->qn('component') . ' = ' . $db->q($jform['options']['component']))->where($db->qn('published') . '= 1')->order($db->qn('ordering')); $db->setQuery($query); $types = $db->loadColumn(); // Get translations foreach ($types as $type) { $trans[$type] = JText::_('COM_CSVI_' . strtoupper($type)); } } else { $trans = parent::getOptions(); } return $trans; }
/** * Specify the options to load * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.0 */ protected function getOptions() { $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $template = $jinput->get('template', null, null); $db = JFactory::getDbo(); $products = $template->get('orderitemproduct', 'orderitem', array(), null); $skus = implode(',', $products); if (!empty($skus)) { foreach ($products as $pkey => $product) { $products[$pkey] = $db->Quote($product); } $q = "SELECT DISTINCT product_sku, product_name\n\t\t\t\tFROM #__virtuemart_products p, #__virtuemart_order_items o\n\t\t\t\tWHERE p.virtuemart_product_id = o.virtuemart_product_id\n\t\t\t\tAND p.product_sku IN (" . skus . ")\n\t\t\t\tORDER BY product_name;"; $db->setQuery($q); $orderitemproducts = $db->loadObjectList(); if (empty($orderitemproducts)) { $orderitemproducts = array(); } return array_merge(parent::getOptions(), $orderitemproducts); } else { return parent::getOptions(); } }
/** * Get the available fields * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return array an array of options * @since 4.3 */ protected function getOptions() { // Get the template ID $jinput = JFactory::getApplication()->input; $session = JFactory::getSession(); $sess_template_id = $session->get('com_csvi.select_template', 0); if ($sess_template_id !== 0) { $sess_template_id = unserialize($sess_template_id); } $template_id = $jinput->get('template_id', $sess_template_id, 'int'); // Load the fields associated to the template $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS value, CONCAT(field_name, " (", file_field_name, "|", id,")") AS text'); $query->from($db->qn('#__csvi_template_fields')); $query->where($db->qn('template_id') . ' = ' . $template_id); $query->order($db->qn('ordering')); $db->setQuery($query); $fields = $db->loadObjectList(); if (!is_array($fields)) { $fields = array(); } return array_merge(parent::getOptions(), $fields); }