Hello, everyone!
I'm trying to write my own module and everyting is allmost ok.
but i'm trying to override one of the standard functions of oxUbase class, and have no success.
I've added file /modules/viewproducts.php with next content:
in the admin i see , that i module list file is 'accepted' (oxubase is rewrited by viewproducts/newoxubase in installed modules), but it seems, that oxid still works with core file.
Any ideas?
I'm trying to write my own module and everyting is allmost ok.
but i'm trying to override one of the standard functions of oxUbase class, and have no success.
I've added file /modules/viewproducts.php with next content:
PHP Code:
<?php
class newoxUBase extends newoxUBase_parent {
/**
* Generates variables for page navigation
*
* CHANGED - if there a param 'view=p' un url, add it to pager urls
*
* @param int $iPositionCount - paging possitions count ( 0 - unlimited )
*
* @return stdClass $pageNavigation Object with pagenavigation data
*/
public function generatePageNavigation( $iPositionCount = 0 )
{
startProfile('generatePageNavigation');
$pageNavigation = new stdClass();
$pageNavigation->NrOfPages = $this->_iCntPages;
$iActPage = $this->getActPage();
$pageNavigation->actPage = $iActPage + 1;
$sUrl = $this->generatePageNavigationUrl();
if ( $iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
$iStartNo = 2;
$iFinishNo = $pageNavigation->NrOfPages;
$bStart = false;
$bFinish =false;
} else {
$iTmpVal = $iPositionCount - 3;
$iTmpVal2 = floor( ( $iPositionCount - 4 ) / 2 );
// actual page is at the start
if ( $pageNavigation->actPage <= $iTmpVal ) {
$iStartNo = 2;
$iFinishNo = $iTmpVal + 1;
$bStart = false;
$bFinish = true;
// actual page is at the end
} elseif ( $pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal ) {
$iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
$iFinishNo = $pageNavigation->NrOfPages - 1;
$bStart = true;
$bFinish = false;
// actual page is in the midle
} else {
$iStartNo = $pageNavigation->actPage - $iTmpVal2;
$iFinishNo = $pageNavigation->actPage + $iTmpVal2;
$bStart = true;
$bFinish = true;
}
}
if ( $iActPage > 0) {
$pageNavigation->previousPage = $this->_addPageNrParam( $sUrl, $iActPage - 1 );
if ($_GET['view'] == 'p'){
$pageNavigation->previousPage .= '?view=p';
}
}
if ( $iActPage < $pageNavigation->NrOfPages - 1 ) {
$pageNavigation->nextPage = $this->_addPageNrParam( $sUrl, $iActPage + 1 );
if ($_GET['view'] == 'p'){
$pageNavigation->nextPage .= '?view=p';
}
}
if ( $pageNavigation->NrOfPages > 1 ) {
for ( $i=1; $i < $pageNavigation->NrOfPages + 1; $i++ ) {
if ( $i == 1 || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
$page = new stdClass();
$page->url = $this->_addPageNrParam( $sUrl, $i - 1 );
if ($_GET['view'] == 'p'){
$pageNavigation->url .= '?view=p';
}
$page->selected = ( $i == $pageNavigation->actPage ) ? 1 : 0;
$pageNavigation->changePage[$i] = $page;
}
}
// first/last one
$pageNavigation->firstpage = $this->_addPageNrParam( $sUrl, 0 );
$pageNavigation->lastpage = $this->_addPageNrParam( $sUrl, $pageNavigation->NrOfPages - 1 );
}
var_dump($pageNavigation);
stopProfile('generatePageNavigation');
return $pageNavigation;
}
}
Any ideas?