2.0.12 - 2.0.15a: trouble with sort order of the products in a category

Started by lysov, December 02, 2012, 18:47:23 PM

Previous topic - Next topic

lysov

As a temporary solution I fixed function virtuemartBuildRoute(), but this is not a good solution because it changed urls of number of pages.
                        if ( isset($query['orderby']) ) {
                                $segments[] = $helper->lang('by').','.$helper->lang( $query['orderby']) .'/'; //<-- LYV #98 -->
                                unset($query['orderby']);
                        }

Any ideas on a more elegant solution?

Milbo

Search on the other side, so that it works also without the additional /, please. I am not able to reproduce.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lysov

Update to 2.0.15f has not brought results. Which functions/places to pay my attention for finding solution?

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lysov


Milbo

you fixed function virtuemartBuildRoute, just try to fix it from the otherside virtuemartParseRoute
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lysov

Ok, I am meeting end of the world near the Ararat and after that try to test virtuemartParseRoute()  :)

Milbo

hahah Ararat, I was there one time,.. I think I was 10 years old or so.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lysov

I have many friends in this area (Erevan) and they now send you greetings  :) :) :)

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

tailer

Я думаю, что в ссылке, которая задает сортировку символов '`p`' не должно быть. Во всяком случае без этого префикса ссылка работает и выглядит лучше. Поискав по исходникам, нашел место где создаются ссылки, там в создаваемую ссылку передавался параметр сортировки вместе с префиксом. Чтобы починить сортировку нужно передавать ссылку с параметром сортировки без префикса. Для наглядности вот вывод git.

Google translator says:
I think the link that defines collation '`p`' should not be. In any case, without the prefix link works and looks better. Searching for the source code, found a place where you create links, create links there in the sort parameter passed along with a prefix. Sorting is necessary to fix the link to transfer to the collation without a prefix. For clarity's message git diff


$ git diff administrator/components/com_virtuemart/models/product.php
diff --git a/site/administrator/components/com_virtuemart/models/product.php b/site/administrator/components/com_virtuemart/models/product.php
index 5545673..6ad7546 100644
--- a/siteadministrator/components/com_virtuemart/models/product.php
+++ b/site/administrator/components/com_virtuemart/models/product.php
@@ -1904,7 +1904,7 @@ class VirtueMartModelProduct extends VmModel {
                                                $link = JRoute::_ ($fieldLink . $manufacturerTxt);
                                        }
                                        else {
-                                               $link = JRoute::_ ($fieldLink . $manufacturerTxt . '&orderby=' . $field);
+                                               $link = JRoute::_ ($fieldLink . $manufacturerTxt . '&orderby=' . $fieldWithoutPrefix);
                                        }
                                        $orderByLink .= '<div><a title="' . $text . '" href="' . $link . '">' . $text . '</a></div>';
                                }


artmasterpro

Solution is:

administrator/components/com_virtuemart/models/product.php

near line 1908 put code:

if ($field=='`p`.created_on') $field='created_on';

it must be before line

$link = JRoute::_ ($fieldLink . $manufacturerTxt . '&orderby=' . $field);

now it works!
Freelancer - idea is to help you!  Start and support!

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

FeaMor

Quote from: artmasterpro on June 28, 2013, 17:08:53 PM
Solution is:

administrator/components/com_virtuemart/models/product.php

near line 1908 put code:

if ($field=='`p`.created_on') $field='created_on';

it must be before line

$link = JRoute::_ ($fieldLink . $manufacturerTxt . '&orderby=' . $field);

now it works!

I've made remake. I added

$link = str_replace('%60p%60.', '', str_replace('`p`.', '', $link));

before

$orderByList = '<div class="orderlistcontainer"><div class="title">' . vmText::_ ('COM_VIRTUEMART_ORDERBY') . '</div><div class="activeOrder"><a title="' . $orderDirTxt . '" href="' . $link . '">' . vmText::_ ('COM_VIRTUEMART_SEARCH_ORDER_' . $orderby) . ' ' . $orderDirTxt . '</a></div>';

and now it works by evething order ;)