0

My checkout page is giving me this error:

Fatal error: Class 'Zend_Log' not found in /home/internat/public_html/app/code/core/Mage/Checkout/Block/Onepage.php on line 98

What could be the problem? The error line is just the last line.

public function getAddressesHtmlSelect($address, $type)
{
    if ($this->isCustomerLoggedIn()) {
        $options = array();
        foreach ($this->getCustomer()->getAddresses() as $a) {
            $options[] = array(
                'value'=>$a->getId(),
                'label'=>$a->getStreet(-1).', '.$a->getCity().', '.$a->getRegion().' '.$a->getPostcode(),
            );
        }

        $addressId = $address->getId();
        if (empty($addressId)) {
            if ($type=='billing') {
                $address = $this->getCustomer()->getPrimaryBillingAddress();
            } else {
                $address = $this->getCustomer()->getPrimaryShippingAddress();
            }
            if ($address) {
                $addressId = $address->getId();
            }
        }

        $select = $this->getLayout()->createBlock('core/html_select')
            ->setName($type.'_address_id')
            ->setId($type.'-address-select')
            ->setExtraParams('onchange="'.$type.'.newAddress(!this.value)"')
            ->setValue($addressId)
            ->setOptions($options);

        $select->addOption('', 'New Address');

        return $select->getHtml();
    }
    return '';
}
3

The error simply says, Magento couldn't find Zend_Log class inside your application. By default, this class resides in \lib\Zend\Log.php1. So the first thing that you want to make sure is, this class exist in your magento instance.

But the bigger mistake that I can see here is, there is a Core Hack, which you should never do in Magento. If you want to extend Magento functionality, you should either do a rewrite or if possible, use an event handler.

In this case, default Mage_Checkout_Block_Onepage class do not have a method getAddressesHtmlSelect(), but it's parent class (Mage_Checkout_Block_Onepage_Abstract) has one. So I doubt someone is trying to modify it's parent class method behaviour by directly putting the method inside Mage_Checkout_Block_Onepage. This is completely wrong.

I am enforcing the point. "In order to do this, you should either use any event handler or rewrite the class Mage_Checkout_Block_Onepage".

Note : We can't see any Zend_Log class usage in the provided code. So further help is not possible, if you didn't provide more details.


1 - Zend Log class

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.