VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: lysov on December 02, 2012, 18:47:23 PM

Title: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 02, 2012, 18:47:23 PM
Hi, when I click on the 'Creation date' or 'SKU' in the FE category view  ("Sort by" combo-box)  I get an error:
Not Found
/catalog/health-and-education/councils-of-the-kind-doctor/by,`p`.created_on was not found on this server.

or
The requested URL /catalog/health-and-education/councils-of-the-kind-doctor/by,`p`.product_sku was not found on this server.

When I switch off Joomla SEF flag, it works fine and url looks like
/index.php?option=com_virtuemart&view=category&virtuemart_category_id=28&Itemid=120&lang=ru&language=ru-RU&orderby=`p`.created_on
or
/index.php?option=com_virtuemart&view=category&virtuemart_category_id=28&Itemid=120&lang=ru&language=ru-RU&orderby=`p`.product_sku

For example look this:  http://www.litera.spb.ru/catalog/health-and-education/councils-of-the-kind-doctor/
Here 'ISBN' = SKU and 'Дата выпуска' = creation_date
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: bytelord on December 02, 2012, 19:12:09 PM
Hello,

Please check the sef ini translation file for the language you are using under language\en-GB\en-GB.com_virtuemart.sef.ini for example for English and check if the keys are translated.
key for created_on   -> COM_VIRTUEMART_SEF_CREATED_ON

Regards
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 02, 2012, 19:37:31 PM
Tnx, I have checked this, now I am using standart set ru-RU translation files
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: bytelord on December 02, 2012, 20:09:34 PM
So, you check the RU sef translation? Is it working?
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 03, 2012, 09:24:30 AM
Yes, but unsuccessfully. First of all I checked ru-RU.com_virtuemart.sef.ini, it is Ok: all keywords from en version are present and translated. Next I tried to replace ru version to the English
cp  en-GB/en-GB.com_virtuemart.sef.ini  ru-RU/ru-RU.com_virtuemart.sef.ini
Unfortunately it did not help, the situation has not changed  :(
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: bytelord on December 03, 2012, 09:28:27 AM
Hi,

Did you enable from the Joomla global configuration -> site -> SEO Settings -> Unicode Aliases ?

Regards
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 03, 2012, 10:05:11 AM
No (as default). Now I swiched "Unicode Aliases" to Enable and tested with original  ru-RU.com_virtuemart.sef.ini:  the situation has not changed.  It is strange that the error occurs only when I specify "created_on" and SKU and is not dependent on the version of the file ru-RU.com_virtuemart.sef.ini
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 03, 2012, 10:23:26 AM
The only difference between the keywords of English and Russian versions of the file com_virtuemart.sef.ini is COM_VIRTUEMART_SEF_EDITSHIPPING (ru version) and COM_VIRTUEMART_SEF_EDIT_SHIPMENT (en)
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: bytelord on December 03, 2012, 13:07:12 PM
Hi,

Could be something on the route, works for me but the translated strings are not right one for me also. Give a try also to enable translate string under configuration -> SEO

Regards
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: Milbo on December 03, 2012, 13:11:48 PM
COM_VIRTUEMART_SEF_EDITSHIPPING is obsolete

Quote from: bytelord on December 03, 2012, 13:07:12 PM
Could be something on the route, works for me but the translated strings are not right one for me also.

What does not work? translated seo?
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: bytelord on December 03, 2012, 14:03:01 PM
Yes, as i see the issue with the translated strings returns somehow, using en-gb and sef keys translated the url is by,`p`.created_on instead of the translated one.
The COM_VIRTUEMART_SEF_EDITSHIPPING is not there anymore as you mention, may lysov using old language files for ru-RU but as far as i know jjk have fixed all of them.
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 03, 2012, 20:33:56 PM
Ok, but another question: why dublicate tag 'ru' in the non-SEF url?
/index.php?option=com_virtuemart&view=category&virtuemart_category_id=28&Itemid=120&lang=ru&language=ru-RU&orderby=`p`.created_on
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: csimmo on December 04, 2012, 04:16:06 AM
I have a similar issue I have posted for me this:
I found a fix, but I need help applying it
This does not work:
http://www2.abtsystems.com.au/services/shop-servicing/by,m.mf_name.html
But if I delete the m. and make it like this:
http://www2.abtsystems.com.au/services/shop-servicing/by,mf_name.html
it works fine!!!

How do I apply it?
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 04, 2012, 06:21:36 AM
Quote from: csimmo on December 04, 2012, 04:16:06 AM
I have a similar issue I have posted for me this:
I found a fix, but I need help applying it
This does not work:
http://www2.abtsystems.com.au/services/shop-servicing/by,m.mf_name.html
But if I delete the m. and make it like this:
http://www2.abtsystems.com.au/services/shop-servicing/by,mf_name.html
it works fine!!!

How do I apply it?
Hi, csimmo. What is your VM version? I have no problem to sort by manufacturers.

To bytelord (offtopic):
Probably have to fix router.php, can I hope to correct sql-query?
router.php line 971 from
   $query = 'SELECT * FROM `#__menu`  where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language="'.$this->langTag.'")'  ;

to
   $query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language LIKE "'.$this->langTag.'")';
Please see my explanation at http://forum.virtuemart.net/index.php?topic=99711.msg335341#msg335341
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 04, 2012, 09:48:53 AM
I noticed one important (perhaps) feature: if I change the default number of displayed products on the page (pagination), sorting works!
error       http://www.litera.spb.ru/catalog/health-and-education/councils-of-the-kind-doctor/by,%60p%60.product_sku
works     http://www.litera.spb.ru/catalog/health-and-education/councils-of-the-kind-doctor/by,%60p%60.product_sku/
works     http://www.litera.spb.ru/catalog/health-and-education/councils-of-the-kind-doctor/by,%60p%60.product_sku/results,1-72
Title: Re: 2.0.12 - 2.0.15c: trouble with sort order of the products in a category
Post by: lysov 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?
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: Milbo 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.
Title: Re: 2.0.12 - 2.0.15f: trouble with sort order of the products in a category
Post by: lysov 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?
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: Milbo on December 20, 2012, 00:27:12 AM
That means it works in 2.0.15f?
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 20, 2012, 06:36:24 AM
Unfortunately it does not work in 2/0/15f
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: Milbo on December 20, 2012, 12:56:24 PM
you fixed function virtuemartBuildRoute, just try to fix it from the otherside virtuemartParseRoute
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov 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()  :)
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: Milbo on December 20, 2012, 17:11:26 PM
hahah Ararat, I was there one time,.. I think I was 10 years old or so.
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: lysov on December 20, 2012, 17:28:48 PM
I have many friends in this area (Erevan) and they now send you greetings  :) :) :)
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: Milbo on December 20, 2012, 19:13:21 PM
Great :-) Thank you,
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: tailer 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


$ 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>';
                                }

Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: 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!
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: Milbo on June 29, 2013, 17:43:26 PM
For which version is this fix? The problem is imho solved.
Title: Re: 2.0.12 - 2.0.15a: trouble with sort order of the products in a category
Post by: FeaMor on June 24, 2015, 11:24:37 AM
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 ;)