сайт каталог на virtuemart под управления joomla. Стандартно из админку можно задать сортировку по 1 полю для всего магазина некоторым категория нужно сделать свою сортировку. Для это нужно переопредилить шаблон вывода категорий(материалов) для этой категории это сделано. Дальше шаблон ссылается на стандартный метод сортировки Код из шаблона: Код (Text): <div class="orderby-displaynumber"> <div class="width45 floatleft"> <?php echo $this->orderByList['orderby']; ?> <?php echo $this->orderByList['manufacturer']; ?> </div> <div class="width15 floatleft display-number"><?php echo $this->vmPagination->getResultsCounter ();?><br/><?php echo $this->vmPagination->getLimitBox (); ?></div> <div class="vm-pagination"> <?php echo $this->vmPagination->getPagesLinks (); ?> <span style="float:right"><?php echo $this->vmPagination->getPagesCounter (); ?></span> </div> <div class="clear"></div> </div> <!-- end of orderby-displaynumber --> вот метод на который ссылаются Код (Text): function getOrderByList ($virtuemart_category_id = FALSE) { $getArray = (JRequest::get ('get')); $link = ''; $fieldLink = ''; // remove setted variable unset ($getArray['globalCurrencyConverter'], $getArray['virtuemart_manufacturer_id'], $getArray['order'], $getArray['orderby']); // foreach ($getArray as $key => $value ) // $fieldLink .= '&'.$key.'='.$value; //vmdebug('getOrderByList',$getArray); foreach ($getArray as $key => $value) { if (is_array ($value)) { foreach ($value as $k => $v) { $fieldLink .= '&' . $key . '[' . $k . ']' . '=' . $v; } } else { if($key=='dir' or $key=='orderby') continue; if(empty($value)) continue; $fieldLink .= '&' . $key . '=' . $value; } } $fieldLink[0] = "?"; $fieldLink = 'index.php' . $fieldLink; $orderDirLink = ''; $orderDirConf = VmConfig::get ('prd_brws_orderby_dir'); $orderDir = JRequest::getWord ('dir', $orderDirConf); if ($orderDir != $orderDirConf ) { $orderDirLink .= '&dir=' . $orderDir; //was '&order=' } $orderbyTxt = ''; $orderby = JRequest::getVar ('orderby', VmConfig::get ('browse_orderby_field')); $orderby = $this->checkFilterOrder ($orderby); $orderbyCfg = VmConfig::get ('browse_orderby_field'); if ($orderby != $orderbyCfg) { $orderbyTxt = '&orderby=' . $orderby; } $manufacturerTxt = ''; $manufacturerLink = ''; if (VmConfig::get ('show_manufacturers')) { // manufacturer link list $virtuemart_manufacturer_id = JRequest::getInt ('virtuemart_manufacturer_id', ''); if ($virtuemart_manufacturer_id != '') { $manufacturerTxt = '&virtuemart_manufacturer_id=' . $virtuemart_manufacturer_id; } // if ($mf_virtuemart_product_ids) { $query = 'SELECT DISTINCT l.`mf_name`,l.`virtuemart_manufacturer_id` FROM `#__virtuemart_manufacturers_' . VMLANG . '` as l'; $query .= ' JOIN `#__virtuemart_product_manufacturers` AS pm using (`virtuemart_manufacturer_id`)'; $query .= ' LEFT JOIN `#__virtuemart_products` as p ON p.`virtuemart_product_id` = pm.`virtuemart_product_id` '; $query .= ' LEFT JOIN `#__virtuemart_product_categories` as c ON c.`virtuemart_product_id` = pm.`virtuemart_product_id` '; $query .= ' WHERE p.`published` =1'; if ($virtuemart_category_id) { $catscont = array(); $this->untreeCat($virtuemart_category_id, $catscont); $qkat = ' AND c.`virtuemart_category_id` IN('.$virtuemart_category_id; foreach ($catscont as &$kat){ $qkat .= ', '.$kat; } $qkat .= ')'; $query .= $qkat; } $query .= ' ORDER BY l.`mf_name`'; $this->_db->setQuery ($query); $manufacturers = $this->_db->loadObjectList (); // vmdebug('my manufacturers',$this->_db->getQuery()); $manufacturerLink = ''; if (count ($manufacturers) > 0) { $manufacturerLink = '<div class="orderlist">'; if ($virtuemart_manufacturer_id > 0) { $manufacturerLink .= '<div><a title="" href="' . JRoute::_ ($fieldLink . $orderbyTxt . $orderDirLink , FALSE) . '">' . JText::_ ('COM_VIRTUEMART_SEARCH_SELECT_ALL_MANUFACTURER') . '</a></div>'; } if (count ($manufacturers) > 1) { foreach ($manufacturers as $mf) { $link = JRoute::_ ($fieldLink . '&virtuemart_manufacturer_id=' . $mf->virtuemart_manufacturer_id . $orderbyTxt . $orderDirLink,FALSE); if ($mf->virtuemart_manufacturer_id != $virtuemart_manufacturer_id) { $manufacturerLink .= '<div><a title="' . $mf->mf_name . '" href="' . $link . '">' . $mf->mf_name . '</a></div>'; } else { $currentManufacturerLink = '<div class="title">' . JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . '</div><div class="activeOrder">' . $mf->mf_name . '</div>'; } } } elseif ($virtuemart_manufacturer_id > 0) { $currentManufacturerLink = '<div class="title">' . JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . '</div><div class="activeOrder">' . $manufacturers[0]->mf_name . '</div>'; } else { $currentManufacturerLink = '<div class="title">' . JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . '</div><div class="Order"> ' . $manufacturers[0]->mf_name . '</div>'; } $manufacturerLink .= '</div>'; } // } } /* order by link list*/ $orderByLink = ''; $fields = VmConfig::get ('browse_orderby_fields'); if (count ($fields) > 1) { $orderByLink = '<div class="orderlist">'; foreach ($fields as $field) { if ($field != $orderby) { $dotps = strrpos ($field, '.'); if ($dotps !== FALSE) { $prefix = substr ($field, 0, $dotps + 1); $fieldWithoutPrefix = substr ($field, $dotps + 1); // vmdebug('Found dot '.$dotps.' $prefix '.$prefix.' $fieldWithoutPrefix '.$fieldWithoutPrefix); } else { $prefix = ''; $fieldWithoutPrefix = $field; } $text = JText::_ ('COM_VIRTUEMART_' . strtoupper ($fieldWithoutPrefix)); $field = explode('.',$field); if(isset($field[1])){ $field = $field[1]; } else { $field = $field[0]; } $link = JRoute::_ ($fieldLink . $manufacturerTxt . '&orderby=' . $field,FALSE); $orderByLink .= '<div><a title="' . $text . '" href="' . $link . '">' . $text . '</a></div>'; } } $orderByLink .= '</div>'; } if($orderDir == 'ASC'){ $orderDir = 'DESC'; } else { $orderDir = 'ASC'; } if ($orderDir != $orderDirConf ) { $orderDirLink = '&dir=' . $orderDir; //was '&order=' } else { $orderDirLink = ''; } //$orderDirTxt = JText::_ ('COM_VIRTUEMART_SEARCH_ORDER_'.$orderDir); $orderDirTxt = JText::_ ('COM_VIRTUEMART_'.$orderDir); $link = JRoute::_ ($fieldLink . $orderbyTxt . $orderDirLink . $manufacturerTxt,FALSE); // full string list if ($orderby == '') { $orderby = $orderbyCfg; } $orderby = strtoupper ($orderby); $dotps = strrpos ($orderby, '.'); if ($dotps !== FALSE) { $prefix = substr ($orderby, 0, $dotps + 1); $orderby = substr ($orderby, $dotps + 1); // vmdebug('Found dot '.$dotps.' $prefix '.$prefix.' $fieldWithoutPrefix '.$fieldWithoutPrefix); } else { $prefix = ''; // $orderby = $orderby; } $orderByList = '<div class="orderlistcontainer"><div class="title">' . JText::_ ('COM_VIRTUEMART_ORDERBY') . '</div><div class="activeOrder"><a title="' . $orderDirTxt . '" href="' . $link . '">' . JText::_ ('COM_VIRTUEMART_' . $orderby) . ' ' . $orderDirTxt . '</a></div>'; $orderByList .= $orderByLink . '</div>'; $manuList = ''; if (VmConfig::get ('show_manufacturers')) { if (empty ($currentManufacturerLink)) { $currentManufacturerLink = '<div class="title">' . JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') . '</div><div class="activeOrder">' . JText::_ ('COM_VIRTUEMART_SEARCH_SELECT_MANUFACTURER') . '</div>'; } $manuList = ' <div class="orderlistcontainer">' . $currentManufacturerLink; $manuList .= $manufacturerLink . '</div><div class="clear"></div>'; } return array('orderby'=> $orderByList, 'manufacturer'=> $manuList); } нужно написать маленький метод без возможности управления с админки и других параметров сортировки просто что бы он сортировал товары рендомом. помогите пожалуйста