Author Topic: problems with "order by"  (Read 16663 times)

patrik60

  • Guest
problems with "order by"
« on: December 23, 2008, 05:26:25 am »
There is a very bad problem in VM search function:

Go to <site name removed> and try this:

Type in "shovel" into the search field. 6 articles will be found.

Than scroll down to Display #.

Change it from 30 to 5.

You will see now five articles per page.

Now change the view from ascending to descending and look what happens:

All of a sudden you have 6 pages instead of two and on each page you have all the same six articles.

It only works again normally, when you change the number of display into more than articles exist. And than you can start the same procedure again. It always happens when you make any changes in "Order by" and when the number of display is less than the number of articles.

This happens also on my sites using : J 1.0.15, VM 1.1.1 and J 1.5.8 VM 1.1.2

Patrik

patrik60

  • Guest
Re: problems with "order by"
« Reply #1 on: December 23, 2008, 06:41:19 am »
It seems not to be a problem with the search function. I have just installed the nightly build 1593. The problems always happens with the order function. As soon as I change anything in "order by" only one article per page will be shown until I change the number to display. I did try this with the function "Show all products" on the site mentioned in my first post.

patrik60

  • Guest
Re: problems with "order by"
« Reply #2 on: December 23, 2008, 16:25:39 pm »
I have found some problems in pageNavigation.class.php. After replacing it with an older file, the errors disappeared. Since I don't have any idea about php,may be someone in the forum or in the developper team could check this. It's possible to replicate the error also on virtuemarts demo site.

The problem startet after revision 1451!!

Patrik

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: problems with "order by"
« Reply #3 on: December 28, 2008, 18:52:47 pm »
Try this !
/administrator/components/com_virtuemart/classes/pageNavigation.class.php

Row 34:     
$this->limit = max( $limit, 1 );

Edit to:
$this->limit = max( $limit, 5 );


VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

patrik60

  • Guest
Re: problems with "order by"
« Reply #4 on: December 28, 2008, 19:33:46 pm »
I tried this, but didn't have full succes: on the first site where I made the changes all products will be shown instead of the settings in "display". for the following pages (back or forward), the settings work fine until I make any changes in "order by" again.

patrik

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: problems with "order by"
« Reply #5 on: December 28, 2008, 20:17:11 pm »
This is funny :) If you go to backend virtuemart admin.
Do this. (Only bottom navigation is effect, but it works like charm. ?)

Admin --> Configuration -> Site
Show Page Navigation at the Top of the Product Listing?   no
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: problems with "order by"
« Reply #6 on: December 28, 2008, 20:33:57 pm »
It´s the file:
/components/com_virtuemart/themes/default/templates/browse/includes/browse_orderbyform.tpl.php
When printing top navigation
if( $show_top_navigation) {

It loses the value of $limit, it´s 0 and it mess up the whole navigation.
Have you ideas how to fix this?
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: problems with "order by"
« Reply #7 on: January 01, 2009, 20:17:31 pm »
Maybe I find simply fix. patbe60, can you try it. !
File:
/administrator/components/com_virtuemart/classes/pageNavigation.class.php
Rows 79 80
Code: [Select]
$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
return $html;

Add one row before 'return $html;', like this :
Code: [Select]
$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
if (!empty($link) && strpos( 'page=shop.browse', $link) === false) {
    $html .= "\n<input type=\"hidden\" name=\"limit\" value=\"$this->limit\" />";
}
return $html;
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

patrik60

  • Guest
Re: problems with "order by"
« Reply #8 on: January 01, 2009, 20:24:10 pm »
Yes, this fix seems to work. I couldn't find any problems. Thank you mauri!

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: problems with "order by"
« Reply #9 on: January 01, 2009, 21:04:07 pm »
Glad to hear it works.
I have search this bug 4 days and when I find it, it was so simply.
This row adds limit value to html input box.

I add this to bug tracker.
Happy New Year to you.  ;D
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

patrik60

  • Guest
Re: problems with "order by"
« Reply #10 on: January 02, 2009, 02:03:28 am »
I have now detected a problem in the backend: after making this hack the list lenght in vm component stays always in the list lenght as set per default in the global configuration. changes are not possible.

patrik60

  • Guest
Re: problems with "order by"
« Reply #11 on: January 02, 2009, 17:10:42 pm »
I have replaced now the code and it works fine even in the backend.

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: problems with "order by"
« Reply #12 on: January 02, 2009, 18:07:36 pm »
Oh!!! I find the same problem in frontend account.
If user have orders, there is order list limit_box too and it shows only default
number, like in your message.

I’m sorry, but we must specify the code only to shop.browse page.
Hope this works, test it and provide feedback.

Code: [Select]
$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
if (!empty($link) && strpos( 'page=shop.browse', $link) === false) {
    $html .= "\n<input type=\"hidden\" name=\"limit\" value=\"$this->limit\" />";
}
return $html;
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

patrik60

  • Guest
Re: problems with "order by"
« Reply #13 on: January 02, 2009, 19:31:29 pm »
Ok, I did test it in backend, browsepage and account maintenance. It works fine.

mauri

  • Quality&Testing Team
  • Jr. Member
  • *
  • Posts: 297
Re: problems with "order by"
« Reply #14 on: January 05, 2009, 15:44:36 pm »
Fixed in VM 1.1.3

/components/com_virtuemart/themes/default/templates/browse/includes/browse_orderbyform.tpl.php

Row 40 <?php $pagenav->writeLimitBox( $search_string ); ?>
edit to: <?php $pagenav->writeLimitBox(); ?>
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11