After a recent upgrade to Magento 1.6.2.0 and using Clever CMS, we realized there was an issue on our frontend! We saw a weird error we had never seen before with an older version of Clever CMS.

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/your_account/public_html/app/code/community/Clever/Cms/Model/Page.php on line 101

Some of you might be wondering what in the world who/what T_PAAMAYIM_NEKUDOTAYIM actually is. Aside from being an influential programmer, a T_PAAMAYIM_NEKUDOTAYIM is the double colon system that PHP uses to call a parent class's static field, static constant, static variable, or static method. Thankfully, resolving this error is easy to fix.

Step 1

Open your favorite text editor or log into your web host via terminal and go to public_html/app/code/community/Clever/Cms/Model/Page.php. Open the file with your text editor or a edit or vim command in shell. Go to line 101 or find the method called getChildren.

public function getChildren()
    {
        $collection = $this->getCollection();
        // $collection->setOrder('position', $collection::SORT_ORDER_ASC);
        $collection->setOrder('position', $collection->SORT_ORDER_ASC);
        $collection->getSelect()
            ->where('main_table.store_id = ?', $this->getStoreId())
            ->where('main_table.parent_id = ?', $this->getId());

        return $collection;
    }

Notice the line commented out with $collection::SORT_ORDER_ASC. We need to change the :: to a -> because $collection is an object calling a static constantin the Mage_Cms_Model_Page class. In fact, if we look in Magento 1.6.2.0 we'll see that this static constant doesn't even exist in this class or it's parent class (Mage_Core_Model_Abstract)!

That should fix anyone's issue with this error!

Be Sociable, Share!