I have a channel for my products (items
) and I want some of the entries there to not specify a price (meaning, leave the price
field blank). When I loop through my items entries, it doesn't display those items where the price
field is left blank:
{exp:channel:entries
channel="items"
}
{exp:store:product
entry_id="{entry_id}"
}
{if '{price}' == ''}
nothing
{if:else}
{price}
{/if}
<h1>{price}: {length}x{width}x{height}</h1>
{/exp:store:product}
{/exp:channel:entries}
The reason I want to leave the price
field blank is because I want to set the price of some items in the template. A lot of the items for sale won't have a set selling price. Rather, there will be a set profit margin added on top of the item's cost based on the item's category (and these profit margins per category will change from time to time).
So, the questions:
- How do I display items that have a NULL price? If this is not possible, I guess I can just set it to any number less than 0 and consider that the case when I should set the selling price on the fly.
- How do I set the price of an item on the fly?