Thursday, May 28, 2015

Product fields in Joomla Virtuemart

Product Page Fields:
For category fields, look here http://forum.virtuemart.net/index.php?topic=97744.0

PLEASE see http://forum.virtuemart.net/index.php?topic=98505.0


Product Name
<?php echo $this->product->product_name ?>

Product SKU
<?php echo $this->product->product_sku ?>

Ask a question about this product
<a class="ask-a-question" href="<?php echo $url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>
Short Description
   <?php echo $this->product->product_s_desc ?>

Product Full Description
      <?php echo $this->product->product_desc ?>

Product MAIN Image (the 0 is the column number for the 1st image)
<?php echo $this->product->images[0]->displayMediaFull('class="product-image"',false) ?>

Additional Images (>1 means all images past the 1st image)
      <?php if(!empty($this->product->images) && count($this->product->images)>1) {
         foreach ($this->product->images as $image) {
            echo $image->displayMediaThumb('class="product-image"',true,'class="modal"'); //'class="modal"'
         }
}
?>

Product Availability AS TEXT
<?php echo $this->product->product_availability; ?>

Product Availability As Picture
<?php echo JHTML::image(JURI::root().VmConfig::get('assets_general_path').'images/availability/'.$this->product->product_availability, $this-
>product->product_availability, array('class' => 'availability')); ?>

Minimum Order Level
<?php echo $this->product->min_order_level ?>

Maximum Order Level
<?php echo $this->product->max_order_level ?>

Product Unit
<?php echo $this->product->product_unit ?>

Product Weight
<?php echo $this->product->product_weight ?>

Product Weight Unit of Measure
<?php echo $this->product->product_weight_uom ?>

Product Length
<?php echo $this->product->product_length ?>

Product Width
<?php echo $this->product->product_width ?>

Product Height
<?php echo $this->product->product_height ?>

Product URL
<?php echo $this->product->product_url ?>

Product # In Stock
<?php echo $this->product->product_in_stock ?>

Product Availability Date
<?php echo $this->product->product_available_date ?>

Product Special 0 or 1 0 for no, 1 for yes.
<?php echo $this->product->product_special ?>

Product Packaging
<?php echo $this->product->product_packaging ?>

Create a link to the product's main category from the product page.
$catturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.JRequest::getInt('virtuemart_category_id',0));

<a href="<?php echo $catturl ?>"><?php echo $this->category->category_name ?></a>

Manufacturer Name
<?php echo $this->product->mf_name ?>

All Fields Above can be used for extra fields, and features on the product page.

For example. I use product weights of 0 to be items with free shipping. So, to display "FREE Shipping"  to the user, I do this.

<?php if ($this->product->product_weight == 0) { ?>
                  <div>Free Shipping on this Item! Minimum Order Quantity <?php echo $this->product->min_order_level ?></div>
               <?php    }?>

So the code above shows free shipping, and the minimum quantity order amount.

You can do the same with most fields.

To display an icon, or text if a product is featured you can do this.

<?php if ($this->product->product_special == 1) { ?>
                  <div>SALE ITEM!!!!! </div>
               <?php    }?>

Tell the customer the stock is low, and they should order NOW!
<?php if ($this->product->product_in_stock <= 10) { ?>
                  <div>ONLY <?php echo $this->product->product_in_stock ?> In Stock. ORDER BEFORE IT'S TOO LATE</div>
               <?php    }?>

No comments:

Post a Comment