News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

When I change category, VM don't reset the page number

Started by mrmagoo, March 01, 2012, 09:39:37 AM

Previous topic - Next topic

mrmagoo

I have 3 pages for category A and 5 pages for category B.
For example, browsing through the pages of category A I stop at page 2.
Then I decide to select the category B.
Unfortunately it happens that navigation in category B starts from page 2 instead of page 1.
So for all the categories

Thanks
Bye

enock

I put up a post http://forum.virtuemart.net/index.php?topic=98113.msg323512#msg323512

agree - it is crazy you are on page 6 in one category and change category and you are taken to page 6 not page 1

mrmagoo

At this topic  http://forum.virtuemart.net/index.php?topic=94540.0  Reply #6 (denyal)  I found the solution of my problem.
Unfortunately now I can't change page in the back-end of products.
:(   :(   :(  ....  >:(


mrmagoo

I moved the string given by "denyal" in IF statement of JVM_VERSION as you can see in the code, adding an IF statement to check the contents of $view.

if(JVM_VERSION === 2) {
$limitStart = $mainframe->getUserStateFromRequest('com_virtuemart.'.$view.'.limitstart', 'limitstart',  0, 'int');
if ($view == "category") {
if(!$_GET['start']) $limitStart=0;
}
} else {
$limitStart = JRequest::getInt('limitstart',0);
}



Now the pagination of the products starts from 0 when I change the category and the back-end of the products works.

mrmagoo

 >:( >:( >:(
Now doesn't work pagination in the back-end of the categories.

HELP ME!  :'(

There is a way to check if I am in the front-end rather than the back-end?

Thanks.

enock

Thanks for trying mrmagoo but with this code in place you can't leave page one  :(

PRO

what version are you using? as far as I know pagination is solved

enock

J2.5.2 VM2.0.3B

See for yourself - test site http://www.loti.com.au (it's a bit slow -has 4500 products - is that due to VM?)

Click on Street Magic Category - then click on page 5 now click on category Books - you go directly to page 5.

No - it isn't fixed yet

As of March 8  Milbo http://forum.virtuemart.net/index.php?topic=99258.0looks like there will be a fix to my problem by Milbo http://forum.virtuemart.net/index.php?topic=99258.0 still thinks it's a problem

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

enock



mrmagoo

#11
Quote from: Milbo on March 12, 2012, 10:52:47 AM
I am quite sure this is fixed in the svn now.


I'm sorry, but it's not fixed for me ( J 2.5.3 + VM 2.0.2).
I have temporarily solved the problem by adding the last three lines of code after line 362


//There is a strange error in the frontend giving back 9 instead of 10, or 24 instead of 25
//This functions assures that the steps of limitstart fit with the limit
if(!empty($limit)){
     $limitStart = ceil((float)$limitStart/(float)$limit) * $limit;
}




new code to be added

if (!stristr($_SERVER['REQUEST_URI'], 'administrator')) {
if(!$_GET['start']) $limitStart=0;
}



It isn't a "wonderful" change, but now it works and pagination starts from 1 when I select a new category in front-end, leaving the way to page the back end.

VlaKur

I add
      if (!stristr($_SERVER['REQUEST_URI'], 'administrator')) {
         if(!$_GET['start']  and strpos($_SERVER['REQUEST_URI'], "results") == false  ) $limitStart=0;
      }

that when change sort orders, it work too...

pnguyen

Thank Vlakur

But in VM2.x , I modify you code line : "if(!$_GET['start']"  to "if(!$_GET['limitstart']"

full code:
if (!stristr($_SERVER['REQUEST_URI'], 'administrator')) {
            if(!$_GET['limitstart']  and strpos($_SERVER['REQUEST_URI'], "results") == false  ) $limitStart=0;
        }

joophilverink

Quote from: mrmagoo on March 26, 2012, 23:00:09 PM
Quote from: Milbo on March 12, 2012, 10:52:47 AM
I am quite sure this is fixed in the svn now.


I'm sorry, but it's not fixed for me ( J 2.5.3 + VM 2.0.2).
I have temporarily solved the problem by adding the last three lines of code after line 362


//There is a strange error in the frontend giving back 9 instead of 10, or 24 instead of 25
//This functions assures that the steps of limitstart fit with the limit
if(!empty($limit)){
     $limitStart = ceil((float)$limitStart/(float)$limit) * $limit;
}




new code to be added

if (!stristr($_SERVER['REQUEST_URI'], 'administrator')) {
if(!$_GET['start']) $limitStart=0;
}



It isn't a "wonderful" change, but now it works and pagination starts from 1 when I select a new category in front-end, leaving the way to page the back end.

Hi,
I do have the same problem. Where can I find this php file??