prestashop 1.6.1.4中未定义的索引产品

时间:2017-11-02 09:23:09

标签: php prestashop-1.6

我从prestashop 1.6获取了未定义索引产品的这些错误,我不知道如何解决这个错误。 这里需要一些帮助。

我对此很新!祝大家好日子。

以下是错误日志行:

  

[02-Nov-2017 10:22:33欧洲/布加勒斯特] PHP注意:未定义的索引:   产品   /home/zuzavetr/public_html/modules/labhoverflipimg/labhoverflipimg.php   在第40行

     

[02-Nov-2017 10:22:33欧洲/布加勒斯特] PHP注意:未定义的索引:   产品   /home/zuzavetr/public_html/modules/labhoverflipimg/labhoverflipimg.php   在第60行

我的PHP文件labhoverflipimg.php:

    <?php
    class labhoverflipimg extends Module {
        public function __construct() {
            $this->name         = 'labhoverflipimg';
            $this->tab          = 'front_office_features';
            $this->version      = '1.1';
            $this->author       = 'labersthemes';
            $this->displayName  = $this->l('Hover flip img');
            $this->description  = $this->l('Hover flip img');
            parent :: __construct();
        }

        public function install() {
           // Install SQL
            include(dirname(__FILE__).'/sql/install.php');
            foreach ($sql as $s)
                if (!Db::getInstance()->execute($s))
                    return false;
            return parent :: install()
                && $this->registerHook('rotatorImg')
                && $this->registerHook('header')
                ;
        }

        public function uninstall(){
            include(dirname(__FILE__).'/sql/uninstall_sql.php');
            foreach ($sql as $s)
                if (!Db::getInstance()->execute($s))
                    return false;
            return parent::uninstall();
        }

        public function psversion() {
            $version=_PS_VERSION_;
            $exp=$explode=explode(".",$version);
            return $exp[1];
        }

        public function hookRotatorImg($params) {
                $idproduct = $params['product']['id_product'];
                $id_shop = (int)Context::getContext()->shop->id;
                $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'image` img'; 
                $sql .= ' LEFT JOIN `'. _DB_PREFIX_ . 'image_shop` imgs';
                $sql .= ' ON img.id_image = imgs.id_image';
                $sql .= ' where imgs.`id_shop` ='.$id_shop ;
                $sql .= ' AND img.`id_product` ='.$idproduct ;
                $sql .= ' AND imgs.`rotator` =1' ;
                //echo $sql;
                $imageNew = Db::getInstance()->ExecuteS($sql);
                if(!$imageNew) {
                      $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'image` img'; 
                      $sql .= ' where img.`rotator` =1';
                      $sql .= ' AND img.`id_product` ='.$idproduct ;
                      $imageNew = Db::getInstance()->ExecuteS($sql);
                }

                $this->smarty->assign(
                    array('rotator_img'=>$imageNew,
                    'idproduct'=>$idproduct,
                    'product'=>$params['product'],
                    ));

            return $this->display(__FILE__, 'labhoverflipimg.tpl');
        }    

        public function hookdisplayHeader($params)
        {
            $this->context->controller->addCSS($this->_path.'css/labhoverflipimg.css', 'all');
        }

    }
?>

0 个答案:

没有答案