Jump to content

не работает функция "Постоянный покупатель" в группе пользователей


Recommended Posts

Подскажите, пожалуйста. Не могу настроить скидку для постоянного покупателя . Когда нажимаю на "добавить группу" вылезает ошибка . В чем  может быть причина? Где копать ?

post-22208-0-84024600-1590437821_thumb.jpg

post-22208-0-88695400-1590437969_thumb.jpg

post-22208-0-46080200-1590438176_thumb.jpg

Edited by ivteksrf
Link to post
Share on other sites

/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');
	}
	
}


 

Link to post
Share on other sites

/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 by ivteksrf
Link to post
Share on other sites

/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');
	}
	
}

 

 

спасибо большое ) все заработало 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...