Ejemplo n.º 1
0
 protected function getInput()
 {
     VmConfig::loadConfig();
     VmConfig::loadJLang('com_virtuemart');
     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" ';
     }
     $id = VmHtml::ensureUniqueId('vmcategories');
     $html = '<select id="' . $id . '" class="inputbox"   name="' . $name . '" ' . $this->multiple . ' >';
     if (!$this->multiple) {
         $html .= '<option value="0">' . vmText::_('COM_VIRTUEMART_CATEGORY_FORM_TOP_LEVEL') . '</option>';
     }
     $html .= $categorylist;
     $html .= "</select>";
     return $html;
 }
Ejemplo n.º 2
0
    static function jDate($date = '', $name = "date", $id = NULL, $resetBt = TRUE, $yearRange = '')
    {
        if ($yearRange) {
            $yearRange = 'yearRange: "' . $yearRange . '",';
        }
        $test = (int) str_replace(array('-', ' ', ':'), '', $date);
        if (empty($test)) {
            $date = 0;
        }
        if (empty($id)) {
            $id = str_replace(array('[]', '[', ']'), '.', $name);
            $id = str_replace('..', '.', $id);
        }
        static $jDate;
        if (!class_exists('VmHtml')) {
            require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
        }
        $id = VmHtml::ensureUniqueId($id);
        $dateFormat = vmText::_('COM_VIRTUEMART_DATE_FORMAT_INPUT_J16');
        //="m/d/y"
        $search = array('m', 'd', 'Y');
        $replace = array('mm', 'dd', 'yy');
        $jsDateFormat = str_replace($search, $replace, $dateFormat);
        if ($date) {
            $formatedDate = JHtml::_('date', $date, $dateFormat);
        } else {
            $formatedDate = vmText::_('COM_VIRTUEMART_NEVER');
        }
        $display = '<input class="datepicker-db" id="' . $id . '" type="hidden" name="' . $name . '" value="' . $date . '" />';
        $display .= '<input id="' . $id . '_text" class="datepicker" type="text" value="' . $formatedDate . '" />';
        if ($resetBt) {
            $display .= '<span class="vmicon vmicon-16-logout icon-nofloat js-date-reset"></span>';
        }
        // If exist exit
        if ($jDate) {
            return $display;
        }
        self::addJScript('datepicker', '
			jQuery(document).ready( function($) {
			jQuery(document).on( "focus",".datepicker", function() {
				jQuery( this ).datepicker({
					changeMonth: true,
					changeYear: true,
					' . $yearRange . '
					dateFormat:"' . $jsDateFormat . '",
					altField: $(this).prev(),
					altFormat: "yy-mm-dd"
				});
			});
			jQuery(document).on( "click",".js-date-reset", function() {
				jQuery(this).prev("input").val("' . vmText::_('COM_VIRTUEMART_NEVER') . '").prev("input").val("0");
			});
		});
		');
        vmJsApi::css('ui/jquery.ui.all');
        $lg = JFactory::getLanguage();
        $lang = $lg->getTag();
        $vlePath = vmJsApi::setPath('i18n/jquery.ui.datepicker-' . $lang, FALSE, '', $minified = NULL, 'js', true);
        if (!file_exists($vlePath) or is_dir($vlePath)) {
            $lang = 'en-GB';
        }
        vmJsApi::addJScript('i18n/jquery.ui.datepicker-' . $lang);
        $jDate = TRUE;
        return $display;
    }
Ejemplo n.º 3
0
 public static function renderVendorFullVendorList($vendorId, $multiple = false, $name = 'virtuemart_vendor_id')
 {
     $db = JFactory::getDBO();
     $q = 'SELECT `virtuemart_vendor_id`,`vendor_name` FROM #__virtuemart_vendors';
     $db->setQuery($q);
     $vendors = $db->loadAssocList();
     $attrs = array();
     if (!class_exists('VmHtml')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $id = VmHtml::ensureUniqueId('vendor_name' . $vendorId);
     $idA = $name;
     $attrs['class'] = 'vm-chzn-select';
     if ($multiple) {
         $attrs['multiple'] = 'multiple';
         $idA .= '[]';
     } else {
         $emptyOption = JHtml::_('select.option', '', vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'virtuemart_vendor_id', 'vendor_name');
         array_unshift($vendors, $emptyOption);
     }
     $listHTML = JHtml::_('select.genericlist', $vendors, $idA, $attrs, 'virtuemart_vendor_id', 'vendor_name', $vendorId, $id);
     return $listHTML;
 }
Ejemplo n.º 4
0
 /**
  * @author Max Milbers
  * @param $product
  * @param $customfield
  */
 public function displayProductCustomfieldFE(&$product, &$customfields)
 {
     if (!class_exists('calculationHelper')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     $selectList = array();
     $dynChilds = 1;
     //= array();
     $session = JFactory::getSession();
     $virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
     foreach ($customfields as $k => &$customfield) {
         if (!isset($customfield->display)) {
             $customfield->display = '';
         }
         $calculator->_product = $product;
         if (!class_exists('vmCustomPlugin')) {
             require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
         }
         if ($customfield->field_type == "E") {
             JPluginHelper::importPlugin('vmcustom');
             $dispatcher = JDispatcher::getInstance();
             $ret = $dispatcher->trigger('plgVmOnDisplayProductFEVM3', array(&$product, &$customfield));
             continue;
         }
         $fieldname = 'field[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_customfield_id . '][customfield_value]';
         $customProductDataName = 'customProductData[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_custom_id . ']';
         //This is a kind of fallback, setting default of custom if there is no value of the productcustom
         $customfield->customfield_value = empty($customfield->customfield_value) ? $customfield->custom_value : $customfield->customfield_value;
         $type = $customfield->field_type;
         $idTag = (int) $product->virtuemart_product_id . '-' . $customfield->virtuemart_customfield_id;
         $idTag = $idTag . 'customProductData';
         $idTag = VmHtml::ensureUniqueId($idTag);
         if (!class_exists('CurrencyDisplay')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
         }
         $currency = CurrencyDisplay::getInstance();
         switch ($type) {
             case 'C':
                 $html = '';
                 $dropdowns = array();
                 if (isset($customfield->options->{$product->virtuemart_product_id})) {
                     $productSelection = $customfield->options->{$product->virtuemart_product_id};
                 } else {
                     $productSelection = false;
                 }
                 $ignore = array();
                 foreach ($customfield->options as $product_id => $variants) {
                     foreach ($variants as $k => $variant) {
                         //if(in_array($variant,$ignore)){ vmdebug('Product to ignore, continue',$product_id,$k,$variant);continue;}
                         if (!isset($dropdowns[$k]) or !is_array($dropdowns[$k])) {
                             $dropdowns[$k] = array();
                         }
                         if (!in_array($variant, $dropdowns[$k])) {
                             if ($k == 0 or !$productSelection) {
                                 $dropdowns[$k][] = $variant;
                             } else {
                                 if ($k > 0 and $productSelection[$k - 1] == $variants[$k - 1]) {
                                     $break = false;
                                     for ($h = 1; $h <= $k; $h++) {
                                         if ($productSelection[$h - 1] != $variants[$h - 1]) {
                                             //$ignore[] = $variant;
                                             $break = true;
                                         }
                                     }
                                     if (!$break) {
                                         $dropdowns[$k][] = $variant;
                                     }
                                 } else {
                                     //	break;
                                 }
                             }
                         }
                     }
                 }
                 $tags = array();
                 foreach ($customfield->selectoptions as $k => $soption) {
                     $options = array();
                     $selected = false;
                     foreach ($dropdowns[$k] as $i => $elem) {
                         $elem = trim((string) $elem);
                         $text = $elem;
                         if ($soption->clabel != '' and in_array($soption->voption, self::$dimensions)) {
                             $rd = $soption->clabel;
                             if (is_numeric($rd) and is_numeric($elem)) {
                                 $text = number_format(round((double) $elem, (int) $rd), $rd);
                             }
                             //vmdebug('($dropdowns[$k] in DIMENSION value = '.$elem.' r='.$rd.' '.$text);
                         } else {
                             if ($soption->voption === 'clabels' and $soption->clabel != '') {
                                 $text = vmText::_($elem);
                             }
                         }
                         if ($elem == '0') {
                             $text = vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION');
                         }
                         $options[] = array('value' => $elem, 'text' => $text);
                         if ($productSelection and $productSelection[$k] == $elem) {
                             $selected = $elem;
                         }
                     }
                     if (empty($selected)) {
                         $product->orderable = false;
                     }
                     $idTagK = $idTag . 'cvard' . $k;
                     if ($customfield->showlabels) {
                         if (in_array($soption->voption, self::$dimensions)) {
                             $soption->slabel = vmText::_('COM_VIRTUEMART_' . strtoupper($soption->voption));
                         } else {
                             if (!empty($soption->clabel) and !in_array($soption->voption, self::$dimensions)) {
                                 $soption->slabel = vmText::_($soption->clabel);
                             }
                         }
                         if (isset($soption->slabel)) {
                             $html .= '<span class="vm-cmv-label" >' . $soption->slabel . '</span>';
                         }
                     }
                     $attribs = array('class' => 'vm-chzn-select cvselection no-vm-bind', 'data-dynamic-update' => '1');
                     if ('productdetails' != vRequest::getCmd('view')) {
                         $attribs['reload'] = '1';
                     }
                     $html .= JHtml::_('select.genericlist', $options, $fieldname, $attribs, "value", "text", $selected, $idTagK);
                     $tags[] = $idTagK;
                 }
                 $Itemid = vRequest::getInt('Itemid', '');
                 // '&Itemid=127';
                 if (!empty($Itemid)) {
                     $Itemid = '&Itemid=' . $Itemid;
                 }
                 //create array for js
                 $jsArray = array();
                 $url = '';
                 foreach ($customfield->options as $product_id => $variants) {
                     $url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $product_id . $Itemid);
                     $jsArray[] = '["' . $url . '","' . implode('","', $variants) . '"]';
                 }
                 vmJsApi::addJScript('cvfind', false, false);
                 $jsVariants = implode(',', $jsArray);
                 $j = "\n\t\t\t\t\t\tjQuery('#" . implode(',#', $tags) . "').off('change',Virtuemart.cvFind);\n\t\t\t\t\t\tjQuery('#" . implode(',#', $tags) . "').on('change', { variants:[" . $jsVariants . "] },Virtuemart.cvFind);\n\t\t\t\t\t";
                 $hash = md5(implode('', $tags));
                 vmJsApi::addJScript('cvselvars' . $hash, $j, false);
                 //Now we need just the JS to reload the correct product
                 $customfield->display = $html;
                 break;
             case 'A':
                 $html = '';
                 //if($selectedFound) continue;
                 $options = array();
                 $productModel = VmModel::getModel('product');
                 //Note by Jeremy Magne (Daycounts) 2013-08-31
                 //Previously the the product model is loaded but we need to ensure the correct product id is set because the getUncategorizedChildren does not get the product id as parameter.
                 //In case the product model was previously loaded, by a related product for example, this would generate wrong uncategorized children list
                 $productModel->setId($customfield->virtuemart_product_id);
                 $uncatChildren = $productModel->getUncategorizedChildren($customfield->withParent);
                 if (!$customfield->withParent or $customfield->withParent and $customfield->parentOrderable) {
                     $options[0] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $customfield->virtuemart_product_id, FALSE), 'text' => vmText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT'));
                 }
                 $selected = vRequest::getInt('virtuemart_product_id', 0);
                 $selectedFound = false;
                 if (empty($calculator) and $customfield->wPrice) {
                     if (!class_exists('calculationHelper')) {
                         require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
                     }
                     $calculator = calculationHelper::getInstance();
                 }
                 $parentStock = 0;
                 foreach ($uncatChildren as $k => $child) {
                     if (!isset($child[$customfield->customfield_value])) {
                         vmdebug('The child has no value at index ' . $customfield->customfield_value, $customfield, $child);
                     } else {
                         $productChild = $productModel->getProduct((int) $child['virtuemart_product_id'], false);
                         if (!$productChild) {
                             continue;
                         }
                         $available = $productChild->product_in_stock - $productChild->product_ordered;
                         if (VmConfig::get('stockhandle', 'none') == 'disableit_children' and $available <= 0) {
                             continue;
                         }
                         $parentStock += $available;
                         $priceStr = '';
                         if ($customfield->wPrice) {
                             //$product = $productModel->getProductSingle((int)$child['virtuemart_product_id'],false);
                             $productPrices = $calculator->getProductPrices($productChild);
                             $priceStr = ' (' . $currency->priceDisplay($productPrices['salesPrice']) . ')';
                         }
                         $options[] = array('value' => JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id']), 'text' => $child[$customfield->customfield_value] . $priceStr);
                         if ($selected == $child['virtuemart_product_id']) {
                             $selectedFound = true;
                             vmdebug($customfield->virtuemart_product_id . ' $selectedFound by vRequest ' . $selected);
                         }
                         //vmdebug('$child productId ',$child['virtuemart_product_id'],$customfield->customfield_value,$child);
                     }
                 }
                 if (!$selectedFound) {
                     $pos = array_search($customfield->virtuemart_product_id, $product->allIds);
                     if (isset($product->allIds[$pos - 1])) {
                         $selected = $product->allIds[$pos - 1];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to - 1 allIds['.($pos-1).'] = '.$selected.' and count '.$dynChilds);
                         //break;
                     } elseif (isset($product->allIds[$pos])) {
                         $selected = $product->allIds[$pos];
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to allIds['.$pos.'] = '.$selected.' and count '.$dynChilds);
                     } else {
                         $selected = $customfield->virtuemart_product_id;
                         //vmdebug($customfield->virtuemart_product_id.' Set selected to $customfield->virtuemart_product_id ',$selected,$product->allIds);
                     }
                 }
                 $url = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $selected;
                 $html .= JHtml::_('select.genericlist', $options, $fieldname, 'onchange="window.top.location.href=this.options[this.selectedIndex].value" size="1" class="vm-chzn-select no-vm-bind" data-dynamic-update="1" ', "value", "text", JRoute::_($url, false), $idTag);
                 vmJsApi::chosenDropDowns();
                 if ($customfield->parentOrderable == 0) {
                     if ($product->product_parent_id == 0) {
                         $product->orderable = FALSE;
                     } else {
                         $product->product_in_stock = $parentStock;
                     }
                 } else {
                 }
                 $dynChilds++;
                 $customfield->display = $html;
                 break;
                 /*Date variant*/
             /*Date variant*/
             case 'D':
                 if (empty($customfield->custom_value)) {
                     $customfield->custom_value = 'LC2';
                 }
                 //Customer selects date
                 if ($customfield->is_input) {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::jDate($customfield->customfield_value, $customProductDataName) . '</span>';
                     //vmJsApi::jDate($field->custom_value, 'field['.$row.'][custom_value]','field_'.$row.'_customvalue').$priceInput;
                 } else {
                     $customfield->display = '<span class="product_custom_date">' . vmJsApi::date($customfield->customfield_value, $customfield->custom_value, TRUE) . '</span>';
                 }
                 break;
                 /* text area or editor No vmText, only displayed in BE */
             /* text area or editor No vmText, only displayed in BE */
             case 'X':
             case 'Y':
                 $customfield->display = $customfield->customfield_value;
                 break;
                 /* string or integer */
             /* string or integer */
             case 'B':
             case 'S':
             case 'M':
                 if ($type == 'M') {
                     $selectType = 'select.radiolist';
                     $class = '';
                 } else {
                     $selectType = 'select.genericlist';
                     if (!empty($customfield->is_input)) {
                         vmJsApi::chosenDropDowns();
                         $class = 'class="vm-chzn-select"';
                     }
                 }
                 if ($customfield->is_list and $customfield->is_list != 2) {
                     if (!empty($customfield->is_input)) {
                         $options = array();
                         $values = explode(';', $customfield->custom_value);
                         foreach ($values as $key => $val) {
                             if ($type == 'M') {
                                 $tmp = array('value' => $val, 'text' => $this->displayCustomMedia($val, 'product', $customfield->width, $customfield->height));
                                 $options[] = (object) $tmp;
                             } else {
                                 $options[] = array('value' => $val, 'text' => vmText::_($val));
                             }
                         }
                         $currentValue = $customfield->customfield_value;
                         $customfield->display = JHtml::_($selectType, $options, $customProductDataName . '[' . $customfield->virtuemart_customfield_id . ']', $class, 'value', 'text', $currentValue, $idTag);
                     } else {
                         if ($type == 'M') {
                             $customfield->display = $this->displayCustomMedia($customfield->customfield_value, 'product', $customfield->width, $customfield->height);
                         } else {
                             $customfield->display = vmText::_($customfield->customfield_value);
                         }
                     }
                 } else {
                     if (!empty($customfield->is_input)) {
                         if (!isset($selectList[$customfield->virtuemart_custom_id])) {
                             $tmpField = clone $customfield;
                             $tmpField->options = null;
                             $customfield->options[$customfield->virtuemart_customfield_id] = $tmpField;
                             $selectList[$customfield->virtuemart_custom_id] = $k;
                             $customfield->customProductDataName = $customProductDataName;
                         } else {
                             $customfields[$selectList[$customfield->virtuemart_custom_id]]->options[$customfield->virtuemart_customfield_id] = $customfield;
                             unset($customfields[$k]);
                             //$customfield->options[$customfield->virtuemart_customfield_id] = $customfield;
                         }
                         $default = reset($customfields[$selectList[$customfield->virtuemart_custom_id]]->options);
                         foreach ($customfields[$selectList[$customfield->virtuemart_custom_id]]->options as &$productCustom) {
                             $price = self::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);
                             if ($type == 'M') {
                                 $productCustom->text = $this->displayCustomMedia($productCustom->customfield_value, 'product', $customfield->width, $customfield->height) . ' ' . $price;
                             } else {
                                 $trValue = vmText::_($productCustom->customfield_value);
                                 if ($productCustom->customfield_value != $trValue and strpos($trValue, '%1') !== false) {
                                     $productCustom->text = vmText::sprintf($productCustom->customfield_value, $price);
                                 } else {
                                     $productCustom->text = $trValue . ' ' . $price;
                                 }
                             }
                         }
                         $customfields[$selectList[$customfield->virtuemart_custom_id]]->display = JHtml::_($selectType, $customfields[$selectList[$customfield->virtuemart_custom_id]]->options, $customfields[$selectList[$customfield->virtuemart_custom_id]]->customProductDataName, $class, 'virtuemart_customfield_id', 'text', $default->customfield_value, $idTag);
                         //*/
                     } else {
                         if ($type == 'M') {
                             $customfield->display = $this->displayCustomMedia($customfield->customfield_value, 'product', $customfield->width, $customfield->height);
                         } else {
                             $customfield->display = vmText::_($customfield->customfield_value);
                         }
                     }
                 }
                 break;
             case 'Z':
                 if (empty($customfield->customfield_value)) {
                     break;
                 }
                 $html = '';
                 $q = 'SELECT * FROM `#__virtuemart_categories_' . VmConfig::$vmlang . '` as l INNER JOIN `#__virtuemart_categories` AS c using (`virtuemart_category_id`) WHERE `published`=1 AND l.`virtuemart_category_id`= "' . (int) $customfield->customfield_value . '" ';
                 $db = JFactory::getDBO();
                 $db->setQuery($q);
                 if ($category = $db->loadObject()) {
                     if (empty($category->virtuemart_category_id)) {
                         break;
                     }
                     $q = 'SELECT `virtuemart_media_id` FROM `#__virtuemart_category_medias`WHERE `virtuemart_category_id`= "' . $category->virtuemart_category_id . '" ';
                     $db->setQuery($q);
                     $thumb = '';
                     if ($media_id = $db->loadResult()) {
                         $thumb = $this->displayCustomMedia($media_id, 'category', $customfield->width, $customfield->height);
                     }
                     $customfield->display = JHtml::link(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id), $thumb . ' ' . $category->category_name, array('title' => $category->category_name, 'target' => '_blank'));
                 }
                 break;
             case 'R':
                 if (empty($customfield->customfield_value)) {
                     $customfield->display = 'customfield related product has no value';
                     break;
                 }
                 $pModel = VmModel::getModel('product');
                 $related = $pModel->getProduct((int) $customfield->customfield_value, TRUE, $customfield->wPrice, TRUE, 1);
                 if (!$related) {
                     break;
                 }
                 $thumb = '';
                 if ($customfield->wImage) {
                     if (!empty($related->virtuemart_media_id[0])) {
                         $thumb = $this->displayCustomMedia($related->virtuemart_media_id[0], 'product', $customfield->width, $customfield->height) . ' ';
                     } else {
                         $thumb = $this->displayCustomMedia(0, 'product', $customfield->width, $customfield->height) . ' ';
                     }
                 }
                 $customfield->display = shopFunctionsF::renderVmSubLayout('related', array('customfield' => $customfield, 'related' => $related, 'thumb' => $thumb));
                 break;
         }
     }
 }
