Ios ContextErrorException通知:未定义的偏移量:1 prestashop 1.7

Ios ContextErrorException通知:未定义的偏移量:1 prestashop 1.7,ios,Ios,我有一个在prestashop 1.5上运行良好的交付模块,当迁移到prestashop 1.7时,我遇到了以下问题,我是prestashop的新手,但我认为问题来自这行“$horaire=explode(“|”),$select_day[1])” 公共函数hookDisplayCarrierExtraContent($params) { $jours=array(); $stores=Store::getStores(Context::getContext()->language->id);

我有一个在prestashop 1.5上运行良好的交付模块,当迁移到prestashop 1.7时,我遇到了以下问题,我是prestashop的新手,但我认为问题来自这行“$horaire=explode(“|”),$select_day[1])”

公共函数hookDisplayCarrierExtraContent($params)
{
$jours=array();
$stores=Store::getStores(Context::getContext()->language->id);
$stores_data=array();
对于($i=0;$i_getStoreWorkingHours($stores[$i]);
/*转储($this->getStoreWorkingHours($stores[$i]);死亡*/
if(is_数组($this->getStoreWorkingHours($stores[$i]))| is_对象($this->getStoreWorkingHours($stores[$i]))
{
foreach($this->_getStoreWorkingHours($stores[$i])作为$jour)
{
$jours[$jourr['id']]=$jourr['day'];
}
}
}
//从所选地址提取selecte day。
//日期和小时以字符串形式存储在地址的“其他”字段中。
$cart=$params['cart'];
k短期(焦耳);
//从购物车中获取所选地址。
$selected\u Address=新地址($cart->id\u Address\u delivery);
//提取日。
$select_day=explode('),$selected_address->other);
$horaire=爆炸(“|”,$select_day[1])------问题就在这里
$jour=$horaire[0];
$this->context->smarty->assign(数组)(
'stores'=>json_encode($stores_data),
'carrier'=>(int)配置::get('AVAILABLE\u STORE\u DELIVERY\u carrier'),
'map'=>Configuration::get('AVAILABLE\u STORE\u DELIVERY\u DISPLAY\u map'),
'address\u id'=>$selected\u address->alias,
“jour_id”=>this->getDateWeek($horaire[0]),
“焦耳”=>美元焦耳,
“json”=>序列化($stores\u data)
));
if(配置::get('AVAILABLE\u STORE\u DELIVERY\u DISPLAY\u MAP')==true)
{
$this->context->smarty->assign('heightMap',Configuration::get('AVAILABLE\u STORE\u DELIVERY\u HEIGHT\u MAP');
$this->context->smarty->assign('widthMap',Configuration::get('AVAILABLE\u STORE\u DELIVERY\u WIDTH\u MAP');
$this->context->smarty->assign('defaultLat',(float)配置::get('PS\u STORES\u CENTER\u LAT');
$this->context->smarty->assign('defaultLong',(float)配置::get('PS\u STORES\u CENTER\u LONG');
$this->context->smarty->assign('logo\u store',Configuration::get('PS\u STORES\u ICON');
$this->context->smarty->assign('hasStoreIcon',文件存在('PS\u IMG\u DIR.Configuration::get('PS\u STORES\u ICON'));
}
返回$this->display(_文件,'availablestoredelivery.tpl');
}

您的脚本试图通过分解地址数据库对象的“其他”字符串字段(先按符号,然后按管道符号)来获取数据,而无需进行任何一致性检查,因此请查看您的客户地址“其他”字段内容,可能在VersionOne升级过程中没有正确迁移它们。

感谢您的回复,另一个字段已为空,因此自上一版本以来没有内容。。。。因此,在数据库级别没有修改:/
 public function hookDisplayCarrierExtraContent($params)
    {
          
        $jours = array();
        $stores= Store::getStores(Context::getContext()->language->id);
        $stores_datas=array(); 
         
        for($i = 0; $i<count($stores); $i++) 
        {
            $stores[$i]['name']    = str_replace(["'", '"'],"&#39;",$stores[$i]['name']);
            $stores[$i]['address1']= str_replace("'","&#39;",$stores[$i]['address1']);
            $stores[$i]['address2']= str_replace("'","&#39;",$stores[$i]['address2']);
            $stores[$i]['hours']    = str_replace(["'", "[", "]", '"'],"",$stores[$i]['hours']);

            $stores[$i]['hours'] = explode(',' ,$stores[$i]['hours'] );         

            $stores[$i]['note']    = str_replace("'","&#39;",$stores[$i]['note']);
            $stores_datas[$stores[$i]['id_store']] = $stores[$i];
            $stores_datas[$stores[$i]['id_store']]['has_store_picture'] = file_exists(_PS_STORE_IMG_DIR_.(int)($stores[$i]['id_store']).'.jpg');
            
            $stores_datas[$stores[$i]['id_store']]['hours'] = $stores[$i]['hours'];  
            $stores_datas[$stores[$i]['id_store']]['working_days_hours']=$this->_getStoreWorkingHours($stores[$i]);
            /*dump($this->_getStoreWorkingHours($stores[$i]));die;*/
            if (is_array($this->_getStoreWorkingHours($stores[$i])) || is_object($this->_getStoreWorkingHours($stores[$i])))
            {
            foreach ($this->_getStoreWorkingHours($stores[$i]) as $jour) 
            {
                $jours[$jour['id']] = $jour['day'];
            }
            }
        }
        //extract selecte day from the selected address.
        // the date and hours are stored in "other" field of Address as a string.
        $cart=$params['cart'];
        ksort($jours);
        // Get the selected adress form cart.
   
        $selected_adress=new Address($cart->id_address_delivery);
        //extract day.
        $select_day= explode(')',$selected_adress->other);
        $horaire=  explode('|', $select_day[1]); ------preblem is here 
        $jour=$horaire[0];
        $this->context->smarty->assign(array(
            'stores' => json_encode($stores_datas),
            'carrier' => (int)Configuration::get('AVAILABLE_STORE_DELIVERY_CARRIER'),
            'map' => Configuration::get('AVAILABLE_STORE_DELIVERY_DISPLAY_MAP'),
            'address_id' =>$selected_adress->alias,
            'jour_id'=> $this->getDateWeek($horaire[0]),
            'jours' => $jours,
            'json'=> serialize($stores_datas) 

        ));
     
        if(Configuration::get('AVAILABLE_STORE_DELIVERY_DISPLAY_MAP') == true) 
        {
            $this->context->smarty->assign('heightMap',Configuration::get('AVAILABLE_STORE_DELIVERY_HEIGHT_MAP'));
            $this->context->smarty->assign('widthMap',Configuration::get('AVAILABLE_STORE_DELIVERY_WIDTH_MAP'));
            $this->context->smarty->assign('defaultLat',(float)Configuration::get('PS_STORES_CENTER_LAT'));
            $this->context->smarty->assign('defaultLong', (float)Configuration::get('PS_STORES_CENTER_LONG'));
            $this->context->smarty->assign('logo_store', Configuration::get('PS_STORES_ICON'));
            $this->context->smarty->assign('hasStoreIcon', file_exists(_PS_IMG_DIR_.Configuration::get('PS_STORES_ICON')));
        }


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