【发布时间】:2015-08-07 22:31:38
【问题描述】:
我目前在 Shopware-Widget 中请求用户是否登录时遇到问题。 我需要这样做,因为如果用户未登录,则应该隐藏情绪页面上的某些元素。我刚刚所做的是将 component_html.tpl 中的代码更改为如下内容:
{if $Data.cms_title|substr:0:1 == "_"}
{assign var="private" value=true}
{else}
{assign var="private" value=false}
{/if}
{if $Data.cms_title}
<div class="page-header">
<h3>{$Data.cms_title|substr:1}</h3>
{if $private and $sUserLoggedIn}<p>This block is private</p>{/if}
</div>
{/if}
{$Data.text}
不幸的是,Shopware 默认没有将模板变量(在本例中为 $sUserLoggedIn)传递给小部件,我不知道如何解决这个问题。
任何帮助表示赞赏:) 问候
【问题讨论】: