Quantcast
Channel: OXID Community Forum
Viewing all articles
Browse latest Browse all 6951

Extend oxUBase

$
0
0
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:
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 )
    {
        
startProfile('generatePageNavigation');

        
$pageNavigation = new stdClass();

        
$pageNavigation->NrOfPages $this->_iCntPages;
        
$iActPage $this->getActPage();
        
$pageNavigation->actPage   $iActPage 1;
        
$sUrl $this->generatePageNavigationUrl();

        if ( 
$iPositionCount == || ($iPositionCount >= $pageNavigation->NrOfPages) ) {
             
$iStartNo 2;
             
$iFinishNo $pageNavigation->NrOfPages;
             
$bStart false;
             
$bFinish =false;
        } else {
            
$iTmpVal $iPositionCount 3;
            
$iTmpVal2 floor( ( $iPositionCount ) / );

            
// 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 );
            if (
$_GET['view'] == 'p'){
                
$pageNavigation->previousPage .= '?view=p';
            }
        }

        if ( 
$iActPage $pageNavigation->NrOfPages ) {
            
$pageNavigation->nextPage $this->_addPageNrParam$sUrl$iActPage );
            if (
$_GET['view'] == 'p'){
                
$pageNavigation->nextPage .= '?view=p';
            }
        }

        if ( 
$pageNavigation->NrOfPages ) {

            for ( 
$i=1$i $pageNavigation->NrOfPages 1$i++ ) {

                if ( 
$i == || $i == $pageNavigation->NrOfPages || ( $i >= $iStartNo && $i <= $iFinishNo ) ) {
                    
$page = new stdClass();
                    
$page->url $this->_addPageNrParam$sUrl$i );
                    if (
$_GET['view'] == 'p'){
                        
$pageNavigation->url .= '?view=p';
                    }
                    
$page->selected = ( $i == $pageNavigation->actPage ) ? 0;
                    
$pageNavigation->changePage[$i] = $page;
                }
            }

            
// first/last one
            
$pageNavigation->firstpage $this->_addPageNrParam$sUrl);
            
$pageNavigation->lastpage  $this->_addPageNrParam$sUrl$pageNavigation->NrOfPages );
        }
        
        
var_dump($pageNavigation);

        
stopProfile('generatePageNavigation');

        return 
$pageNavigation;
    }
    
}

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?

Viewing all articles
Browse latest Browse all 6951

Trending Articles