Ejemplo n.º 5
0
 function getLimitBox($sequence = 0)
 {
     $app = JFactory::getApplication();
     // Initialize variables
     $limits = array();
     $selected = $this->limit;
     // Build the select list
     if ($app->isAdmin()) {
         if (empty($sequence)) {
             $sequence = VmConfig::get('pagseq', 0);
         }
         if (!empty($sequence)) {
             $sequenceArray = explode(',', $sequence);
             if (count($sequenceArray > 1)) {
                 foreach ($sequenceArray as $items) {
                     $limits[$items] = JHtml::_('select.option', $items);
                 }
             }
         }
         if (empty($limits)) {
             $limits[15] = JHtml::_('select.option', 15);
             $limits[30] = JHtml::_('select.option', 30);
             $limits[50] = JHtml::_('select.option', 50);
             $limits[100] = JHtml::_('select.option', 100);
             $limits[200] = JHtml::_('select.option', 200);
             $limits[400] = JHtml::_('select.option', 400);
         }
         if (!array_key_exists($this->limit, $limits)) {
             $limits[$this->limit] = JHtml::_('select.option', $this->limit);
             ksort($limits);
         }
         $namespace = 'Joomla.';
         $id = VmHtml::ensureUniqueId('limit');
         $html = JHtml::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="' . $namespace . 'submitform();"', 'value', 'text', $selected, $id);
     } else {
         $getArray = vRequest::getGet();
         $link = '';
         unset($getArray['limit']);
         foreach ($getArray as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $k => $v) {
                     $link .= '&' . urlencode($key) . '[' . urlencode($k) . ']' . '=' . urlencode($v);
                 }
             } else {
                 $link .= '&' . urlencode($key) . '=' . urlencode($value);
             }
         }
         $link = 'index.php?' . ltrim($link, '&');
         if (empty($sequence)) {
             $sequence = VmConfig::get('pagseq_' . $this->_perRow);
         }
         if (!empty($sequence)) {
             $sequenceArray = explode(',', $sequence);
             if (count($sequenceArray > 1)) {
                 foreach ($sequenceArray as $items) {
                     $limits[$items] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $items, false), $items);
                 }
             }
         }
         if (empty($limits) or !is_array($limits)) {
             if ($this->_perRow === 1) {
                 $this->_perRow = 5;
             }
             $limits[$this->_perRow * 5] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 5, false), $this->_perRow * 5);
             $limits[$this->_perRow * 10] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 10, false), $this->_perRow * 10);
             $limits[$this->_perRow * 20] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 20, false), $this->_perRow * 20);
             $limits[$this->_perRow * 50] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 50, false), $this->_perRow * 50);
         }
         if (!array_key_exists($this->limit, $limits)) {
             $limits[$this->limit] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->limit, false), $this->limit);
             ksort($limits);
         }
         $selected = JRoute::_($link . '&limit=' . $selected, false);
         $js = 'onchange="window.top.location.href=this.options[this.selectedIndex].value"';
         $id = VmHtml::ensureUniqueId('limit');
         $html = JHtml::_('select.genericlist', $limits, '', 'class="inputbox" size="1" ' . $js, 'value', 'text', $selected, $id);
     }
     return $html;
 }