0

I have a condition which doesn't work:

<isif condition="#(Product:QLC_ValidTo > current_date)#">                        
    <span class="items-in-stock align-left">
        <isinclude template="product/inc/CC_StockStatus"/>
    </span>
</isif>

There are two valid values for both operands:

Product:QLC_ValidTo = 29.11.16 and current_date = 13.10.17

but it doesn't work.

I suppose is it incorrect to try to implement it as a simple comparison and values should be converted to another format?

4

1 回答 1

5

我不同意下面的做法,看我之前的帖子。如果您坚持只使用isml,那么您可以执行以下操作。

<%
    getPipelineDictionary().put("current_date",new Date());
%>
<isif condition="#(Product:QLC_ValidTo:getTime > current_date:getTime)#">                        
    <span class="items-in-stock align-left">
        <isinclude template="product/inc/CC_StockStatus"/>
    </span>
</isif>

检索毫秒作为 long 并将其与 gt 运算符进行比较。这些运算符仅适用于数字。

就像之前说的那样,宁愿在扩展中这样做。您可以对其进行单元测试,处理时区问题,提高可读性等。

于 2017-10-13T15:29:51.173 回答