Magento Forum

   
Error in catalog
 
Essiej82
Jr. Member
 
Total Posts:  10
Joined:  2009-09-02
 

Hi,

Last week I upgraded a Magento store from 1.5.1 to 1.7.0.2. Since the upgrade, I get this error in the catalog:

Fatal error: Call to a member function setCurPage() on a non-object in /home/users/zpageftp/zpagetti.de/app/code/core/Mage/Page/Block/Html/Pager.php on line 124

I did quite some searchqueries but can’t find the solution. The piece of code from line 121 till 128:

public function setCollection($collection)
    
{
        $this
->_collection $collection
            
->setCurPage($this->getCurrentPage());
        
// If not int - then not limit
        
if ((int) $this->getLimit()) {
            $this
->_collection->setPageSize($this->getLimit());
        
}

Any idea how to solve this?

Thnx!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TreInnova
Guru
 
Avatar
Total Posts:  462
Joined:  2009-02-20
Fano
 
EsmeraldaHop - 03 March 2013 11:52 AM

Hi,

Last week I upgraded a Magento store from 1.5.1 to 1.7.0.2. Since the upgrade, I get this error in the catalog:

Fatal error: Call to a member function setCurPage() on a non-object in /home/users/zpageftp/zpagetti.de/app/code/core/Mage/Page/Block/Html/Pager.php on line 124

I did quite some searchqueries but can’t find the solution. The piece of code from line 121 till 128:

public function setCollection($collection)
    
{
        $this
->_collection $collection
            
->setCurPage($this->getCurrentPage());
        
// If not int - then not limit
        
if ((int) $this->getLimit()) {
            $this
->_collection->setPageSize($this->getLimit());
        
}

Any idea how to solve this?

Thnx!

Hi have you tried to put some Mage::log($collection) to see if the object passed to the function is empty?
regards
filippo

 
Magento Community Magento Community
Magento Community
Magento Community
 
Essiej82
Jr. Member
 
Total Posts:  10
Joined:  2009-09-02
 

Not yet, can you perhaps explain me where I need to put that code?

 
Magento Community Magento Community
Magento Community
Magento Community
 
TreInnova
Guru
 
Avatar
Total Posts:  462
Joined:  2009-02-20
Fano
 
EsmeraldaHop - 04 March 2013 02:27 AM

Not yet, can you perhaps explain me where I need to put that code?

Hi ,
i would investigate the function you have provided:

public function setCollection($collection)
    
{
        
// $collection is empty?
       
Mage::log($collection->count(),1,'investigate_collection.log');
       
$is_collection=($collection is an instanceof Varien_Data_Collection);
       
Mage::log($is_collection,1,'investigate_collection.log');
        
$this->_collection $collection
            
->setCurPage($this->getCurrentPage());
        
// If not int - then not limit
        
if ((int) $this->getLimit()) {
            $this
->_collection->setPageSize($this->getLimit());
        
}
regards
filippo

 
Magento Community Magento Community
Magento Community
Magento Community
 
jeffcustom
Member
 
Avatar
Total Posts:  67
Joined:  2012-11-29
Boulder, CO
 

Magento upgrades from < 1.6 --> 1.7 will have issues regarding the pager blocks, as these have been refactored some. In your case however, this is not a standard issue we have run into.

Your error is happening because $collection is being passed in as (I\\\\\\\’m guessing) NULL.

You could do:

public function setCollection($collection)
    
{
        $e 
= new Exception();
        echo 
$e->getTraceAsString(); exit;
        
$this->_collection $collection
            
->setCurPage($this->getCurrentPage());
        
// If not int - then not limit
        
if ((int) $this->getLimit()) {
            $this
->_collection->setPageSize($this->getLimit());
        
}
To determine where the setCollection call is coming from.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Essiej82
Jr. Member
 
Total Posts:  10
Joined:  2009-09-02
 

With script from filippo I get this error on my page:

Parse error: syntax error, unexpected T_STRING in /home/users/zpageftp/zpagetti.de/app/code/core/Mage/Page/Block/Html/Pager.php on line 125

With script from jeffcustom I get this error on my page:

Parse error: syntax error, unexpected T_PUBLIC in /home/users/zpageftp/zpagetti.de/app/code/core/Mage/Page/Block/Html/Pager.php on line 134

Line 134 contains:

public function getCollection()

Any suggestions?

Thnx guys!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jeffcustom
Member
 
Avatar
Total Posts:  67
Joined:  2012-11-29
Boulder, CO
 

Well, we are copying the initial code you posted. If you are trying to define a function inside of a function, that isn’t going to work.

Perhaps post the entire file?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Essiej82
Jr. Member
 
Total Posts:  10
Joined:  2009-09-02
 

That indeed makes sense.

I attached the file.

Many thanks for your support!

File Attachments
Pager.php  (File Size: 15KB - Downloads: 34)
 
Magento Community Magento Community
Magento Community
Magento Community
 
jeffcustom
Member
 
Avatar
Total Posts:  67
Joined:  2012-11-29
Boulder, CO
 

Let me know what the printout of this is (I added a trace inside the problematic function)

File Attachments
Pager.printout.php  (File Size: 15KB - Downloads: 24)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Essiej82
Jr. Member
 
Total Posts:  10
Joined:  2009-09-02
 

Output in attachement.

Would it help if I give you access to my FTP account? I really have no clue how to solve this error so if you could help me out, I would really appriciate it!

File Attachments
output.txt  (File Size: 7KB - Downloads: 45)
 
Magento Community Magento Community
Magento Community
Magento Community
 
jeffcustom
Member
 
Avatar
Total Posts:  67
Joined:  2012-11-29
Boulder, CO
 

So, the issue is coming from the fishpig wordpress plugin.

I’ve seen this error before when the wordpress database credentials are not correct in the admin.

If you’d like someone at Customer Paradigm to help you, give us a call at 303-473-4400—or call toll free at 888.772.0777

 
Magento Community Magento Community
Magento Community
Magento Community
 
Essiej82
Jr. Member
 
Total Posts:  10
Joined:  2009-09-02
 

Many many thanks!

I will ask the shopowner if she still wants to have the wordpress plugin installed. We disabled wordpress a while ago so perhaps we can easily solve this issue by de-installing this plugin.

If the error remains, I will give your team a call.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top