Author Topic: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category  (Read 15431 times)

lysov

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 105
    • Litera ltd
Re: 2.0.12 - 2.0.15c: trouble with sort order of the products in a category
« Reply #15 on: December 12, 2012, 13:18:30 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #16 on: December 18, 2012, 21:45:52 pm »
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 105
    • Litera ltd
Re: 2.0.12 - 2.0.15f: trouble with sort order of the products in a category
« Reply #17 on: December 19, 2012, 20:30:25 pm »
Update to 2.0.15f has not brought results. Which functions/places to pay my attention for finding solution?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #18 on: December 20, 2012, 00:27:12 am »
That means it works in 2.0.15f?
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 105
    • Litera ltd
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #19 on: December 20, 2012, 06:36:24 am »
Unfortunately it does not work in 2/0/15f

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #20 on: December 20, 2012, 12:56:24 pm »
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 105
    • Litera ltd
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #21 on: December 20, 2012, 16:52:46 pm »
Ok, I am meeting end of the world near the Ararat and after that try to test virtuemartParseRoute()  :)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #22 on: December 20, 2012, 17:11:26 pm »
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 105
    • Litera ltd
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #23 on: December 20, 2012, 17:28:48 pm »
I have many friends in this area (Erevan) and they now send you greetings  :) :) :)

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #24 on: December 20, 2012, 19:13:21 pm »
Great :-) Thank you,
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

  • Beginner
  • *
  • Posts: 2
Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
« Reply #25 on: January 13, 2013, 10:32:48 am »
Я думаю, что в ссылке, которая задает сортировку символов '`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

Code: [Select]
$ 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

  • Beginner
  • *
  • Posts: 1
  • Freelancer - idea is to help you!
  • Skype Name: artmasterpro
  • VirtueMart Version: 2
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
For which version is this fix? The problem is imho solved.
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

  • Beginner
  • *
  • Posts: 1
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

Code: [Select]
$link = str_replace('%60p%60.', '', str_replace('`p`.', '', $link));
before

Code: [Select]
$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 ;)