What is the syntax to show THE CustomField, for example, CustomFieldX (not using foreach) into Category View. I'm using CategoryView as table and I need to show needed customfields in columns:
product_sku customfieldX customfieldY
1111 valueX1 valueY1
222 valueX2 valueY2
Every product can have more customfields (also customfieldZ, customfieldA), but I need to show only these 2!
Is it possible, if yes - HOW?
Thank You!
I've been reading almost all the posts related to custom fields. The above quoted answer is the only one I found, which is somehow related to my question. The problem is that the above mentioned question was never answered. Here is my question:
In the productdetails page, I would like to display a 2 colon table with all the details about the product ( not just the customfields !).
A table structure for the output, for example:
"Manufacturer:" manufacturer name
"Product Title:" title of the product
"Category:" name of the category
"XYZ 001:" custom field value
"XYZ 002:" custom field value
"XYZ 003:" custom field values
NONE of the customfields are Cart Variant.
Customfield's specs are as follows:
XYZ 001 - ID 30 - integer - one value per each product
XYZ 002 - ID 31 - string - one value per each product
XYZ 003 - ID 32 - string - multiple values per each product
So far, I've managed to display the first three rows.
My question is how do I echo the value of a SPECIFIC customfield (ONLY ONE customfield, without using foreach) in the productdetails page? (I want to insert that into a table cell.)
Thank you in advance for any advice on this one.
Here is what I tried (found some code in this post:
http://forum.virtuemart.net/index.php?topic=100191.0 , but doesn't work) :
<table class="table_d_021">
<tr>
<th>Characteristics</th>
</tr>
<tr class="td02row_01">
<td>Manufacturer:</td>
<td><?php echo $this->product->mf_name ?></td>
</tr>
<tr class="td02row_02">
<td>Model:</td>
<td><?php echo $this->product->product_name ?></td>
</tr>
<tr class="td02row_01">
<td>Category:</td>
<td><?php echo $this->category->category_name; ?></td>
</tr>
<tr class="td02row_02">
<td>XYZ 001:</td>
<td>
<?php
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('custom_value');
$query->from('#__fra_virtuemart_product_customfields');
$query->where('virtuemart_product_id="' . (int) $db->escape($product->virtuemart_product_id) . '"');
$query->where('virtuemart_custom_id="30"');
$db->setQuery($query);
$result = $db->loadResult();
echo "<span class=\"YourClass\">".$result."</span>";
?>
</td>
</tr>
<tr class="td02row_01">
<td>XYZ 002:</td>
<td>
<div>
<?php if ($field->custom_title != "xyz-002") { ?>
<?php echo JText::_($field->custom_title); ?>
<?php if ($field->custom_tip) echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png');
} ?>
<span class="product-field-display"><?php echo $field->display ?></span>
<span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span>
</div>
</td>
</tr>
<tr class="td02row_02">
<td>XYZ 003:</td>
<td> ........... </td>
</tr>
</table>