Jump to content

Ответ администратора


Go to solution Solved by mishanya,

Recommended Posts

  • Solution

вот этот код в product.tpl:

<div class="comment_answer">
    <div class="adm">Ответ от <b>Администрации</b>:<br></div>
    {$comment->answer|escape|nl2br}
</div>
<style>
.comment_answer { width: 630px; background: #FFED8D; border: 1px dotted #BF9D32; padding: 10px; margin-top: 9px; }
.comment_answer .adm { margin-bottom: 8px; }
</style>

нужно обернуть в

{if $comment->answer}код{/if}
Link to post
Share on other sites
  • 4 months later...
  • 3 months later...

При редактировании комментария имеется ошибочка: PHP Warning:  Creating default object from empty value in /home/e/evoname588/public_html/simpla/CommentAdmin.php on line 11, referer: http://i-par.ru/simpla/index.php?module=CommentAdmin&id=20&return=%2Fsimpla%2Findex.php%3Fmodule%3DCommentsAdmin

Насколько я понял некритичная, но все же.
Link to post
Share on other sites

Сам спросил - сам отвечу. В результате всех замен файл CommentAdmin.php должен быть таким:

<?PHP
require_once('api/Simpla.php');

class CommentAdmin extends Simpla
{	

	public function fetch()
	{	
		if($this->request->method('post'))
		{
			$comment = new stdClass();
			$comment->id		= $this->request->post('id', 'integer');
			$comment->approved	= $this->request->post('approved', 'boolean');
			$comment->answer	= $this->request->post('answer');
				$get_comment = $this->comments->get_comment($comment->id);
			$comment->text = $get_comment->text;
			
			if($comment->id)
			{
				$this->comments->update_comment($comment->id, $comment);
				$this->design->assign('message_success', 'added');
			}

		}
		else
		{
			$comment = new stdClass();
			$comment_id = $this->request->get('id', 'integer');
			if(!empty($comment_id))
			{
				$comment = $this->comments->get_comment($comment_id);
			}

		}	
		
		$this->design->assign('comment', $comment);

		
  	  	return $this->design->fetch('comment.tpl');
	}
	
}

Тогда все работает без ошибок.

Помимо этого стиль лучше вынести в style.css и реализовать baloon:

.comment_answer {
	margin-top: 9px;
	margin-left: 50px;
	width: 600px;
	padding: 10px;
	background: #c2c2c2;
	text-align: justify;
	position: relative;
	border: 1px dotted #c2c2c2;
	border-radius: 5px;
}

.comment_answer:after {
	content: "";
	position: absolute;
	top: -7px;
	left: 48px;
	border-style: dotted;
	border-width: 0 7px 7px;
	border-color: #c2c2c2 transparent;
	display: block;
	width: 0;
	z-index: 1;
}

.comment_answer:before {
	content: "";
	position: absolute;
	top: -8px;
	left: 48px;
	border-style: dotted;
	border-width: 0 7px 7px;
	border-color: #c2c2c2 transparent;
	display: block;
	width: 0;
	z-index: 0;
}
Link to post
Share on other sites
  • 1 month later...

У меня при нажатии на кнопку "Ответить" в админке перенаправляет на страницу товаров со ссылкой Решено

 

/simpla/index.php?module=CommentAdmin&id=27&return=%2Fsimpla%2Findex.php%3Fmodule%3DCommentsAdmin
 
Edited by Julius123
Link to post
Share on other sites
  • 3 months later...

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...