Magento – Ajax Error in system.log checkout/cart/sidebar/default.phtml on line 15

Today we had a template in which there were entries in the error log with the message:

Notice: Undefined index: isAjax in /PFAD/www/app/design/frontend/default/default/[UnserTemplate]/checkout/cart/sidebar/default.phtml on line 15

In this line of the above. File we found the following code:

			if($params['IsAjax'])

This was embedded in a function, which looked so:

        <a href="<?php 
	        $params = $this->getRequest()->getParams();
			if($params['IsAjax']) 
				$isAjax = 1;
			else
				$isAjax = 0;
			if($isAjax == 1){
				$refererUrl = Mage::registry('referrer_url');
		        if (empty($refererUrl)) {
		            $refererUrl = Mage::getBaseUrl();
		        }
				$deleteUrl = $this->getUrl(
		            'ajax/index/delete',
		            array(
		                Id =>$_item->getId(),
		                Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper('core/url')->getEncodedUrl($refererUrl)
		            )
		        );

There were probably a few issues with the Ajax script. We have the o.g. Part then completely (of <a href bis ); ) replaced by the following code.

        <a href="<?php 
            $params = $this->getRequest()->getParams();
            if(isset($params['IsAjax'])) {
                if($params['IsAjax'] == 1){
                    $refererUrl = Mage::registry('referrer_url');
                    if (empty($refererUrl)) {
                        $refererUrl = Mage::getBaseUrl();
                    }
                    $deleteUrl = $this->getUrl(
                        'ajax/index/delete',
                        array(
                            Id =>$_item->getId(),
                            Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper('core/url')->getEncodedUrl($refererUrl)
                        )
                    );
                }

Now the checkout works fine and there are no more error messages.

Used in Magento Version 1.7.0.2. Ask, Suggestions? Gladly!

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

4 comments on “Magento – Ajax Error in system.log checkout/cart/sidebar/default.phtml on line 15”

  1. 2014-07-24T05:05:08+00:00 ERR (3): Notice: Undefined index: isAjax in /app/design/frontend/default/theme362/template/ajax/checkout/cart/sidebar/default.phtml on line 15

    how to deal with it?

  2. Halo,

    ich habe das selbe Problem, nach dem Weiterleitung von Paypal zum Checkout um die Bestellung abzuschließen passiert nach dem Klick auf “Jetzt Kaufen” nichts.

    Leider lässt sich mit dieser Anleitung das Problem nicht fixen.
    Possibly. eine Idee woran es liegen kann?:-(

  3. Also, Problem wurde behoben

    Habe im Backend zwecks Speed Optimierung

    CSS & Javascript verbinden angeklickt.
    Wenn ich dies wieder auf NEIN setze, funktioniert der Checkout wie gewohnt.
    Weiß jemand wie ich das wieder geradebiegen kann wenn ich es dennoch aktiviert lassen möchte?

Leave a Reply

Your email address will not be published. Required fields are marked *