wolfcms/wolfcms — Issue #397: next and previous page methods after reordering
Author: gvdgvd
Created: 2012-01-25 22:04:03+00:00
State: open

I use these methods to look if i`m at the last product page, so i can disable a next button I created on the frontend (or disable the previous if its the first product page ).

But there was a problem with one of the categories, so I looked for the problem and found it:

```php

public function next() {
if ($this->parent() !== false) {
return $this->parent()->children(array(
'limit' => 1,
'where' => 'page.position > '.$this->position.' AND page.id > '.$this->id,
'order' => 'page.position ASC'
));
}

return false;
}

```

The method takes into account the position value (which is good) and the id value (which is not good). Because after reordering, the previous page could have a larger id than the current page, so the function will return false. The use of id should be altered or removed altogether