Tuesday, June 4, 2013

Understand all php code of Fields in category page of Virtuemart 2

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

These fields are for use in the category view For product page fields, look here http://www.maxofweb.com/2013/04/understand-all-php-code-of-fields-in.html

Product fields that are not listed here can be used like this
<?php echo $product->COLUMN_NAME ?>


The difference between category and product page is $this 
$this->product is for product page
$product-> is for product fields on the category page.

SO, to add weight to the category page. You can do
<?php echo $product->product_weight ?>


Category Name
<?php echo $this->category->category_name; ?>


Category Description
<?php echo $this->category->category_description ; ?>


Product Name with Link
<?php echo JHTML::link($product->link, $product->product_name) ?>


Product Details Link with anchor “Product Details”
<?php echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' =>  'product-details'));?>


Order by list
<?php echo $this->orderByList['orderby']; ?>


Manufacturer Dropdown
<?php echo $this->orderByList['manufacturer']; ?>


Pages/Links/Pagination
<?php echo $this->vmPagination->getResultsCounter();?>

<?php echo $this->vmPagination->getLimitBox(); ?>

<?php echo $this->vmPagination->getPagesLinks(); ?>

<?php echo $this->vmPagination->getPagesCounter(); ?>


Short Description
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc, 40, '...') ?>


^^ Notice the 40 above. limitStringByWord strips the text to 40 characters. You can change the "40" For Full short desc
<?php echo $product->product_s_desc ?>


POP UP Product Image
<?php echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'"  ',true,'class="modal"'); ?>


Link Image to product page
<?php echo JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb('class="catImage" border="0"',false));                   ?>


Stock Level
<?php echo $product->stock->stock_level ?>


#Products in Stock
<?php echo $product->product_in_stock ?>
Disqus Comments