News:

Looking for documentation? Take a look on our wiki

Main Menu

problems with "order by"

Started by patrik60, December 23, 2008, 05:26:25 AM

Previous topic - Next topic

patrik60

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

#1
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

#2
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

#3
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

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

#5
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

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

#7
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;

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

patrik60

Yes, this fix seems to work. I couldn't find any problems. Thank you mauri!

mauri

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

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

I have replaced now the code and it works fine even in the backend.

mauri

#12
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;
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

patrik60

Ok, I did test it in backend, browsepage and account maintenance. It works fine.

mauri

#14
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