Change Quantity to yes or no

LiteCart Fan
Frá Sweden
Meðlimur síðan des. 2013

Hi.

I would like to change Quantity so that it shows yes or no, instead of the quantity.
How do I do that? This should work but do you have a better solution?

if !empty($product->quantity)
 {
 $prodquant = 'yes';
 }
else
 {
 $prodquant = 'no';
 }

// Change 'Lagerstatus' => $product->quantity,
'Lagerstatus' => $prodquant,
tim
Founder
Frá Sweden
Meðlimur síðan maí 2013
tim

Avoid variable duplication:

'Lagerstatus' => !empty($product->quantity) ? 'yes' : 'no',

LiteCart Fan
Frá Sweden
Meðlimur síðan des. 2013

Thanks for that fine solution :)

Þú
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.