Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Zero108

COMMERCE 4.1.10 - как добавить проверку группы в шаблон?

Recommended Posts

Подскажите, пожалуйста, как добавить в шаблон темы проверку, что если пользователь является гостем, то обведенное красным ему не отображается, а вместо цены отображается надпись из языковой строки? Что-то из серии if group id = 2 then ... else ... Либо чтобы просто проверяло, авторизован или нет, а не группу проверяло: if \IPS\Member::loggedIn()

 

9d497b064b76.jpg

Edited by Zero108

Share this post


Link to post
Share on other sites
{{if !\IPS\Member::i()->loggedIn()->member_id}}Только для гостей{{endif}}

Share this post


Link to post
Share on other sites

Шаблон price:

 

<span class='cNexusPrice'>
{{if $priceMayChange}}
	{lang="price_from" sprintf="$price"}
{{else}}
	{$price}
{{endif}}
</span>
{{if \IPS\Member::loggedIn()->language()->checkKeyExists('nexus_tax_explain_val')}}<span class='cNexusPrice_tax ipsType_light'>{lang="nexus_tax_explain_val"}</span>{{endif}}

Share this post


Link to post
Share on other sites

Попробовал вот так - белый экран.

 

<span class='cNexusPrice'>
{{if $priceMayChange}}
	{lang="price_from" sprintf="$price"}
{{else}}
	{{if !\IPS\Member::i()->loggedIn()->member_id}}
	Текст для гостей
	{{else}}
	{$price}
	{{endif}}		
{{endif}}
</span>
{{if \IPS\Member::loggedIn()->language()->checkKeyExists('nexus_tax_explain_val')}}<span class='cNexusPrice_tax ipsType_light'>{lang="nexus_tax_explain_val"}</span>{{endif}}

Edited by Zero108

Share this post


Link to post
Share on other sites

<span class='cNexusPrice'>
   {{if $priceMayChange}}
       {lang="price_from" sprintf="$price"}
   {{else}}
       {{if member.member_id}}
		{$price}
       {{else}}
		Текст для гостей
       {{endif}}       
   {{endif}}
</span>

или:

 

<span class='cNexusPrice'>
   {{if $priceMayChange}}
	{lang="price_from" sprintf="$price"}
   {{elseif member.member_id}}
	{$price}
   {{else}}
	Текст для гостей
   {{endif}}
</span>

  • Upvote 1

Share this post


Link to post
Share on other sites

Спасибо. Оба варианта работают. Попробую для второй выделенной красным области применить. Если не получится, отпишу.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...