Fails when I change the carousel in opencart?

If you change the slideshow gives me error
Notice: Undefined index: effect in C:\Users\YotaChapaevsk\Desktop\server\OSPanel\domains\localhost\admin\model\plaza\slider.php on line 56Warning: Cannot modify header information - headers already sent by (output started at C:\Users\YotaChapaevsk\Desktop\server\OSPanel\domains\localhost\admin\controller\startup\error.php:34) in C:\Users\YotaChapaevsk\Desktop\server\OSPanel\domains\localhost\system\library\response.php on line 36
March 19th 20 at 08:57
2 answers
March 19th 20 at 08:59
Solution
A normal situation for openheart,
For starters, get into the code where an error on the foreach and put a check run a loop if the array
And you can read more please? PHP sign from afar - Fiona_Huels commented on March 19th 20 at 09:02
@Fiona_Huels,
well for starters...
open the file C:\Users\YotaChapaevsk\Desktop\server\OSPanel\domains\localhost\admin\model\plaza\slider.php
get up to 56 strings and show what You have written there - Jeremie_Fer commented on March 19th 20 at 09:05
Just in case 55y lines to 78th line of the entire part of the code you pulled
public function editSlider($ptslider_id, $data) {
 $this->db->query("UPDATE" . DB_PREFIX . "ptslider SET name = '" . $this->db->escape($data['name']) . "', status = '" . (int) $data['status'] . "'auto = '" . (int) $data['auto'] . "', delay = '" . (int) $data['delay'] . "', hover = '" . (int) $data['hover'] . "', nextback = '" . (int) $data['nextback'] . "', effect = '" . $data['effect'] . "', contrl = '" . (int) $data['contrl'] . "' WHERE ptslider_id = '" . (int) $ptslider_id . "'");

 $this->db->query("DELETE FROM" . DB_PREFIX . "ptslider_image WHERE ptslider_id = '" . (int) $ptslider_id . "'");
 $this->db->query("DELETE FROM" . DB_PREFIX . "ptslider_image_description WHERE ptslider_id = '" . (int) $ptslider_id . "'");

 if (isset($data['ptslider_image'])) {

 foreach ($data['ptslider_image'] as $ptslider_image) {

 $slider_store = "";
 if(isset($data['slider_store'])) {
 $slider_store = implode(',', $data['slider_store']);
}
 $this->db->query("INSERT INTO" . DB_PREFIX . "ptslider_image SET ptslider_id = '" . (int) $ptslider_id . "', link = '" . $this->db->escape($ptslider_image['link']) . "', type = '" . $this->db->escape($ptslider_image['type']) . "', image = '" . $this->db->escape($ptslider_image['image']) . "', slider_store = '" . $slider_store . "'");

 $ptslider_image_id = $this->db->getLastId();

 foreach ($ptslider_image['ptslider_image_description'] as $language_id => $ptslider_image_description) {
 $this->db->query("INSERT INTO" . DB_PREFIX . "ptslider_image_description SET ptslider_image_id = '" . (int) $ptslider_image_id . "', language_id = '" . (int) $language_id . "', ptslider_id = '" . (int) $ptslider_id . "', title = '" . $this->db->escape($ptslider_image_description['title']) . "', sub_title = '" . $this->db->escape($ptslider_image_description['sub_title']) . "', description = '" . $this->db->escape($ptslider_image_description['description']) . "'");
}
}
}
 }
- Fiona_Huels commented on March 19th 20 at 09:08
$this->db->query("UPDATE" . DB_PREFIX . "ptslider SET name = '" . $this->db->escape($data['name']) . "', status = '" . (int) $data['status'] . "'auto = '" . (int) $data['auto'] . "', delay = '" . (int) $data['delay'] . "', hover = '" . (int) $data['hover'] . "', nextback = '" . (int) $data['nextback'] . "', effect = '" . $data['effect'] . "', contrl = '" . (int) $data['contrl'] . "' WHERE ptslider_id = '" . (int) $ptslider_id . "'");

well the problem is this line in your case there is no key in the $data variable( $data['effect'] )
it's hard to help because they do not know the correct behavior of the slider
well, you can start with the simple before this line insert
if(!isset($data['effect'])) {
$data['effect'] = ";
}
- Jeremie_Fer commented on March 19th 20 at 09:11
@Jeremie_Fer, thanks for help) - Fiona_Huels commented on March 19th 20 at 09:14
March 19th 20 at 09:01
Sending headers after output of the page. That is already a symbol of some kind was sent to the user and then send the headers (header(), session_start(), setcookie (), etc.). Maybe it's the encoding, try to move in "UTF-8 without BOM", it is possible in notepad++ to do.
It wasn't that. Here PHP threw NOTIS
Notice: Undefined index: effect in
Therefore, such a situation has arisen with the title - Jeremie_Fer commented on March 19th 20 at 09:04

Find more questions by tags ocStoreOpenCart