VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Quality & Testing VirtueMart 1.1.x => Virtuemart 1.1 Development (Archiv) => Q&T Resolved => Topic started by: patrik60 on December 23, 2008, 05:26:25 AM

Title: problems with "order by"
Post by: patrik60 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
Title: Re: problems with "order by"
Post by: patrik60 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.
Title: Re: problems with "order by"
Post by: patrik60 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
Title: Re: problems with "order by"
Post by: mauri 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 );


Title: Re: problems with "order by"
Post by: patrik60 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
Title: Re: problems with "order by"
Post by: mauri 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
Title: Re: problems with "order by"
Post by: mauri 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?
Title: Re: problems with "order by"
Post by: mauri 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
$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
return $html;


Add one row before 'return $html;', like this :
$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;

Title: Re: problems with "order by"
Post by: patrik60 on January 01, 2009, 20:24:10 PM
Yes, this fix seems to work. I couldn't find any problems. Thank you mauri!
Title: Re: problems with "order by"
Post by: mauri 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
Title: Re: problems with "order by"
Post by: patrik60 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.
Title: Re: problems with "order by"
Post by: patrik60 on January 02, 2009, 17:10:42 PM
I have replaced now the code and it works fine even in the backend.
Title: Re: problems with "order by"
Post by: mauri 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.

$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;
Title: Re: problems with "order by"
Post by: patrik60 on January 02, 2009, 19:31:29 PM
Ok, I did test it in backend, browsepage and account maintenance. It works fine.
Title: Re: problems with "order by"
Post by: mauri 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(); ?>
Title: Re: problems with "order by"
Post by: beeworks on October 18, 2009, 10:06:40 AM
go to thew configuraiton.php and change

   var $list_limit = '5';   5 means it shows 5 prod. per page if you change it 100 it shows 100 per page.
Title: Re: problems with "order by"
Post by: brunoazevedo on January 07, 2010, 15:50:55 PM
Hi All,

Very Good Explain.

But i have similar problem.

I Have Joomla 1.5.14 and Virtuemart 1.1.4.
Site: www.voleisport.pt

The Problem:
When i click in ex: VOLEIBOL item menu, at Left menu, the list open well.
After a login, i can't view the products list.

Any one can help me?

Thanks
Bruno