0

Hello friends i am using magento and expression engine both in my site and for integration expression engine with magento i am using one module mage_integratee in that php file i get following error so how i can solve this errors

1)
A PHP Error was encountered
Severity: Notice
Message: Undefined index: store
Filename: mage_integratee/ext.mage_integratee.php
Line Number: 138

2) 
A PHP Error was encountered
Severity: Notice
Message: Undefined index: exclude
Filename: mage_integratee/ext.mage_integratee.php
Line Number: 153

3)
A PHP Error was encountered
Severity: Warning
Message: require_once(/home/hst/domains/hst.uldev.co/public_html/Mage.php): failed to open stream: No such file or directory
Filename: mage_integratee/ext.mage_integratee.php
Line Number: 177

4)
Fatal error: require_once(): Failed opening required '/home/hst/domains/hst.uldev.co/public_html/Mage.php' (include_path='.:/usr/local/lib/php') in /home/hst/domains/hst.uldev.co/public_html/a/system/expressionengine/third_party/mage_integratee/ext.mage_integratee.php on line 177 

i am using following php code in mage_integratee.php file

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mage_integratee_ext {

    var $name       = 'Mage Integratee';
    var $version        = '2.0.3';
    var $description    = 'Integrate Magento Layouts into ExpressionEngine Pages';
    var $settings_exist = 'y';
    var $docs_url       = ''; // 'http://expressionengine.com/user_guide/';

    var $settings        = array();

    /**
     * Constructor
     * 
     * @param   mixed   Settings array or empty string if none exist.
     */
    function __construct($settings='')
    {
        $this->settings = $settings;
    }
    // END

    /**
     * Activate Extension
     *
     * This function enters the extension into the exp_extensions table
     *
     * @see http://codeigniter.com/user_guide/database/index.html for
     * more information on the db class.
     *
     * @return void
     */
    function activate_extension()
    {
        $this->settings = array(
            'mage'   => $_SERVER['DOCUMENT_ROOT'],
            'head'  => 'y',
            'after_body_start'  => 'y',
            'global_notices'  => 'y',
            'header'  => 'y',
            'global_messages'  => 'y',
            'left'  => 'y',
            'right'  => 'y',
            'footer'  => 'y',
            'before_body_end'  => 'y'
        );


        $data = array(
            'class'     => __CLASS__,
            'method'    => 'init_layout',
            'hook'      => 'template_fetch_template',
            'settings'  => serialize($this->settings),
            'priority'  => 10,
            'version'   => $this->version,
            'enabled'   => 'y'
        );

        ee()->db->insert('extensions', $data);
    }
    // END

    /**
     * Update Extension
     *
     * This function performs any necessary db updates when the extension
     * page is visited
     *
     * @return  mixed   void on update / false if none
     */
    function update_extension($current = '')
    {
        if ($current == '' OR $current == $this->version)
        {
            return FALSE;
        }

        if ($current < '2.0.0')
        {
            // Update to version 1.0
        }

        ee()->db->where('class', __CLASS__);
        ee()->db->update(
                    'extensions',
                    array('version' => $this->version)
        );
    }
    // END

    /**
     * Disable Extension
     *
     * This method removes information from the exp_extensions table
     *
     * @return void
     */
    function disable_extension()
    {
        ee()->db->where('class', __CLASS__);
        ee()->db->delete('extensions');
    }
    // END

    // --------------------------------
    //  Settings
    // --------------------------------

    function settings()
    {
        $settings = array();

        $settings['mage']      = array('i', '', "");
        $settings['store']      = array('i', '', "");
        $settings['exclude']      = array('i', '', "");
        $settings['head']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['after_body_start']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['global_notices']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['header']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['global_messages']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['left']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['right']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['footer']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['before_body_end']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');

        return $settings;
    }
    // END

    // --------------------------------
    //  Initialize Layout
    // --------------------------------

    function init_layout($row)
    {

        $mageRunCode = $this->settings['store'];
        $mageRunType = "store";

        if(isset( ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_CODE']))
        {
            $mageRunCode = ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_CODE'];
        }

        if(isset( ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_TYPE']))
        {
            $mageRunType = ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_TYPE'];
        }

        //print_r(ee()->config);

        if($this->settings['exclude'] != "")
        {
            if (strpos($this->settings['exclude'], $row['group_name']) !== FALSE)
            {
                return $row;
            }
        }

        if ( ! ee()->session->cache(__CLASS__, 'mage'))
        {

            if($this->settings['mage'] === ""){
                return $row;
            } else {
              $mage = $this->settings['mage'];
            }

            if($mage[strlen($mage)-1] !== "/"){
                $mage .= "/Mage.php";
            } else {
                $mage .= "Mage.php";
            }

            //Initialize Magento
            require_once $mage;
            Mage::app($mageRunCode,$mageRunType);
            Mage::getSingleton('core/session', array('name'=>'frontend'));

            //Check if logged in
            if(Mage::getSingleton('customer/session')->IsLoggedIn()){ 
                //Load Layout Handles
                $layout = Mage::app()->getLayout();
                $layout->getUpdate()
                    ->addHandle('default')
                    ->addHandle('expressionengine_integratee')
                    ->addHandle('customer_logged_in')
                    ->load();
            }
            else
            { 
                //Load Layout Handles
                $layout = Mage::app()->getLayout();
                $layout->getUpdate()
                    ->addHandle('default')
                    ->addHandle('expressionengine_integratee')
                    ->addHandle('customer_logged_out')
                    ->load();
            }

            //Generate Blocks
            $layout->generateXml()
                ->generateBlocks();

            ee()->session->set_cache(__CLASS__, 'mage', '1');

            //Load Block Output and Create Global Variables
            if($this->settings['head'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'head'))
                {
                    $head = $layout->getBlock('head')->setTitle("")->toHtml();
                    $head = str_replace('?___SID=U', '', $head);
                    ee()->config->_global_vars['mage:head'] = $head;
                    ee()->session->set_cache(__CLASS__, 'head', $head);
                } else {
                    $head = ee()->session->cache(__CLASS__, 'head');
                    ee()->config->_global_vars['mage:head'] = $head;
                }

            }
            if($this->settings['after_body_start'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'after_body_start'))
                {
                    $after_body_start = $layout->getBlock('after_body_start')->setTitle("")->toHtml();
                    $after_body_start = str_replace('?___SID=U', '', $after_body_start);
                    ee()->config->_global_vars['mage:after_body_start'] = $after_body_start;
                    ee()->session->set_cache(__CLASS__, 'after_body_start', $after_body_start);
                } else {
                    $after_body_start = ee()->session->cache(__CLASS__, 'after_body_start');
                    ee()->config->_global_vars['mage:after_body_start'] = $after_body_start;
                }

            }
            if($this->settings['global_notices'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_notices'))
                {
                    $global_notices = $layout->getBlock('global_notices')->setTitle("")->toHtml();
                    $global_notices = str_replace('?___SID=U', '', $global_notices);
                    ee()->config->_global_vars['mage:global_notices'] = $global_notices;
                    ee()->session->set_cache(__CLASS__, 'global_notices', $global_notices);
                } else {
                    $global_notices = ee()->session->cache(__CLASS__, 'global_notices');
                    ee()->config->_global_vars['mage:global_notices'] = $global_notices;
                }

            }
            if($this->settings['header'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'header'))
                {
                    $header = $layout->getBlock('header')->setTitle("")->toHtml();
                    $header = str_replace('?___SID=U', '', $header);
                    ee()->config->_global_vars['mage:header'] = $header;
                    ee()->session->set_cache(__CLASS__, 'header', $header);
                } else {
                    $header = ee()->session->cache(__CLASS__, 'header');
                    ee()->config->_global_vars['mage:header'] = $header;
                }

            }
            if($this->settings['global_messages'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_messages'))
                {
                    $global_messages = $layout->getBlock('global_messages')->setTitle("")->toHtml();
                    $global_messages = str_replace('?___SID=U', '', $global_messages);
                    ee()->config->_global_vars['mage:global_messages'] = $global_messages;
                    ee()->session->set_cache(__CLASS__, 'global_messages', $global_messages);
                } else {
                    $global_messages = ee()->session->cache(__CLASS__, 'global_messages');
                    ee()->config->_global_vars['mage:global_messages'] = $global_messages;
                }

            }
            if($this->settings['left'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'left'))
                {
                    $left = $layout->getBlock('left')->setTitle("")->toHtml();
                    $left = str_replace('?___SID=U', '', $left);
                    ee()->config->_global_vars['mage:left'] = $left;
                    ee()->session->set_cache(__CLASS__, 'left', $left);
                } else {
                    $left = ee()->session->cache(__CLASS__, 'left');
                    ee()->config->_global_vars['mage:left'] = $left;
                }

            }
            if($this->settings['right'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'right'))
                {
                    $right = $layout->getBlock('right')->setTitle("")->toHtml();
                    $right = str_replace('?___SID=U', '', $right);
                    ee()->config->_global_vars['mage:right'] = $right;
                    ee()->session->set_cache(__CLASS__, 'right', $right);
                } else {
                    $right = ee()->session->cache(__CLASS__, 'right');
                    ee()->config->_global_vars['mage:right'] = $right;
                }

            }
            if($this->settings['footer'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'footer'))
                {
                    $footer = $layout->getBlock('footer')->setTitle("")->toHtml();
                    $footer = str_replace('?___SID=U', '', $footer);
                    ee()->config->_global_vars['mage:footer'] = $footer;
                    ee()->session->set_cache(__CLASS__, 'footer', $footer);
                } else {
                    $footer = ee()->session->cache(__CLASS__, 'footer');
                    ee()->config->_global_vars['mage:footer'] = $footer;
                }

            }
            if($this->settings['before_body_end'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'before_body_end'))
                {
                    $before_body_end = $layout->getBlock('before_body_end')->setTitle("")->toHtml();
                    $before_body_end = str_replace('?___SID=U', '', $before_body_end);
                    ee()->config->_global_vars['mage:before_body_end'] = $before_body_end;
                    ee()->session->set_cache(__CLASS__, 'before_body_end', $before_body_end);
                } else {
                    $before_body_end = ee()->session->cache(__CLASS__, 'before_body_end');
                    ee()->config->_global_vars['mage:before_body_end'] = $before_body_end;
                }

            }

            return $row;

        } else {

            //Load Block Output and Create Global Variables
            if($this->settings['head'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'head'))
                {                  
                    $head = ee()->session->cache(__CLASS__, 'head');
                    ee()->config->_global_vars['mage:head'] = $head;
                }

            }
            if($this->settings['after_body_start'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'after_body_start'))
                {
                    $after_body_start = ee()->session->cache(__CLASS__, 'after_body_start');
                    ee()->config->_global_vars['mage:after_body_start'] = $after_body_start;
                }

            }
            if($this->settings['global_notices'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_notices'))
                {
                    $global_notices = ee()->session->cache(__CLASS__, 'global_notices');
                    ee()->config->_global_vars['mage:global_notices'] = $global_notices;
                }

            }
            if($this->settings['header'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'header'))
                {
                    $header = ee()->session->cache(__CLASS__, 'header');
                    ee()->config->_global_vars['mage:header'] = $header;
                }

            }
            if($this->settings['global_messages'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_messages'))
                {
                    $global_messages = ee()->session->cache(__CLASS__, 'global_messages');
                    ee()->config->_global_vars['mage:global_messages'] = $global_messages;
                }

            }
            if($this->settings['left'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'left'))
                {
                    $left = ee()->session->cache(__CLASS__, 'left');
                    ee()->config->_global_vars['mage:left'] = $left;
                }

            }
            if($this->settings['right'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'right'))
                {
                    $right = ee()->session->cache(__CLASS__, 'right');
                    ee()->config->_global_vars['mage:right'] = $right;
                }

            }
            if($this->settings['footer'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'footer'))
                {
                    $footer = ee()->session->cache(__CLASS__, 'footer');
                    ee()->config->_global_vars['mage:footer'] = $footer;
                }

            }
            if($this->settings['before_body_end'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'before_body_end'))
                {
                    $before_body_end = ee()->session->cache(__CLASS__, 'before_body_end');
                    ee()->config->_global_vars['mage:before_body_end'] = $before_body_end;
                }

            }

            return $row;
        }
    }
    // END

}
// END CLASS
2

For the first two errors, you need open the extension's setting in the CP and setup all parameters.

For errors 3 & 4, check if your server path to Mage.php is correct.

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.