Forum

Thread tagged as: Question, Shop

if condition and dynamic comparison in shop

I am trying to hide buy now button if user does not have enough points to buy. below is the code.

<perch:if exists="points" match="gt" value="{points_item}">
     <perch:input type="submit" class="cart-submit" value="Buy now" />
<perch:else />
     Sorry, you do not have enough points to buy now.
</perch:if> 

I can read the points when I do

<perch:shop id="points" /> //users points

<perch:shop id="points_item" type="text" label="Points Item ?"  /> // points required to buy the item

If condition always seems to satisfy even if points are not enough. can you tell me what could be wrong?

sawan ruparel

sawan ruparel 0 points

  • 5 years ago

I found the bug, my if condition had problem. correct one is

<perch:if id="points" match="gt" value="{points_item}">