News:

Looking for documentation? Take a look on our wiki

Main Menu

Help with If & Else Statement

Started by davies401, September 12, 2015, 11:35:26 AM

Previous topic - Next topic

davies401

Joomla 3.4.4
Virtuemart 3.0.9

Hi,

I've added a line of code to product details default.php to show the number left in stock, which works ok.
The line is "<div class="edition">Limited Edition - Only <?php echo $this->product->product_in_stock ?> Left Now</div>"
However, I need to add in an "if" because I don't want to show the statement where I have zero products, can anybody advise me how I should do this? I've tried a couple of times, but I'm not getting it right.

I'd be grateful for any pointers,

Many thanks
Alan

GJC Web Design

<?php

if($this->product->product_in_stock > 0){ ?>
<div class="edition">Limited Edition - Only <?php echo $this->product->product_in_stock ?> Left Now</div>

<?php } ?>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

davies401

Hi GJC,

Very many thanks, your help is much appreciated.

Thank you
Alan