1

we are getting this error in frontend of the site.

Fatal error: Call to a member function collect() on a non-object in /var/www/html/sitenanme/app/code/core/Mage/Sales/Model/Quote/Address.php on line 1013

This is complete code : http://pastebin.com/KkHCm0zG

''This is the code from Address.php line 1000 to 1030."

'

public function getTotalModels()
{
        return $this->getTotalCollector()->getRetrievers();
    }

    /**
     * Collect address totals
     *
     * @return Mage_Sales_Model_Quote_Address
     */
    public function collectTotals()
    {
        Mage::dispatchEvent($this->_eventPrefix . '_collect_totals_before', array($this->_eventObject => $this));
        foreach ($this->getTotalCollector()->getCollectors() as $model) {
            $model->collect($this);
        }
        Mage::dispatchEvent($this->_eventPrefix . '_collect_totals_after', array($this->_eventObject => $this));
        return $this;
    }

    /**
     * Get address totals as array
     *
     * @return array
     */
    public function getTotals()
    {
        foreach ($this->getTotalCollector()->getRetrievers() as $model) {
            $model->fetch($this);
        }
        return $this->_totals;
    }
1

If you have custom totals collector you may have a typo in it.
In your config.xml that is translated by nodes <sales><quote><totals><{custom_total}>.
The best way to debug that is to see which $model is called when this error is triggered with a Zend_Debug::dump(get_class($model)); that give you a hint about the total collector.

  • Its very difficult for me to debug. are you asking that am i using any extension ? is there any possible to give me the code need to be add in that file – Baby in Magento Dec 15 '15 at 20:25
  • i added like this : – Baby in Magento Dec 15 '15 at 20:34
  • public function collectTotals() { Mage::dispatchEvent($this->_eventPrefix . '_collect_totals_before', array($this->_eventObject => $this)); foreach ($this->getTotalCollector()->getCollectors() as $model) { $model->collect($this); Zend_Debug::dump(get_class($model)); } Mage::dispatchEvent($this->_eventPrefix . '_collect_totals_after', array($this->_eventObject => $this)); return $this; – Baby in Magento Dec 15 '15 at 20:34
  • now its displaying like this : prntscr.com/9elo4f did i misplaced the code ? – Baby in Magento Dec 15 '15 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.