Tuesday, April 2, 2013

Understand all php code of Fields in product page (Virtuemart 2)

Understand all php code of Fields in product page  (Virtuemart 2)
This article show you all php snippets code of product fields in product page of virtuemart 2. you can use every code to show value of the product field.

You will find this php code on this folder : components\com_virtuemart\views\productdetails\tmpl

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


Product SKU
<?php echo $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 $product->product_s_desc ?>


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


Product MAIN Image (the 0 is the column number for the 1st image)
<?php echo $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 $product->product_availability; ?>


Product Availability As Picture
<?php echo $product->product_availability, $this-
>product->product_availability, array('class' => 'availability')); ?>


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


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


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


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


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


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


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


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


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


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


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


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


Product Packaging
<?php echo $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));
da href="<?php echo $catturl ?>"><?php echo $this->category->category_name ?></a>

Disqus Comments