Author Topic: ordering problems 3.2.14  (Read 338 times)


  • Jr. Member
  • **
  • Posts: 181
ordering problems 3.2.14
« on: September 14, 2018, 11:21:59 am »
i want to stylize my ordering block with normal up/down ordering icons like this

instead of +/- signs by default, they looks uninformative

in product model i found function, that build html:
Code: [Select]
function getOrderByList ($virtuemart_category_id = FALSE)
also i found a notice near them:
* notice by Max Milbers html tags should never be in a model. This function should be moved to a helper or simular,...
How many years it is still here?

There is the problem one: changes with this file will be overwrited on next update.
it would be a normal solution to just pass an array of values from product model, you do not need to include the html code  >:(

So, to avoid this, i copied this function to my template
and changed html and stylization in a new place

And than i found problem two: ordering won't work on some fields.
for example at product_in_stock
jRoute brokes url like this:

because field name is `p`.product_in_stock

commenting $orderby = $productModel->checkFilterOrder ($orderby); solves problem for me but i think it is not normal

please do a normal sorting at last!
you force developers to spend hours searching for solutions and workarounds. It's not free.


  • Jr. Member
  • **
  • Posts: 181
Re: ordering problems 3.2.14
« Reply #1 on: September 14, 2018, 11:44:51 am »
Also what is this in function getOrderByList?
Code: [Select]
$dotps = strrpos($field, '.');
            if ($dotps !== FALSE) {
                $prefix = substr($field, 0, $dotps + 1);
                $fieldWithoutPrefix = substr($field, $dotps + 1);

            } else {
                $prefix = '';
                $fieldWithoutPrefix = $field;
and after 3 lines:
Code: [Select]
$field = explode('.', $field);
            if (isset($field[1])) {
                $field = $field[1];
            } else {
                $field = $field[0];
so $fieldWithoutPrefix and $field will be always the same on next lines
for what it was necessary to do two transformations?