View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001424 | OXID eShop (all versions) | 1.01. Products (product, categories, manufacturer, promotions etc.) | public | 2009-10-27 10:13 | 2012-12-07 14:13 |
Reporter | andreas_ziethen | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.1.6 revision 22740 | ||||
Fixed in Version | 4.3.0 revision 26948 | ||||
Summary | 0001424: oxcategorylist: new method _getSqlSelectFieldsForTree() is not recognized in method sortCats() | ||||
Description | The method _getSqlSelectFieldsForTree() has been added recently to give developers the possibility to easily add custom fields to the category-tree-objects. Unfortunately this is not considered in method oxcategorylist::sortCats(). Here a fixed array of table columns is given to function _getSelectString(). But _getSelectString() gets the field list by using _getSqlSelectFieldsForTree() and not from that fixed array of columns. So if for example you build a module which puts a new field at the very beginning of $sFieldList, the sorting of the root cats does not work any longer cause in sortCats() $rs->fields[0] is used for sorting. Example as module from oxcategorylist: protected function _getSqlSelectFieldsForTree($sTable, $aColumns = null) { $sFieldList = parent::_getSqlSelectFieldsForTree($sTable, $aColumns); $sFieldList = " $sTable.oxthumb as oxthumb,".$sFieldList; return $sFieldList; } This leads to the unexpected effect of a wrong sorting of root categories. | ||||
Tags | Category, Sorting | ||||
Theme | |||||
Browser | All | ||||
PHP Version | 5.2.6 | ||||
Database Version | 5.0.33 | ||||
related to | 0001113 | resolved | sarunas_valaskevicius | Category tree loading performance |
|
Method _getSqlSelectFieldsForTree and many others changes were introduced after fixing bug 0001113 . Main purpose of aColums parameter was to allow selecting only needed fields for tree loading and sorting. Your module can be improved by adding a simple check if is_null($aColumns), because this is the only case where this array can give developers the possibility to easily add custom fields, in other cases it is used only for sorting and tree depth loading optimizations. protected function _getSqlSelectFieldsForTree($sTable, $aColumns = null) { $sFieldList = parent::_getSqlSelectFieldsForTree($sTable, $aColumns); if(is_null($aColumns)) $sFieldList = " $sTable.oxthumb as oxthumb,".$sFieldList; } return $sFieldList; } |
|
Result handling in oxcategorylist::sortCats() changed to associative array, to eliminate such problems and unexpected effects |