店主在.isml模板中获取日期 [英] intershop get date in .isml template

查看:148
本文介绍了店主在.isml模板中获取日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查条件:

<isif condition="#not ((Product:QLC_Enable EQ 'true') AND (Product:QLC_ValidTo > NOW) AND (Product:QLC_Quantity < 1))#">                        
    <span class="items-in-stock align-left">
        <isinclude template="product/inc/CC_StockStatus"/>
    </span>
</isif>

但是使用此句段似乎是不正确的:

But it seems that it is incorrect to use this segment:

Product:QLC_ValidTo > NOW

特别是问题是 NOW的语法。我不知道应该如何设置它,无法在他们的文档中找到。

Particularly the problem is the syntax for 'NOW'. I have no idea how it should be set and cannot find out in their documentation.

有人可以帮忙吗?

推荐答案

我认为在isml中这是不可能的。最好写一个ProductBO扩展并用Java编写条件。然后,您可以在isml中调用扩展名以显示该元素。避免在isml中放置过多的逻辑,它只能用作视图。

I don't believe that this is possible in isml. Beter to write a ProductBO extension and write the condition in java. You can then call the extension in isml to display the element. Avoid putting too much logic in isml, it should only function as the view.

示例

<isif condition="#NOT ((Product:QLC_Enable EQ 'true') AND (Product:Extension("ProductExt"):isValid) AND (Product:QLC_Quantity < 1))#">                        
    <span class="items-in-stock align-left">
        <isinclude template="product/inc/CC_StockStatus"/>
    </span>
</isif>

您可以看到此处如何创建业务对象扩展。

You can see here how to create a business object extension.

public interface ProductBOExtension extends BusinessObjectExtension<ProductBO>
{
    public static final String EXTENSION_ID = "ProductExt";
    public boolean isValid();
}

实施班

public class ProductBOExtensionImpl extends AbstractBusinessObjectExtension<ProductBO> implements ProductBOExtension
{
    public boolean isValid(){
        return this.getExtendedObject().getAttributeValue("QLC_ValidTo").getDateValue().after(new Date());
    }
}

这篇关于店主在.isml模板中获取日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