1

Simple question, but I can't seem to find the documentation to do this properly.

Currently using the following: {order_qty} ITEMS IN BAG

How would I go about replacing "ITEMS" with "ITEM" when the quantity equals 1?

4
  • Did you tried to use PHP at that case? – JackTheKnife Mar 21 '14 at 15:26
  • I don't feel comfortable writing PHP from scratch, but thanks for the lead. I'll do some googling. – 88mpg Mar 21 '14 at 15:41
  • Remember to enable PHP for that particular template when you will test it – JackTheKnife Mar 21 '14 at 15:46
  • {if {order_qty} == 1}ITEM{if:else}ITEMS{/if} worked – 88mpg Mar 21 '14 at 15:57
3

You could save a bit of processing by using a simple conditional instead of an advanced conditional.

EDIT Show something different when the cart is empty

{exp:store:cart}
 {if no_items}
   Your cart is empty!
   {!-- this only shows when the cart is empty --}
 {/if}
  {order_qty} ITEM{if {order_qty} > 1}S{/if} IN BAG
  {!-- this will only show if there is actually something in the cart --}
{/exp:store:cart}
2
  • I haven't tested, but it seems this would display "0 ITEM IN BAG", right? – 88mpg Mar 24 '14 at 13:21
  • 1
    Indeed it would, I have edited my comment with a no results conditional so you can show a customized response when the cart is empty. – Justin Long Mar 24 '14 at 16:49
1
{if {order_qty} == 1}ITEM{if:else}ITEMS{/if}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.