VirtueMart 2 + 3 > Templating & Layouts

Category Page Fields for Templating

(1/27) > >>

PRO:
These fields are for use in the category view
For product page fields, look here http://forum.virtuemart.net/index.php?topic=92756

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 ?>

balai:
Truly interesting post.
Thank you

Lexiboy:
To display the product weight in a usable format:

// custom code to display weight 
     if ($product->product_weight <> '0'){
     echo "Упаковка: ";
     echo $product->product_weight;
     // echo $product->product_weight_uom;
     if ($product->product_weight_uom == "LB") echo 'мл.';
     if ($product->product_weight_uom == "OZ") echo 'л.';
     if ($product->product_weight_uom == "GR") echo 'гр.';
     if ($product->product_weight_uom == "KG") echo 'Кг.';
     if ($product->product_weight_uom == "MG") echo 'мг.';
     // print_r($product);
     }

Of course I could have dug a bit deeper into the source to find build in functionality to display the labels. To find more options, print_r is your friend :)

itsystem:
Hi,

I would like to display product_sku but when I use <?php echo $this->product->product_sku ?> it dosn't work.
What's the appropriate format ?

Thanks a lot

itsystem:
Well, I use :


--- Code: ---<?php // Product Sku
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->product_sku, array ('title' => $product->product_sku ) ); ?>
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version