ivteksrf Posted May 25, 2020 Report Share Posted May 25, 2020 (edited) Подскажите, пожалуйста. Не могу настроить скидку для постоянного покупателя . Когда нажимаю на "добавить группу" вылезает ошибка . В чем может быть причина? Где копать ? Edited May 25, 2020 by ivteksrf Quote Link to post Share on other sites
shooroop Posted May 25, 2020 Report Share Posted May 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'); } } Quote Link to post Share on other sites
ivteksrf Posted May 25, 2020 Author Report Share Posted May 25, 2020 (edited) /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'); } } вот так у меня Edited May 25, 2020 by ivteksrf Quote Link to post Share on other sites
ivteksrf Posted May 25, 2020 Author Report Share Posted May 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'); } } спасибо большое ) все заработало Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.