Exemplo n.º 1
0
 /**
  * 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;
     tsmConfig::loadConfig();
     return JHtml::_('select.genericlist', $this->_getProducts(), $this->name, 'class="inputbox"   ', 'value', 'text', $this->value, $this->id);
 }
Exemplo n.º 2
0
 protected function getOptions()
 {
     tsmConfig::loadConfig();
     // 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_SLIDESHOWCK_VIRTUEMART_NOTFOUND');
         $option->value = '0';
         $options[] = $option;
         // Merge any additional options in the XML definition.
         $options = array_merge(parent::getOptions(), $options);
         return $options;
     }
     $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_SLIDESHOWCK_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;
 }
 function getInput()
 {
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart');
     $model = tmsModel::getModel('Manufacturer');
     $manufacturers = $model->getManufacturers(true, true, false);
     return JHtml::_('select.genericlist', $manufacturers, $this->name, 'class="inputbox"   ', 'value', 'text', $this->value, $this->id);
 }
Exemplo n.º 4
0
 /**
  * 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()
 {
     tsmConfig::loadConfig();
     JHtml::_('behavior.tooltip');
     if (JVM_VERSION < 3) {
         return $this->vmRulesJ25();
     } else {
         return $this->vmRules();
     }
 }
Exemplo n.º 5
0
 function getInput()
 {
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart');
     $key = $this->element['key_field'] ? $this->element['key_field'] : 'value';
     $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name;
     $model = tmsModel::getModel('vendor');
     $vendors = $model->getVendors(true, true, false);
     return JHtml::_('select.genericlist', $vendors, $this->name, 'class="inputbox"  size="1"', 'tsmart_vendor_id', 'vendor_name', $this->value, $this->id);
 }
Exemplo n.º 6
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart');
     $categorylist = ShopFunctions::categoryListTree(array($this->value));
     $html = '<select class="inputbox"   name="' . $this->name . '" >';
     $html .= '<option value="0">' . tsmText::_('com_tsmart_CATEGORY_FORM_TOP_LEVEL') . '</option>';
     $html .= $categorylist;
     $html .= "</select>";
     return $html;
 }
Exemplo n.º 7
0
 function getInput()
 {
     tsmConfig::loadConfig();
     $model = tmsModel::getModel('Manufacturer');
     $manufacturers = $model->getManufacturers(true, true, false);
     $emptyOption = JHtml::_('select.option', '', tsmText::_('com_tsmart_LIST_EMPTY_OPTION'), 'tsmart_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"', 'tsmart_manufacturer_id', 'mf_name', $this->value, $this->id);
 }
Exemplo n.º 8
0
 protected function getOptions()
 {
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart', false);
     $cModel = tmsModel::getModel('currency');
     $values = $cModel->getVendorAcceptedCurrrenciesList();
     $options[] = JHtml::_('select.option', 0, tsmText::_('com_tsmart_DEFAULT_VENDOR_CURRENCY'));
     $options[] = JHtml::_('select.option', -1, tsmText::_('com_tsmart_SELECTED_MODULE_CURRENCY'));
     foreach ($values as $v) {
         $options[] = JHtml::_('select.option', $v->tsmart_currency_id, $v->currency_txt);
     }
     return $options;
 }
Exemplo n.º 9
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart');
     $option = vRequest::getCmd('option');
     if (!function_exists('curl_init') or !function_exists('curl_exec')) {
         return tsmText::_('com_tsmart_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>';
     }
 }
Exemplo n.º 10
0
 protected function getLabel()
 {
     $description = $this->element['description'];
     tsmConfig::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 .= tsmText::_($this->value);
         $html .= '</div>';
     }
     return $html;
 }
Exemplo n.º 11
0
 /**
  * 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('tsmConfig')) {
         require_once $this->path . '/helpers/config.php';
     }
     tsmConfig::loadConfig(false, true);
     if (!class_exists('tsmTable')) {
         require_once $this->path . '/helpers/tsmtable.php';
     }
     if (!class_exists('tmsModel')) {
         require_once $this->path . '/helpers/tsmmodel.php';
     }
     tsmTable::addIncludePath($this->path . DS . 'tables');
     tmsModel::addIncludePath($this->path . DS . 'models');
 }
Exemplo n.º 12
0
 function getInput()
 {
     defined('DS') or define('DS', DIRECTORY_SEPARATOR);
     if (!class_exists('tsmConfig')) {
         require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_tsmart' . DS . 'helpers' . DS . 'config.php';
     }
     if (!class_exists('tmsModel')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmmodel.php';
     }
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart');
     $key = $this->element['key_field'] ? $this->element['key_field'] : 'value';
     $val = $this->element['value_field'] ? $this->element['value_field'] : $this->name;
     $model = tmsModel::getModel('Orderstatus');
     $orderStatus = $model->getOrderStatusList(true);
     foreach ($orderStatus as $orderState) {
         $orderState->order_status_name = tsmText::_($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);
 }
Exemplo n.º 13
0
 /**
  * Handle the save task
  */
 function save($data = 0)
 {
     vRequest::vmCheckToken();
     $model = tmsModel::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 = tsmText::_('com_tsmart_CONFIG_SAVED');
         // Load the newly saved values into the session.
         tsmConfig::loadConfig();
     }
     $redir = 'index.php?option=com_tsmart';
     if (vRequest::getCmd('task') == 'apply') {
         $redir = $this->redirectPath;
     }
     $this->setRedirect($redir, $msg);
 }
