кароче выдает в коде ссылку на ?route=module/megareviews/ajaxgetReviews которая кидает ряд ошибок что нету переменных: Notice: Undefined index: product_id in ****catalog/controller/module/megareviews.php on line 224Notice: Undefined index: sort in ******catalog/controller/module/megareviews.php on line 229 Notice: Undefined index: order in *********catalog/controller/module/megareviews.php on line 230 Notice: Undefined index: start in ***********catalog/controller/module/megareviews.php on line 231 Notice: Undefined index: limit in **********catalog/controller/module/megareviews.php on line 232 В стандарте разве они должны быть?
PHP: $this->data['product_id'] = $data['product_id']; $this->data['reviewsinfo'] = $this->model_module_megareviews->getReviewsInfo($this->data['product_id']); $this->data['settings']=$this->config->get('settings'); $data = array( 'product_id' => $this->data['product_id'], 'sort' => $data['sort'], 'order' => $data['order'], 'start' => (int) $data['start'], 'limit' => (int)$data['limit'] ); Завтра разберусь)
Этот модуль под 1.5. В двойке вместо $this->data просто $data. Правда, тут есть и передача в $data всех параметров, но не факт, что этот массив используется дальше. Покажи весь код из файла.
Так я на 1.5.6.4) PHP: <?phperror_reporting(0);class ControllerModuleMegareviews extends Controller { protected function index($setting) { $this->data = array_merge($this->data, $this->load->language('module/megareviews')); $this->load->model('module/megareviews'); $settings=$this->config->get('settings'); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['options'] = $this->model_module_megareviews->getOptions(); $this->data['ays'] = $this->model_module_megareviews->getAys(); if (isset($this->request->get['product_id'])) $this->data['product_id'] = $this->request->get['product_id']; $this->data['reviewsinfo'] = $this->model_module_megareviews->getReviewsInfo($this->data['product_id']); $this->data['settings']=$this->config->get('settings'); $data = array( 'product_id' => $this->data['product_id'], 'sort' => 'r.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $settings['perpage'] ); $css_file = 'megareviews.css'; if(file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/stylesheet/' . $css_file)) { $this->data['path']='catalog/view/theme/' . $this->config->get('config_template'); $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/' . $css_file); $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/magnific-popup.css'); }else { $this->document->addStyle('catalog/view/theme/default/stylesheet/' . $css_file); $this->document->addStyle('catalog/view/theme/default/stylesheet/magnific-popup.css'); $this->data['path']='catalog/view/theme/default'; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/megareviews.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/megareviews.tpl'; } else { $this->template = 'default/template/module/megareviews.tpl'; } $this->document->addStyle('https://fonts.googleapis.com/css?family=Open+Sans'); $this->document->addScript('catalog/view/javascript/megareviews.js'); $this->document->addScript('catalog/view/javascript/jquery.magnific-popup.min.js'); $this->load->model('tool/image'); $rating=$this->data['reviewsinfo']['rating'];$starwidth=20; $this->data['reviewsinfo']['stars']=''; for($i=1;$i<=5;$i++){ if($i<=$rating) $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } if(floor($rating)!=$rating){ $pos=floor($rating)*$starwidth; $width=($rating-floor($rating))*$starwidth; $this->data['reviewsinfo']['stars'].="<div class='mr-star' style='position:absolute;left:".$pos."px;overflow:hidden;width:".$width."px;'><img width='".$starwidth."' height='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; } $this->data['reviews'] = $this->model_module_megareviews->getReviews($data); if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } foreach($this->data['reviews'] as &$review){ $stars=''; $starwidth=15; for($i=1;$i<=5;$i++){ if($i<=$review['rating']) $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } $review['stars']=$stars; $review['options']=$this->model_module_megareviews->getOptionValues($review['review_id']); $review['ays']=$this->model_module_megareviews->getAyValues($review['review_id']); $review['images']=$this->model_module_megareviews->getImages($review['review_id']); foreach($review['images'] as &$im){ $im['small'] = $this->model_tool_image->resize($im['big'], 100, 100); } unset($im); if(isset($votes[$review['review_id']]))$review['vote']=$votes[$review['review_id']]; else $review['vote']=-1; } unset($review); $this->response->setOutput($this->render()); } public function addReview(){ if (($this->request->server['REQUEST_METHOD'] == 'POST') ) { $post=$this->request->post; $this->load->model('setting/setting'); $settings=$this->config->get('settings'); if ($settings['captcha']==1 && (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha']))) { return; } for ($i = 0; $i < count($_FILES['file']['name']); $i++) {//loop to get individual element from the array $target_path = "image/data/mr/"; //Declaring Path for uploaded images if(!is_dir($target_path)) mkdir($target_path); $validextensions = array("jpeg", "jpg", "png"); //Extensions which are allowed $ext = explode('.', basename($_FILES['file']['name'][$i]));//explode file name from dot(.) $file_extension = end($ext); //store extensions in the variable $target_name = rand(1,10000). $ext[0]. "." . $ext[count($ext) - 1];//set the target path with a new name of image $target_path = $target_path.$target_name; $j = $j + 1;//increment the number of uploaded images according to the files in array if (($_FILES["file"]["size"][$i] < 1000000) //Approx. 100kb files can be uploaded. && in_array($file_extension, $validextensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $target_path)) {//if file moved to uploads folder $post['files'][]="data/mr/".$target_name; } else {//if file was not moved. } } } } $post['status']='0'; if($settings['approve']==0)$post['status']='1'; $this->load->model('module/megareviews'); $this->model_module_megareviews->addReview($post); } public function ajaxOptions() { $this->load->model('module/megareviews'); $this->load->model('setting/setting'); $s=$this->config->get('settings'); echo json_encode(Array("options" => $this->model_module_megareviews->getOptions(), "ay" => $this->model_module_megareviews->getAys(), "rating" => $s['rvalues'])); } public function ajaxVote() { $this->load->model('module/megareviews'); $this->load->model('setting/setting'); $data=$_POST; $forever = time()+3600*24*365*10; if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } if(isset($votes[$data['id']])){ if($votes[$data['id']]==$data['vote']){ unset($votes[$data['id']]); $result['status']=0; if($data['vote']==0) $this->model_module_megareviews->downVote($data['id'],-1); else $this->model_module_megareviews->upVote($data['id'],-1); }else{ $result['status']=-1; } }else{ $result['status']=1; $votes[$data['id']]=$data['vote']; if($data['vote']==0) $this->model_module_megareviews->downVote($data['id'],1); else $this->model_module_megareviews->upVote($data['id'],1); } setcookie( 'lastvote', json_encode($votes), $forever); //print_r($_COOKIE); echo json_encode($result); } public function ajaxValidate() { $data=$_POST; $this->load->model('setting/setting'); $settings=$this->config->get('settings'); $this->load->language('module/megareviews'); $f=true; if($settings['recommend']==2 && !isset($data['recommend'])){ $f=false; $error["recommend"]=$this->language->get('text_requirederror'); } if($settings['rating']==2 && $data['rating']<0){ $f=false; $error["rating"]=$this->language->get('text_requirederror'); } if($settings['title']==2 && strlen($data['title'])==0){ $f=false; $error["title"]=$this->language->get('text_requirederror'); } $error["text"]=''; if($settings['text']==2 && strlen($data['text'])==0){ $f=false; $error["text"]=$this->language->get('text_requirederror'); } if(!isset($data['text']) || strlen($data['text'])<$settings['textcount']){ $f=false; $error["text"].=$this->language->get('text_lengtherror'); } if($settings['nickname']==2 && (!isset($data['author']) || strlen($data['author'])==0)){ $f=false; $error["author"]=$this->language->get('text_requirederror'); } if($settings['phone']==2 && (!isset($data['phone']) || strlen($data['phone'])==0)){ $f=false; $error["phone"]=$this->language->get('text_requirederror'); } if($settings['email']==2 && (!isset($data['email']) || strlen($data['email'])==0)){ $f=false; $error["email"]=$this->language->get('text_requirederror'); } if($settings['custom']==2 && (!isset($data['custom']) || strlen($data['custom'])==0)){ $f=false; $error["custom"]=$this->language->get('text_requirederror'); } if ($settings['captcha']==1 && (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $data['captcha']))) { $f=false; $error['captcha'] = $this->language->get('text_errorcaptcha'); } $result["status"] = $f ? '1' : '0'; $result["message"]=$f ? $settings['approve']==1 ? $this->language->get('text_addsuccess0') : $this->language->get('text_addsuccess1') : $this->language->get('text_adderror'); $result["error"]=$error; echo json_encode($result); } public function ajaxgetReviews() { $data=$_POST; $this->data = array_merge($this->data, $this->load->language('module/megareviews')); $this->load->model('module/megareviews'); $settings=$this->config->get('settings'); $this->data['options'] = $this->model_module_megareviews->getOptions(); $this->data['ays'] = $this->model_module_megareviews->getAys(); $this->data['product_id'] = $data['product_id']; $this->data['reviewsinfo'] = $this->model_module_megareviews->getReviewsInfo($this->data['product_id']); $this->data['settings']=$this->config->get('settings'); $data = array( 'product_id' => $this->data['product_id'], 'sort' => $data['sort'], 'order' => $data['order'], 'start' => (int) $data['start'], 'limit' => (int)$data['limit'] ); $css_file = 'megareviews.css'; if(file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/stylesheet/' . $css_file)) { $this->data['path']='catalog/view/theme/' . $this->config->get('config_template'); }else { $this->data['path']='catalog/view/theme/default'; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/megareviews_list.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/megareviews_list.tpl'; } else { $this->template = 'default/template/module/megareviews_list.tpl'; } $this->load->model('tool/image'); $rating=$this->data['reviewsinfo']['rating'];$starwidth=25; $this->data['reviewsinfo']['stars']=''; for($i=1;$i<=5;$i++){ if($i<=$rating) $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } if(floor($rating)!=$rating){ $pos=floor($rating)*$starwidth; $width=($rating-floor($rating))*$starwidth; $this->data['reviewsinfo']['stars'].="<div class='mr-star' style='position:absolute;left:".$pos."px;overflow:hidden;width:".$width."px;'><img width='".$starwidth."' height='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; } $this->data['reviews'] = $this->model_module_megareviews->getReviews($data); if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } foreach($this->data['reviews'] as &$review){ $stars=''; $starwidth=15; for($i=1;$i<=5;$i++){ if($i<=$review['rating']) $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } $review['stars']=$stars; $review['options']=$this->model_module_megareviews->getOptionValues($review['review_id']); $review['ays']=$this->model_module_megareviews->getAyValues($review['review_id']); $review['images']=$this->model_module_megareviews->getImages($review['review_id']); foreach($review['images'] as &$im){ $im['small'] = $this->model_tool_image->resize($im['big'], 100, 100); } unset($im); if(isset($votes[$review['review_id']]))$review['vote']=$votes[$review['review_id']]; else $review['vote']=-1; } unset($review); print_r($this->render()); }}?> --- Добавлено, 13 фев 2017 --- Сам модуль+перевод
Вот за это: PHP: $data=$_POST; надо оторвать автору ноги вместе с тем, что чуть выше! Замени эту строку на: PHP: $post_data = $this->request->post; И, соответственно, дальше замени $data на $post_data вот здесь: PHP: 'product_id' => $this->data['product_id'],'sort' => $data['sort'],'order' => $data['order'],'start' => (int) $data['start'],'limit' => (int)$data['limit'] Строкой выше не трогай.
PHP: Search "$data=$_POST;" (3 hits in 1 file) C:\Users\1\AppData\Local\Temp\fz3temp-2\megareviews.php (3 hits) Line 133: $data=$_POST; Line 161: $data=$_POST; Line 215: $data=$_POST; --- Добавлено, 14 фев 2017 --- Менять только с 215 строки?
Я и не заметил, что такого там много. Ну, менять надо везде, но в других местах лучше название переменной не менять, я не смотрел, где она там используется. Но это не решение проблемы с ошибками, а просто закрытие потенциальной дыры. А откуда ошибки пока несовсем понятно. Эти параметры передаются js при запросе и, если попереключать по типу отзывов, когда этот запрос и отправляется, я вижу, что там всё на месте.
Та от я о том=же. Не могу понять откуда она лезет, если вроде все на месте. Может закрыть его тупо от индексирования?
А как закрытие индексирования поможет от ошибки? Думаешь, это поисковики запросы отправляют без параметров?
Возвращаемся к ошибке - почему оно попадает в индекс: Ошибки сайта Показаны данные за последние 90 дней Ошибки URL Дата: 16.02.17 Ошибка 404- ?route=module/megareviews/ajaxgetReviews