ivteksrf Опубликовано 25 мая, 2020 Жалоба Поделиться Опубликовано 25 мая, 2020 (изменено) Подскажите, пожалуйста. Не могу настроить скидку для постоянного покупателя . Когда нажимаю на "добавить группу" вылезает ошибка . В чем может быть причина? Где копать ? Изменено 25 мая, 2020 пользователем ivteksrf Цитата Ссылка на сообщение Поделиться на другие сайты
shooroop Опубликовано 25 мая, 2020 Жалоба Поделиться Опубликовано 25 мая, 2020 /simpla/GroupAdmin.php сравните с вашим <?PHP require_once('api/Simpla.php'); class GroupAdmin extends Simpla { public function fetch() { if($this->request->method('post')) { $group->id = $this->request->post('id', 'integer'); $group->name = $this->request->post('name'); $group->discount = $this->request->post('discount'); if(empty($group->id)) { $group->id = $this->users->add_group($group); $this->design->assign('message_success', 'added'); } else { $group->id = $this->users->update_group($group->id, $group); $this->design->assign('message_success', 'updated'); } $group = $this->users->get_group(intval($group->id)); } else { $id = $this->request->get('id', 'integer'); if(!empty($id)) $group = $this->users->get_group(intval($id)); } if(!empty($group)) { $this->design->assign('group', $group); } return $this->design->fetch('group.tpl'); } } Цитата Ссылка на сообщение Поделиться на другие сайты
ivteksrf Опубликовано 25 мая, 2020 Автор Жалоба Поделиться Опубликовано 25 мая, 2020 (изменено) /simpla/GroupAdmin.php сравните с вашим <?PHP require_once('api/Simpla.php'); class GroupAdmin extends Simpla { public function fetch() { if($this->request->method('post')) { $group->id = $this->request->post('id', 'integer'); $group->name = $this->request->post('name'); $group->discount = $this->request->post('discount'); if(empty($group->id)) { $group->id = $this->users->add_group($group); $this->design->assign('message_success', 'added'); } else { $group->id = $this->users->update_group($group->id, $group); $this->design->assign('message_success', 'updated'); } $group = $this->users->get_group(intval($group->id)); } else { $id = $this->request->get('id', 'integer'); if(!empty($id)) $group = $this->users->get_group(intval($id)); } if(!empty($group)) { $this->design->assign('group', $group); } return $this->design->fetch('group.tpl'); } } <?PHP require_once('api/Simpla.php'); class GroupAdmin extends Simpla { public function fetch() { $group = new stdClass; if($this->request->method('post')) { $group->id = $this->request->post('id', 'integer'); $group->name = $this->request->post('name'); $group->discount = $this->request->post('discount'); if(empty($group->name)) { $this->design->assign('message_error', 'empty_name'); } else { if (empty($group->id)) { $group->id = $this->users->add_group($group); $this->design->assign('message_success', 'added'); } else { $group->id = $this->users->update_group($group->id, $group); $this->design->assign('message_success', 'updated'); } $group = $this->users->get_group(intval($group->id)); } else { $id = $this->request->get('id', 'integer'); if(!empty($id)) $group = $this->users->get_group(intval($id)); } if(!empty($group)) { $this->design->assign('group', $group); } return $this->design->fetch('group.tpl'); } } вот так у меня Изменено 25 мая, 2020 пользователем ivteksrf Цитата Ссылка на сообщение Поделиться на другие сайты
ivteksrf Опубликовано 25 мая, 2020 Автор Жалоба Поделиться Опубликовано 25 мая, 2020 /simpla/GroupAdmin.php сравните с вашим <?PHP require_once('api/Simpla.php'); class GroupAdmin extends Simpla { public function fetch() { if($this->request->method('post')) { $group->id = $this->request->post('id', 'integer'); $group->name = $this->request->post('name'); $group->discount = $this->request->post('discount'); if(empty($group->id)) { $group->id = $this->users->add_group($group); $this->design->assign('message_success', 'added'); } else { $group->id = $this->users->update_group($group->id, $group); $this->design->assign('message_success', 'updated'); } $group = $this->users->get_group(intval($group->id)); } else { $id = $this->request->get('id', 'integer'); if(!empty($id)) $group = $this->users->get_group(intval($id)); } if(!empty($group)) { $this->design->assign('group', $group); } return $this->design->fetch('group.tpl'); } } спасибо большое ) все заработало Цитата Ссылка на сообщение Поделиться на другие сайты
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.