Exemplo n.º 14
0
 protected function getInput()
 {
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart');
     if (!is_array($this->value)) {
         $this->value = array($this->value);
     }
     $categorylist = ShopFunctions::categoryListTree($this->value);
     $name = $this->name;
     if ($this->multiple) {
         $name = $this->name;
         $this->multiple = ' multiple="multiple" ';
     }
     $html = '<select class="inputbox"   name="' . $name . '" ' . $this->multiple . ' >';
     if (!$this->multiple) {
         $html .= '<option value="0">' . tsmText::_('com_tsmart_CATEGORY_FORM_TOP_LEVEL') . '</option>';
     }
     $html .= $categorylist;
     $html .= "</select>";
     return $html;
 }
Exemplo n.º 15
0
 /**
  * Parse a sql file executing each sql statement found.
  *
  * @author Max Milbers
  */
 function execSQLFile($sqlfile)
 {
     // Check that sql files exists before reading. Otherwise raise error for rollback
     if (!file_exists($sqlfile)) {
         vmError('execSQLFile, SQL file not found!');
         return false;
     }
     if (!class_exists('tsmConfig')) {
         require_once VMPATH_ADMIN . '/helpers/config.php';
         tsmConfig::loadConfig(false, true);
     }
     if (!tsmConfig::$vmlang) {
         $params = JComponentHelper::getParams('com_languages');
         $lang = $params->get('site', 'en-GB');
         //use default joomla
         $lang = strtolower(strtr($lang, '-', '_'));
     } else {
         $lang = tsmConfig::$vmlang;
     }
     // Create an array of queries from the sql file
     jimport('joomla.installer.helper');
     $db = JFactory::getDBO();
     $queries = $db->splitSql(file_get_contents($sqlfile));
     if (count($queries) == 0) {
         vmError('SQL file has no queries!');
         return false;
     }
     $ok = true;
     // Process each query in the $queries array (split out of sql file).
     foreach ($queries as $k => $query) {
         if (empty($query)) {
             vmWarn('execSQLFile Query was empty in file ' . $sqlfile);
             continue;
         }
         $query = trim($query);
         $queryLines = explode("\n", $query);
         //vmdebug('test',$queryLines);
         foreach ($queryLines as $n => $line) {
             if (empty($line)) {
                 unset($queryLines[$n]);
             } else {
                 if (strpos($line, 'CREATE') !== false or strpos($line, 'INSERT') !== false) {
                     $queryLines[$n] = str_replace('XLANG', $lang, $line);
                 }
             }
         }
         $query = implode("\n", $queryLines);
         if (!empty($query)) {
             $db->setQuery($query);
             if (!$db->execute()) {
                 vmWarn('JInstaller::install: ' . $sqlfile . ' ' . tsmText::_('com_tsmart_SQL_ERROR') . " " . $db->stderr(true));
                 $ok = false;
             }
         }
     }
     return $ok;
 }
