/** * Handle the save task */ function save($data = 0){ vRequest::vmCheckToken(); $model = VmModel::getModel('config'); $data = vRequest::getPost(); if(strpos($data['offline_message'],'|')!==false){ $data['offline_message'] = str_replace('|','',$data['offline_message']); } $msg = ''; if ($model->store($data)) { $msg = vmText::_('COM_VIRTUEMART_CONFIG_SAVED'); // Load the newly saved values into the session. VmConfig::loadConfig(); } $redir = 'index.php?option=com_virtuemart'; if(vRequest::getCmd('task') == 'apply'){ $redir = $this->redirectPath; } $this->setRedirect($redir, $msg); }
function fetchElement() { $db = JFactory::getDBO(); $query = ''; require JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php'; VmConfig::loadConfig(); $query = 'SELECT a.virtuemart_category_id AS id, b.category_parent_id AS parent_id, b.category_parent_id AS parent, c. category_name AS title ' . 'FROM #__virtuemart_categories AS a ' . 'LEFT JOIN #__virtuemart_category_categories AS b ON a.virtuemart_category_id = b.category_child_id ' . 'LEFT JOIN #__virtuemart_categories_' . VMLANG . ' AS c ON a.virtuemart_category_id = c.virtuemart_category_id ' . 'WHERE a.published = 1 ' . 'ORDER BY a.ordering'; $db->setQuery($query); $menuItems = $db->loadObjectList(); $children = array(); if ($menuItems) { foreach ($menuItems as $v) { $pt = $v->parent_id; $list = isset($children[$pt]) ? $children[$pt] : array(); array_push($list, $v); $children[$pt] = $list; } } jimport('joomla.html.html.menu'); $options = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); $this->_xml->addChild('option', 'Root')->addAttribute('value', 0); if (count($options)) { foreach ($options as $option) { $this->_xml->addChild('option', htmlspecialchars(' - ' . $option->treename))->addAttribute('value', $option->id); } } $this->_value = $this->_form->get($this->_name, $this->_default); return parent::fetchElement(); }
public static function getInstance(&$query = null, $nolimit = false) { if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; VmConfig::loadConfig(); } $instanceKey = VMLANG; if (isset($query['langswitch'])) { if ($query['langswitch'] != VMLANG) { $instanceKey = $query['langswitch']; } unset($query['langswitch']); } if (!array_key_exists($instanceKey, self::$_instances)) { self::$_instances[$instanceKey] = new vmrouterHelperSEFforOPC($instanceKey, $query); if (empty($nolimit)) { if (self::$limit === null) { $mainframe = Jfactory::getApplication(); $view = 'virtuemart'; if (isset($query['view'])) { $view = $query['view']; } self::$limit = $mainframe->getUserStateFromRequest('com_virtuemart.' . $view . '.limit', VmConfig::get('list_limit', 20), 'int'); // self::$limit= $mainframe->getUserStateFromRequest('global.list.limit', 'limit', VmConfig::get('list_limit', 20), 'int'); } } } return self::$_instances[$instanceKey]; }
function display($tpl = null) { // Load the helper(s) if (!class_exists('VmConfig')) { require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart_countries'); if (!class_exists('VmHTML')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php'; } $model = VmModel::getModel('country'); $zoneModel = VmModel::getModel('worldzones'); $this->SetViewTitle(); $layoutName = JRequest::getWord('layout', 'default'); if ($layoutName == 'edit') { $country = $model->getData(); $this->assignRef('country', $country); $wzsList = $zoneModel->getWorldZonesSelectList(); $this->assignRef('worldZones', $wzsList); $this->addStandardEditViewCommands(); } else { $this->addStandardDefaultViewCommands(true, false); //First the view lists, it sets the state of the model $this->addStandardDefaultViewLists($model, 0, 'ASC'); $filter_country = JRequest::getWord('filter_country', false); $countries = $model->getCountries(false, false, $filter_country); $this->assignRef('countries', $countries); $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); } parent::display($tpl); }
protected function vm_require() { if (!class_exists('VmConfig')) { if (file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php')) { require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php'; } else { $this->error = 'Could not find VmConfig helper'; return false; } } VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart', true); if (!class_exists('VmModel')) { if (defined('JPATH_VM_ADMINISTRATOR') && file_exists(JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php')) { require JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php'; } else { $this->error = 'Could not find VmModel helper'; return false; } } if (defined('JPATH_VM_ADMINISTRATOR')) { JTable::addIncludePath(JPATH_VM_ADMINISTRATOR . '/tables'); } if (!class_exists('VirtueMartModelCustom')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'custom.php'; } if (!class_exists('VirtueMartModelCustomfields')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'customfields.php'; } return true; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ function getInput() { $key = $this->element['key_field'] ? $this->element['key_field'] : 'value'; $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name; VmConfig::loadConfig(); return JHtml::_('select.genericlist', $this->_getProducts(), $this->name, 'class="inputbox" ', 'value', 'text', $this->value, $this->id); }
/** * Save the file to the specified path * @return boolean TRUE on success */ function save($path, $filename) { $input = fopen("php://input", "r"); $temp = tmpfile(); $realSize = stream_copy_to_stream($input, $temp); fclose($input); if ($realSize != $this->getSize()) { return false; } $target = fopen($path, "w"); fseek($temp, 0, SEEK_SET); stream_copy_to_stream($temp, $target); fclose($target); //insert data into attachment table if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } $thumb_width = VmConfig::loadConfig()->get('img_width'); $user_s =& JFactory::getUser(); $user_id = $user_s->id; $product_vm_id = JRequest::getInt('virtuemart_product_id'); $database =& JFactory::getDBO(); $gallery = new stdClass(); $gallery->id = 0; $gallery->virtuemart_user_id = $user_id; $gallery->virtuemart_product_id = $product_vm_id; $gallery->file_name = $filename; $gallery->created_on = date('Y-m-d,H:m:s'); if (!$database->insertObject('#__virtuemart_product_attachments', $gallery, 'id')) { echo $database->stderr(); return false; } // end of insert data return true; }
protected function getOptions() { //check com_vituemart existed $path = JPATH_ADMINISTRATOR . '/components/com_virtuemart'; if (!is_dir($path) || !file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php')) { $this->options[] = JHtml::_('select.option', '', JText::_('COM_VIRTUEMART_NOT_EXIST')); } else { // Initialize variables require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php'; require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/models/category.php'; VmConfig::loadConfig(); $categoryModel = new VirtueMartModelCategory(); $categoryModel->_noLimit = true; $categories = $categoryModel->getCategories(); if (count($categories)) { // iterating $temp_options = array(); foreach ($categories as $item) { array_push($temp_options, array($item->virtuemart_category_id, $item->category_name, $item->category_parent_id)); } foreach ($temp_options as $option) { if ($option[2] == 0) { $this->options[] = JHtml::_('select.option', $option[0], $option[1]); $this->recursive_options($temp_options, 1, $option[0]); } } } } return $this->options; }
function onBeforeRender() { if ($this->app->isAdmin()) { return; } $app = JFactory::getApplication(); $option = $app->input->get('option'); $view = $app->input->get('view'); $tmpl = $app->input->get('tmpl'); $document = JFactory::getDocument(); if ($app->isSite() && $tmpl != 'component') { if (!defined('SMART_JQUERY') && (int) $this->params->get('include_jquery', '1')) { $document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery-1.8.2.min.js'); $document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery-noconflict.js'); define('SMART_JQUERY', 1); } if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); if (class_exists('vmJsApi')) { vmJsApi::jPrice(); } $document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery.fancybox.js'); $document->addStyleSheet(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/css/jquery.fancybox.css'); $document->addStyleSheet(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/css/quickview.css'); } return true; }
function onAfterRoute() { if (JFactory::getApplication()->isAdmin()) { return; } $input = JFactory::getApplication()->input; $document = JFactory::getDocument(); $app = JFactory::getApplication(); $template = $app->getTemplate(true); if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php'; } VmConfig::loadConfig(); $uri = JFactory::getURI(); $input = JFactory::getApplication()->input; $post = $input->post->getArray(); $_option = $input->getString('option'); $_view = $input->getString('view'); $_format = $input->getString('format'); $_task = $input->getString('task'); $_tmpl = $input->getString('tmpl'); if ($_option == 'com_virtuemart' && $_view == 'cart' && $_format != 'json') { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php'; } else { if ($_option == 'com_virtuemart' && $_view == 'vmplg' && $_task == "pluginUserPaymentCancel") { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php'; } else { if ($_option == 'com_virtuemart' && $_view == 'pluginresponse' && $_task == "pluginUserPaymentCancel") { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php'; } } } }
/** * Handle the save task * * @author RickG */ function save($data = 0){ JRequest::checkToken() or jexit( 'Invalid Token' ); $model = VmModel::getModel('config'); $data = JRequest::get('post'); $data['offline_message'] = JRequest::getVar('offline_message','','post','STRING',JREQUEST_ALLOWHTML); if(strpos($data['offline_message'],'|')!==false){ $data['offline_message'] = str_replace('|','',$data['offline_message']); } if ($model->store($data)) { $msg = JText::_('COM_VIRTUEMART_CONFIG_SAVED'); // Load the newly saved values into the session. VmConfig::loadConfig(); } else { $msg = $model->getError(); } $redir = 'index.php?option=com_virtuemart'; if(JRequest::getCmd('task') == 'apply'){ $redir = $this->redirectPath; } $this->setRedirect($redir, $msg); }
protected function getOptions() { // if VM is not installed if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_virtuemart') or !class_exists('ShopFunctions')) { // add the root item $option = new stdClass(); $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_NOTFOUND'); $option->value = '0'; $options[] = $option; // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } VmConfig::loadConfig(); $categorylist = ShopFunctions::categoryListTree(); // $categorylist = 'testced'; $categorylist = trim($categorylist, '</option>'); $categorylist = explode("</option><option", $categorylist); // add the root item $option = new stdClass(); $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_ROOTNODE'); $option->value = '0'; $options[] = $option; foreach ($categorylist as $cat) { $option = new stdClass(); $text = explode(">", $cat); $option->text = trim($text[1]); $option->value = strval(trim(trim(trim($text[0]), '"'), 'value="')); $options[] = $option; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
public function display($tpl = null) { if (!class_exists('VmConfig')) { require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); // Load the CSS $config = LiveUpdateConfig::getInstance(); $this->assign('config', $config); if (JVM_VERSION === 2) { JHtml::_('bootstrap.loadCss'); } if (!$config->addMedia()) { // No custom CSS overrides were set; include our own // $document = JFactory::getDocument(); // $url = JURI::base().'/components/'.JRequest::getCmd('option','').'/liveupdate/assets/liveupdate.css'; // $document->addStyleSheet($url, 'text/css'); } $requeryURL = 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&force=1'; $this->assign('requeryURL', $requeryURL); $extInfo = (object) $config->getExtensionInformation(); JToolBarHelper::title($extInfo->title . ' – ' . JText::_('LIVEUPDATE_TASK_OVERVIEW'), 'liveupdate'); if (version_compare(JVERSION, '1.6.0', 'ge')) { $msg = 'JTOOLBAR_BACK'; } else { $msg = 'Back'; } JToolBarHelper::back($msg, 'index.php?option=' . JRequest::getCmd('option', '')); switch (JRequest::getCmd('task', 'default')) { case 'startupdate': $this->setLayout('startupdate'); $this->assign('url', 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&task=download'); break; case 'install': $this->setLayout('install'); // Get data from the model $state =& $this->get('State'); // Are there messages to display ? $showMessage = false; if (is_object($state)) { $message1 = $state->get('message'); $message2 = $state->get('extension.message'); $showMessage = $message1 || $message2; } $this->assign('showMessage', $showMessage); $this->assignRef('state', $state); break; case 'overview': default: $this->setLayout('overview'); $force = JRequest::getInt('force', 0); $this->assign('updateInfo', LiveUpdate::getUpdateInformation($force)); $this->assign('runUpdateURL', 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&task=startupdate'); $needsAuth = !$config->getAuthorization() && $config->requiresAuthorization(); $this->assign('needsAuth', $needsAuth); break; } parent::display($tpl); }
function getInput() { VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart'); $model = VmModel::getModel('Manufacturer'); $manufacturers = $model->getManufacturers(true, true, false); return JHtml::_('select.genericlist', $manufacturers, $this->name, 'class="inputbox" ', 'value', 'text', $this->value, $this->id); }
protected function getCategories() { if (is_null($this->categories)) { $this->categories = array(); // set user language // $lang = JFactory::getLanguage(); // JRequest::setVar( 'vmlang', $lang->getTag() ); VmConfig::loadJLang('com_virtuemart', true); VmConfig::loadConfig(); $categoryModel = VmModel::getModel('category'); $categoryModel->_noLimit = true; $categories = $categoryModel->getCategories(0); if (!count($categories)) { return $this->categories; } // render tree //usort($categories, create_function('$a, $b', 'return $a->ordering > $b->ordering;')); $_categories = array(); $_children = array(); foreach ($categories as $i => $category) { $_categories[$category->virtuemart_category_id] =& $categories[$i]; } foreach ($categories as $i => $category) { $cid = $category->virtuemart_category_id; $pid = $category->category_parent_id; if (isset($_categories[$pid])) { if (!isset($_children[$pid])) { $_children[$pid] = array(); } $_children[$pid][$cid] = $cid; } } if (!count($_categories)) { return $this->categories; } $__categories = array(); $__levels = array(); foreach ($_categories as $cid => $category) { $pid = $category->category_parent_id; if (!isset($_categories[$pid])) { $queue = array($cid); $_categories[$cid]->level = 1; while (count($queue) > 0) { $qid = array_shift($queue); $__categories[$qid] =& $_categories[$qid]; if (isset($_children[$qid])) { foreach ($_children[$qid] as $child) { $_categories[$child]->level = $_categories[$qid]->level + 1; array_push($queue, $child); } } } } } $this->categories = $__categories; } return $this->categories; }
function fetchElement() { $vmversion = 0; if (!class_exists('VmConfig') && file_exists(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php')) { $vmversion = 2; } else { if (file_exists(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'compat.joomla1.5.php')) { $vmversion = 1; } } $db = JFactory::getDBO(); $query = ''; if ($vmversion == 1) { require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'virtuemart_parser.php'; $query = 'SELECT a. category_id AS id, b.category_parent_id AS parent_id, b.category_parent_id AS parent, a.category_name AS title, a.category_name AS name FROM #__vm_category AS a LEFT JOIN #__vm_category_xref AS b ON a.category_id = b.category_child_id WHERE a.category_publish LIKE "Y" ORDER BY a.list_order'; } else { if ($vmversion == 2) { require JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php'; VmConfig::loadConfig(); $query = 'SELECT a.virtuemart_category_id AS id, b.category_parent_id AS parent_id, b.category_parent_id AS parent, c. category_name AS title ' . 'FROM #__virtuemart_categories AS a ' . 'LEFT JOIN #__virtuemart_category_categories AS b ON a.virtuemart_category_id = b.category_child_id ' . 'LEFT JOIN #__virtuemart_categories_' . VMLANG . ' AS c ON a.virtuemart_category_id = c.virtuemart_category_id ' . 'WHERE a.published = 1 ' . 'ORDER BY a.ordering'; } else { return "Virtuemart not found!"; } } $db->setQuery($query); $menuItems = $db->loadObjectList(); $children = array(); if ($menuItems) { foreach ($menuItems as $v) { $pt = $v->parent_id; $list = isset($children[$pt]) ? $children[$pt] : array(); array_push($list, $v); $children[$pt] = $list; } } jimport('joomla.html.html.menu'); $options = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0); $this->_xml->addChild('option', 'Root')->addAttribute('value', 0); if (count($options)) { foreach ($options as $option) { $this->_xml->addChild('option', htmlspecialchars($option->treename))->addAttribute('value', $option->id); } } $this->_value = $this->_form->get($this->_name, $this->_default); $html = parent::fetchElement(); return $html; }
/** * Method to get the field input markup for Access Control Lists. * This is an overload of the core Rules form field * It address the issue where several rules cannot be used in the same configuration file */ protected function getInput() { VmConfig::loadConfig(); JHtml::_('behavior.tooltip'); if (JVM_VERSION < 3) { return $this->vmRulesJ25(); } else { return $this->vmRules(); } }
function getInput() { VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart'); $key = $this->element['key_field'] ? $this->element['key_field'] : 'value'; $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name; $model = VmModel::getModel('vendor'); $vendors = $model->getVendors(true, true, false); return JHtml::_('select.genericlist', $vendors, $this->name, 'class="inputbox" size="1"', 'virtuemart_vendor_id', 'vendor_name', $this->value, $this->id); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart'); $categorylist = ShopFunctions::categoryListTree(array($this->value)); $html = '<select class="inputbox" name="' . $this->name . '" >'; $html .= '<option value="0">' . vmText::_('COM_VIRTUEMART_CATEGORY_FORM_TOP_LEVEL') . '</option>'; $html .= $categorylist; $html .= "</select>"; return $html; }
public function __construct($params, $module) { $this->_params = $params; $this->_module = $module; if (!class_exists('VmConfig')) { return; } VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart', true); return $this; }
/** * method must be called after preflight * Sets the paths and loads VMFramework config */ public function loadVm() { // $this->path = JInstaller::getInstance()->getPath('extension_administrator'); if(empty($this->path)){ $this->path = VMPATH_ADMIN; } if(!class_exists('VmConfig')) require_once($this->path .'/helpers/config.php'); VmConfig::loadConfig(false,true); JTable::addIncludePath($this->path.DS.'tables'); VmModel::addIncludePath($this->path.DS.'models'); }
protected function getOptions() { VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart', false); $cModel = VmModel::getModel('currency'); $values = $cModel->getVendorAcceptedCurrrenciesList(); $options[] = JHtml::_('select.option', 0, vmText::_('COM_VIRTUEMART_DEFAULT_VENDOR_CURRENCY')); $options[] = JHtml::_('select.option', -1, vmText::_('COM_VIRTUEMART_SELECTED_MODULE_CURRENCY')); foreach ($values as $v) { $options[] = JHtml::_('select.option', $v->virtuemart_currency_id, $v->currency_txt); } return $options; }
function getInput() { VmConfig::loadConfig(); $model = VmModel::getModel('Manufacturer'); $manufacturers = $model->getManufacturers(true, true, false); $emptyOption = JHtml::_('select.option', '', vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'virtuemart_manufacturer_id', 'mf_name'); if (!empty($manufacturers) and is_array($manufacturers)) { array_unshift($manufacturers, $emptyOption); } else { $manufacturers = array($emptyOption); } return JHtml::_('select.genericlist', $manufacturers, $this->name, 'class="inputbox" size="1"', 'virtuemart_manufacturer_id', 'mf_name', $this->value, $this->id); }
function __construct($config = array()) { parent::__construct($config); if (!self::isInstalledDest('com_virtuemart')) { return false; } $this->baseLanguageTable = $this->getLanguageTableSuffix($this->baseLanguage); if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php'; } VmConfig::loadConfig(); $this->limit = 25; }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { VmConfig::loadConfig(); VmConfig::loadJLang('com_virtuemart'); $option = vRequest::getCmd('option'); if (!function_exists('curl_init') or !function_exists('curl_exec')) { return vmText::_('COM_VIRTUEMART_PS_CURL_LIBRARY_NOT_INSTALLED'); } else { $js = "\n jQuery(document).ready(function( \$ ) {\n \$( '#vmcurl' ) .closest('.control-group').hide();\n });\n "; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); return '<span id="vmcurl"></span>'; } }
function getVmLink($id, &$errorMsg) { if (JComponentHelper::isEnabled('com_virtuemart', true)) { if ((int) $id < 1) { return ""; } } else { return ""; } $db =& JFactory::getDBO(); $query = 'SELECT c.virtuemart_category_id AS catid, a.virtuemart_product_id AS id, a.published AS published, a.product_in_stock AS product_in_stock' . ' FROM #__virtuemart_product_categories AS c' . ' LEFT JOIN #__virtuemart_products AS a ON a.virtuemart_product_id = c.virtuemart_product_id' . ' WHERE c.virtuemart_product_id = ' . (int) $id; $db->setQuery($query, 0, 1); $product = $db->loadObject(); if (!$db->query()) { $this->setError($db->getErrorMsg()); $errorMsg = 'VirtueMart Product Not Found'; return false; } $catPart = ''; if (!empty($product->catid)) { $catPart = '&virtuemart_category_id=' . $product->catid; } $itemId = PhocaGalleryVirtueMart::_getVmItemid(); $link = 'index.php?option=com_virtuemart&view=productdetails' . '&virtuemart_product_id=' . (int) $id . $catPart . '&itemId=' . (int) $itemId; // Check PUBLISHED if (isset($product->published) && $product->published == 0) { $errorMsg = 'VirtueMart Product Not Published'; return ''; //don't display cart icon for unpublished product } // Check Stock if check stock feature is enabled //$component = 'com_virtuemart'; //$paramsC = JComponentHelper::getParams($component) ; if (is_file(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php')) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; VmConfig::loadConfig(); if (VmConfig::get('check_stock', 0) == 1) { // Check STOCK if (isset($product->product_in_stock) && $product->product_in_stock == 0) { $errorMsg = 'VirtueMart Product Not On Stock'; return ''; //don't display cart icon for non stock products } } } else { $errorMsg = 'VirtueMart Config Not Found'; return false; } return $link; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; } VmConfig::loadConfig(); $shippModel = VmModel::getModel('shipmentmethod'); $shipments = $shippModel->getShipments(); foreach ($shipments as $shipment) { $options[] = JHTML::_('select.option', $shipment->virtuemart_shipmentmethod_id, $shipment->shipment_name); } $html = JHTML::_('select.genericlist', $options, $this->name, 'class="inputbox"', 'value', 'text', $this->value); return $html; }
public static function getList(&$params) { if (!class_exists('VmConfig')) { return; } VmConfig::loadConfig(); JFactory::getLanguage()->load('com_virtuemart'); $items = array(); $list = array(); $_catids = $params->get('catid'); settype($_catids, 'array'); $catids = self::_getPublishCategories($_catids); if (empty($catids)) { return; } $limitation = (int) $params->get('source_limit', 8); $desc_maxlength = $params->get('item_desc_max_characs', 50); $source_group = null; $ordering_direction = $params->get('product_ordering_direction'); $source_order = $params->get('source_order', 'group.featured'); $p_special = $params->get('show_front'); $categoryModel = VmModel::getModel('Category'); $categoryModel->_noLimit = true; if (!empty($catids)) { $catids = self::_getChildCategories($catids, $params); $productModel = VmModel::getModel('Product'); $productModel = new VirtuemartModelProductExtend(); $productModel->filter_order = $source_order; $productModel->specail_product = $p_special; $productModel->ordering_direction = $ordering_direction; $items = $productModel->getProductListing($source_group, $limitation, true, true, false, true, $catids); $productModel->addImages($items); $ratingModel = VmModel::getModel('ratings'); foreach ($items as $item) { $item->title = $item->product_name; $item->id = $item->virtuemart_product_id; $item->description = $item->product_desc; self::getVmImages($item, $params); $item->short_desc = self::_cleanText($item->product_s_desc); $item->_description = self::_cleanText($item->description); $item->_description = $item->_description != '' ? self::truncate($item->_description, $desc_maxlength) : self::truncate($item->short_desc, $desc_maxlength); $item->vote = $ratingModel->getVoteByProduct($item->virtuemart_product_id); $item->rating = $ratingModel->getRatingByProduct($item->virtuemart_product_id); $list[] = $item; } } return $list; }
protected function getLabel() { $description = $this->element['description']; VmConfig::loadConfig(); $html = ''; $class = !empty($this->class) ? 'class="' . $this->class . '"' : ''; if (empty($class)) { $class .= "style=\"font-weight: bold; padding: 5px; background-color: #cacaca; float:none; clear:both;\""; } if ($this->value) { $html .= '<div ' . $class . '>'; $html .= vmText::_($this->value); $html .= '</div>'; } return $html; }
function getInput() { VmConfig::loadConfig(); if (VmConfig::get('enableEnglish', 1)) { $jlang = JFactory::getLanguage(); $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, 'en-GB', TRUE); $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, $jlang->getDefault(), TRUE); $jlang->load('com_virtuemart', JPATH_ADMINISTRATOR, NULL, TRUE); } $key = $this->element['key_field'] ? $this->element['key_field'] : 'value'; $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name; $model = VmModel::getModel('Orderstatus'); $orderStatus = $model->getOrderStatusList(); foreach ($orderStatus as $orderState) { $orderState->order_status_name = JText::_($orderState->order_status_name); } return JHTML::_('select.genericlist', $orderStatus, $this->name, 'class="inputbox" multiple="true" size="1"', 'order_status_code', 'order_status_name', $this->value, $this->id); }