Exemplo n.º 16
0
 /**
  * Content Search method
  * The sql must return the following fields that are used in a common display
  * routine: href, title, section, created, text, browsernav
  *
  * @param string $text Target search string
  * @param string $phrase matching option, exact|any|all
  * @param string $ordering ordering option, newest|oldest|popular|alpha|category
  * @param mixed  $areas An array if the search it to be restricted to areas, null if search all
  *
  * @return array An array of database result objects
  */
 function onContentSearch($text, $phrase = '', $ordering = '', $areas = NULL)
 {
     $db = JFactory::getDbo();
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     $limit = $this->params->get('search_limit', 50);
     switch ($this->params->get('subtitledisplay', '1')) {
         case '1':
             $category_field = 'category_name';
             break;
         case '2':
             $category_field = 'customtitle';
             break;
     }
     $search_product_description = (bool) $this->params->get('enable_product_description_search', TRUE);
     $search_product_s_description = (bool) $this->params->get('enable_product_short_description_search', TRUE);
     $search_customfields = (bool) $this->params->get('enable_customfields', TRUE);
     $customfield_ids_condition = "";
     if ($search_customfields) {
         $value = trim($this->params->get('customfields', ""));
         // Remove all spaces
         $value = str_replace(' ', '', $value);
         if (!empty($value)) {
             $customfield_ids = explode(",", $value);
             // Make sure we have only integers
             foreach ($customfield_ids as &$id) {
                 $id = intval($id);
             }
             // The custom field ID must be either in the list specified or NULL.
             $customfield_ids_condition = "AND cf.virtuemart_custom_id IN (" . implode(',', $customfield_ids) . ")";
         }
     }
     if (!class_exists('tsmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     tsmConfig::loadConfig();
     $text = trim($text);
     if (empty($text)) {
         return array();
     }
     switch ($phrase) {
         case 'exact':
             $wheres2 = array();
             // product_sku should be exact match
             $wheres2[] = "p.product_sku=" . $db->quote($text, TRUE);
             $text = $db->quote("%{$text}%", TRUE);
             $wheres2[] = "a.product_name LIKE {$text}";
             $wheres2[] = "b.{$category_field} LIKE {$text}";
             if ($search_product_s_description) {
                 $wheres2[] = "a.product_s_desc LIKE {$text}";
             }
             if ($search_product_description) {
                 $wheres2[] = "a.product_desc LIKE {$text}";
             }
             if ($search_customfields) {
                 $wheres2[] = "(cf.customfield_value LIKE {$text} {$customfield_ids_condition})";
             }
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $wheres2 = array();
                 // product_sku should be exact match
                 $wheres2[] = "p.product_sku=" . $db->quote($word, TRUE);
                 $word = $db->quote("%{$word}%", TRUE);
                 $wheres2[] = "a.product_name LIKE {$word}";
                 $wheres2[] = "b.{$category_field} LIKE {$word}";
                 if ($search_product_s_description) {
                     $wheres2[] = "a.product_s_desc LIKE {$word}";
                 }
                 if ($search_product_description) {
                     $wheres2[] = "a.product_desc LIKE {$word}";
                 }
                 if ($search_customfields) {
                     $wheres2[] = "(cf.customfield_value LIKE {$word} {$customfield_ids_condition})";
                 }
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     switch ($ordering) {
         case 'alpha':
             $order = 'a.product_name ASC';
             break;
         case 'category':
             $order = 'b.category_name ASC, a.product_name ASC';
             break;
         case 'popular':
             $order = 'a.product_name ASC';
             break;
         case 'newest':
             $order = 'p.created_on DESC';
             break;
         case 'oldest':
             $order = 'p.created_on ASC';
             break;
         default:
             $order = 'a.product_name ASC';
     }
     $shopper_group_condition = "";
     $currentVMuser = tmsModel::getModel('user')->getUser();
     $virtuemart_shoppergroup_ids = (array) $currentVMuser->shopper_groups;
     if (is_array($virtuemart_shoppergroup_ids)) {
         $sgrgroups = array();
         foreach ($virtuemart_shoppergroup_ids as $virtuemart_shoppergroup_id) {
             $sgrgroups[] = 'psgr.`virtuemart_shoppergroup_id`= "' . (int) $virtuemart_shoppergroup_id . '" ';
         }
         $sgrgroups[] = 'psgr.`virtuemart_shoppergroup_id` IS NULL ';
         $shopper_group_condition = " AND ( " . implode(' OR ', $sgrgroups) . " ) ";
     }
     $uncategorized_products_condition = tsmConfig::get('show_uncat_child_products') ? '' : ' AND b.virtuemart_category_id > 0 ';
     $query = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\tCONCAT( a.product_name, ' (', p.product_sku, ')' ) AS title,\n\t\t\t\t\ta.virtuemart_product_id,\n\t\t\t\t\ta.product_s_desc AS text,\n\t\t\t\t\tp.created_on as created,\n\t\t\t\t\t'2' AS browsernav,\n\t\t\t\t\tGROUP_CONCAT(DISTINCT b.{$category_field}\n\t\t\t\t\t\tORDER BY b.{$category_field} SEPARATOR ', ') as section,\n\t\t\t\t\t(SELECT pc2.virtuemart_category_id\n\t\t\t\t\t\tFROM #__virtuemart_product_categories as pc2\n\t\t\t\t\t\tWHERE pc2.virtuemart_product_id = a.virtuemart_product_id LIMIT 1) AS cat_id\n\t\t\t\tFROM `#__virtuemart_products_" . tsmConfig::$vmlang . "` AS a\n\t\t\t\tJOIN #__virtuemart_products AS p USING (`virtuemart_product_id`)\n\t\t\t\tLEFT JOIN `#__virtuemart_product_categories` AS xref\n\t\t\t\t\t\tON xref.`virtuemart_product_id` = a.`virtuemart_product_id`\n\t\t\t\tLEFT JOIN `#__virtuemart_categories_" . tsmConfig::$vmlang . "` AS b\n\t\t\t\t\t\tON b.`virtuemart_category_id` = xref.`virtuemart_category_id`\n\t\t\t\tLEFT JOIN `#__virtuemart_product_shoppergroups` as `psgr`\n\t\t\t\t\t\tON (`psgr`.`virtuemart_product_id`=`a`.`virtuemart_product_id`)\n\t\t\t\tLEFT JOIN `#__virtuemart_product_customfields` AS cf\n\t\t\t\t\t\tON cf.virtuemart_product_id = a.virtuemart_product_id\n\t\t\t\tLEFT JOIN `#__virtuemart_customs` AS customs\n\t\t\t\t\t\tON customs.virtuemart_custom_id = cf.virtuemart_customfield_id\n\t\t\t\tWHERE\n\t\t\t\t\t\t{$where}\n\t\t\t\t\t\tAND p.published=1\n\t\t\t\t\t\t{$shopper_group_condition}\n\t\t\t\t\t\t{$uncategorized_products_condition}\n\t\t\t\tGROUP BY xref.virtuemart_product_id\n\t\t\t\tORDER BY {$order}";
     $db->setQuery($query, 0, $limit);
     $rows = $db->loadObjectList();
     if ($rows) {
         foreach ($rows as $key => $row) {
             $rows[$key]->href = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $row->virtuemart_product_id . '&virtuemart_category_id=' . $row->cat_id;
         }
     }
     return $rows;
 }
Exemplo n.º 17
0
    public static function getVMComponent($authCheck = true)
    {
        $lang = JFactory::getLanguage();
        $user = JFactory::getUser();
        $db = JFactory::getDBO();
        $q = 'SELECT m.id, m.title, m.alias, m.link, m.parent_id, m.img, e.element FROM `#__menu` as m
				LEFT JOIN #__extensions AS e ON m.component_id = e.extension_id
		         WHERE m.client_id = 1 AND e.enabled = 1 AND m.id > 1 AND e.element = \'com_virtuemart\'
		         AND (m.parent_id=1 OR m.parent_id =
			                        (SELECT m.id FROM `#__menu` as m
									LEFT JOIN #__extensions AS e ON m.component_id = e.extension_id
			                        WHERE m.parent_id=1 AND m.client_id = 1 AND e.enabled = 1 AND m.id > 1 AND e.element = \'com_virtuemart\'))
		         ORDER BY m.lft';
        $db->setQuery($q);
        $vmComponentItems = $db->loadObjectList();
        $result = new stdClass();
        if (!class_exists('tsmConfig')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
        }
        tsmConfig::loadConfig();
        if ($vmComponentItems) {
            if (!class_exists('tsmConfig')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
            }
            tsmConfig::loadJLang('com_virtuemart.sys');
            // Parse the list of extensions.
            foreach ($vmComponentItems as &$vmComponentItem) {
                $vmComponentItem->link = vRequest::vmSpecialChars(trim($vmComponentItem->link));
                if ($vmComponentItem->parent_id == 1) {
                    if ($authCheck == false || $authCheck && $user->authorise('core.manage', $vmComponentItem->element)) {
                        $result = $vmComponentItem;
                        if (!isset($result->submenu)) {
                            $result->submenu = array();
                        }
                        if (empty($vmComponentItem->link)) {
                            $vmComponentItem->link = 'index.php?option=' . $vmComponentItem->element;
                        }
                        $vmComponentItem->text = $lang->hasKey($vmComponentItem->title) ? JText::_($vmComponentItem->title) : $vmComponentItem->alias;
                    }
                } else {
                    // Sub-menu level.
                    if (isset($result)) {
                        // Add the submenu link if it is defined.
                        if (isset($result->submenu) && !empty($vmComponentItem->link)) {
                            $vmComponentItem->text = $lang->hasKey($vmComponentItem->title) ? JText::_($vmComponentItem->title) : $vmComponentItem->alias;
                            $class = preg_replace('#\\.[^.]*$#', '', basename($vmComponentItem->img));
                            $class = preg_replace('#\\.\\.[^A-Za-z0-9\\.\\_\\- ]#', '', $class);
                            if (JVM_VERSION < 3) {
                                $vmComponentItem->class = "icon-16-" . $class;
                            } else {
                                $vmComponentItem->class = '';
                            }
                            $result->submenu[] =& $vmComponentItem;
                        }
                    }
                }
            }
            $props = get_object_vars($result);
            if (!empty($props)) {
                return $result;
            }
        }
        return false;
    }
Exemplo n.º 18
0
 /**
  * Render a simple country list
  *
  * @author jseros, Max Milbers, Valérie Isaksen
  *
  * @param int $countryId Selected country id
  * @param boolean $multiple True if multiple selections are allowed (default: false)
  * @param mixed $_attrib string or array with additional attributes,
  * e.g. 'onchange=somefunction()' or array('onchange'=>'somefunction()')
  * @param string $_prefix Optional prefix for the formtag name attribute
  * @return string HTML containing the <select />
  */
 public static function renderCountryList($countryId = 0, $multiple = FALSE, $_attrib = array(), $_prefix = '', $required = 0)
 {
     $countryModel = tmsModel::getModel('country');
     $countries = $countryModel->getCountries(TRUE, TRUE, FALSE);
     $attrs = array();
     $name = 'country_name';
     $id = 'virtuemart_country_id';
     $idA = $_prefix . 'virtuemart_country_id';
     $attrs['class'] = 'virtuemart_country_id';
     $attrs['class'] = 'vm-chzn-select';
     // Load helpers and  languages files
     if (!class_exists('tsmConfig')) {
         require JPATH_COMPONENT_ADMINISTRATOR . '/helpers/config.php';
     }
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_virtuemart_countries');
     vmJsApi::jQuery();
     vmJsApi::chosenDropDowns();
     $sorted_countries = array();
     $lang = JFactory::getLanguage();
     $prefix = "COM_VIRTUEMART_COUNTRY_";
     foreach ($countries as $country) {
         $country_string = $lang->hasKey($prefix . $country->country_3_code) ? tsmText::_($prefix . $country->country_3_code) : $country->country_name;
         $sorted_countries[$country->virtuemart_country_id] = $country_string;
     }
     asort($sorted_countries);
     $countries_list = array();
     $i = 0;
     foreach ($sorted_countries as $key => $value) {
         $countries_list[$i] = new stdClass();
         $countries_list[$i]->{$id} = $key;
         $countries_list[$i]->{$name} = $value;
         $i++;
     }
     if ($required != 0) {
         $attrs['class'] .= ' required';
     }
     if ($multiple) {
         $attrs['multiple'] = 'multiple';
         $idA .= '[]';
     } else {
         $emptyOption = JHtml::_('select.option', '', tsmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), $id, $name);
         array_unshift($countries_list, $emptyOption);
     }
     if (is_array($_attrib)) {
         $attrs = array_merge($attrs, $_attrib);
     } else {
         $_a = explode('=', $_attrib, 2);
         $attrs[$_a[0]] = $_a[1];
     }
     return JHtml::_('select.genericlist', $countries_list, $idA, $attrs, $id, $name, $countryId);
 }
Exemplo n.º 19
0
 function getInput()
 {
     tsmConfig::loadConfig();
     return JHtml::_('select.genericlist', $this->_getStringCustoms(), $this->name, 'class="inputbox"   ', 'value', 'text', $this->value, $this->id);
 }
Exemplo n.º 20
0
 /**
  * This function deletes a config stored in the database
  *
  * @author Max Milbers
  */
 function deleteConfig()
 {
     if ($this->remove(1)) {
         return tsmConfig::loadConfig(true, true);
     } else {
         return false;
     }
 }
Exemplo n.º 21
0
 function display($tpl = null)
 {
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = tmsModel::getModel();
     $usermodel = tmsModel::getModel('user');
     JToolBarHelper::title(tsmText::_('com_tsmart_CONFIG'), 'head vm_config_48');
     $this->addStandardEditViewCommands();
     $this->config = tsmConfig::loadConfig();
     if (!empty($this->config->_params)) {
         unset($this->config->_params['pdf_invoice']);
         // parameter remove and replaced by inv_os
     }
     $this->userparams = JComponentHelper::getParams('com_users');
     $this->jTemplateList = ShopFunctions::renderTemplateList(tsmText::_('com_tsmart_ADMIN_CFG_JOOMLA_TEMPLATE_DEFAULT'));
     $this->vmLayoutList = $model->getLayoutList('tsmart');
     $this->cartLayoutList = $model->getLayoutList('cart', array('padded.php', 'perror.php'));
     $this->categoryLayoutList = $model->getLayoutList('category');
     $this->productLayoutList = $model->getLayoutList('productdetails');
     $this->productsFieldList = $model->getFieldList('products');
     $this->noimagelist = $model->getNoImageList();
     $this->orderStatusModel = tmsModel::getModel('orderstatus');
     $this->os_Options = $this->osWoP_Options = $this->osDel_Options = $this->orderStatusModel->getOrderStatusNames();
     $emptyOption = JHtml::_('select.option', -1, tsmText::_('com_tsmart_NONE'), 'order_status_code', 'order_status_name');
     array_unshift($this->os_Options, $emptyOption);
     unset($this->osWoP_Options['P']);
     array_unshift($this->osWoP_Options, $emptyOption);
     $deldate_inv = JHtml::_('select.option', 'm', tsmText::_('com_tsmart_DELDATE_INV'), 'order_status_code', 'order_status_name');
     unset($this->osDel_Options['P']);
     array_unshift($this->osDel_Options, $deldate_inv);
     array_unshift($this->osDel_Options, $emptyOption);
     //vmdebug('my $this->os_Options',$this->osWoP_Options);
     $this->currConverterList = $model->getCurrencyConverterList();
     $this->activeLanguages = $model->getActiveLanguages(tsmConfig::get('active_languages'));
     $this->orderByFieldsProduct = $model->getProductFilterFields('browse_orderby_fields');
     tmsModel::getModel('category');
     foreach (tsmartModelCategory::$_validOrderingFields as $key => $field) {
         if ($field == 'c.category_shared') {
             continue;
         }
         $fieldWithoutPrefix = $field;
         $dotps = strrpos($fieldWithoutPrefix, '.');
         if ($dotps !== false) {
             $prefix = substr($field, 0, $dotps + 1);
             $fieldWithoutPrefix = substr($field, $dotps + 1);
         }
         $text = tsmText::_('com_tsmart_' . strtoupper(str_replace(array(',', ' '), array('_', ''), $fieldWithoutPrefix)));
         $orderByFieldsCat[] = JHtml::_('select.option', $field, $text);
     }
     $this->orderByFieldsCat = $orderByFieldsCat;
     $this->searchFields = $model->getProductFilterFields('browse_search_fields');
     $this->aclGroups = $usermodel->getAclGroupIndentedTree();
     if (!class_exists('VmTemplate')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
     }
     $this->vmtemplate = VmTemplate::loadVmTemplateStyle();
     $this->imagePath = shopFunctions::getAvailabilityIconUrl($this->vmtemplate);
     $this->listShipment = $this->listIt('shipment');
     $this->listPayment = $this->listIt('payment');
     shopFunctions::checkSafePath();
     $this->checkTCPDFinstalled();
     $this->checkVmUserVendor();
     //$this -> checkClientIP();
     parent::display($tpl);
 }
Exemplo n.º 22
0
 /**
  * logInfo
  * to help debugging Payment notification for example
  * Keep it for compatibilty
  */
 protected function logInfo($text, $type = 'message', $doLog = false)
 {
     if (!class_exists('tsmConfig')) {
         require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_tsmart' . DS . 'helpers' . DS . 'config.php';
     }
     tsmConfig::loadConfig();
     if (isset($this->_debug) and $this->_debug or $doLog) {
         $oldLogFileName = tsmConfig::$logFileName;
         tsmConfig::$logFileName = $this->getLogFileName();
         logInfo($text, $type);
         tsmConfig::$logFileName = $oldLogFileName;
     }
 }
 * @package VirtueMart
 * @subpackage modules
 *
 * @copyright (C) 2010-2014 The VirtueMart Team
 * @author Valerie Isaksen, Max Milbers
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * VirtueMart is Free Software.
 * VirtueMart comes with absolute no warranty.
 *
 * www.tsmart.net
 */
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists('tsmConfig')) {
    require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
tsmConfig::loadConfig();
tsmConfig::loadJLang('mod_virtuemart_search', true);
// Load the tsmart main parse code
$button = $params->get('button', 0);
$imagebutton = $params->get('imagebutton', 0);
$button_pos = $params->get('button_pos', 'left');
$button_text = $params->get('button_text', tsmText::_('MOD_VIRTUEMART_SEARCH_GO'));
$width = intval($params->get('width', 20));
$maxlength = $width > 20 ? $width : 20;
$text = $params->get('text', tsmText::_('MOD_VIRTUEMART_SEARCH_TEXT_TXT'));
$set_Itemid = intval($params->get('set_itemid', 0));
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
if ($params->get('filter_category', 0)) {
    $category_id = vRequest::getInt('virtuemart_category_id', 0);
} else {
    $category_id = 0;
Exemplo n.º 24
0
 private function setCartLayout($cart, $intoSession = true)
 {
     if (!class_exists('tsmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     tsmConfig::loadConfig();
     $olgConfig = tsmConfig::get('oncheckout_opc', true);
     tsmConfig::set('oncheckout_opc', true);
     $cart->layoutPath = vmPlugin::getTemplatePath($this->_name, 'payment', 'cart');
     $cart->layout = 'cart';
     if ($intoSession) {
         $cart->setCartIntoSession();
     }
 }
Exemplo n.º 25
0
 function showhelp()
 {
     /* http://docs.joomla.org/Help_system/Adding_a_help_button_to_the_toolbar */
     $task = vRequest::getCmd('task', '');
     $view = vRequest::getCmd('view', '');
     if ($task) {
         if ($task == "add") {
             $task = "edit";
         }
         $task = "_" . $task;
     }
     if (!class_exists('tsmConfig')) {
         require VMPATH_ADMIN . '/helpers/config.php';
     }
     tsmConfig::loadConfig();
     tsmConfig::loadJLang('com_tsmart_help');
     $lang = JFactory::getLanguage();
     $key = 'com_tsmart_HELP_' . $view . $task;
     if ($lang->hasKey($key)) {
         $help_url = tsmText::_($key) . "?tmpl=component";
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Popup', 'help', 'JTOOLBAR_HELP', $help_url, 960, 500);
     }
 }
Exemplo n.º 26
0
 public static function getInstance(&$query = null)
 {
     defined('DS') or define('DS', DIRECTORY_SEPARATOR);
     if (!class_exists('tsmConfig')) {
         require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     tsmConfig::loadConfig();
     if (!self::$_instance) {
         self::$_instance = new vmrouterHelper($query);
         if (self::$limit === null) {
             $mainframe = Jfactory::getApplication();
             $view = 'tsmart';
             if (isset($query['view'])) {
                 $view = $query['view'];
             }
             self::$limit = $mainframe->getUserStateFromRequest('com_virtuemart.' . $view . '.limit', tsmConfig::get('list_limit', 20), 'int');
         }
     }
     self::$_instance->query = $query;
     return self::$_instance;
 }