Hello!
I'm trying to show custom fields(specific product layout position) with in category page. (I read many topics, but I didnt find the solution). I think there are people who have solved this problem.
So Im using such code:
<?php if (!empty($product->customfieldsSorted['sale'])) { ?>
<div class="sale">
<?php
$custom_title = null ;
foreach ($product->customfieldsSorted['sale'] as $field){
if ($field->display) {
?>
<?php if ($field->custom_title != $custom_title) { ?>
<?php if ($field->custom_tip) echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png');
} ?>
<?php echo $field->display ?>
<?php
$custom_title = $field->custom_title;
}
} ?>
</div>
<?php } // Product Custom ontop end ?>
Virtuemart:2.0.6;Joomla:2.5.4.
Pleaese help!
Can you show the custom fields at all, or is it just that you want them in a specific order on the category page.
I have same problem I want to show the custom fields on the category page.
I read here that its possible only with custom coding. But nobody cant tell what coding I need.
But to make custom fields work easy just copy code from any product and replace $this-> like here http://forum.virtuemart.net/index.php?topic=100696.0
Eventually got around to figuring this out
foreach ($product->customfields as $field)
{
echo $field->custom_title;
echo $field->display;
} }
This thread really saved me a lot of headache. I was working on the same thing and this place solved my problem. Great job dude. thx
Quote from: stuart.prevos on September 06, 2012, 15:21:51 PM
Eventually got around to figuring this out
foreach ($product->customfields as $field)
{
echo $field->custom_title;
echo $field->display;
} }
I just wanted to say thank you for that very useful piece of code.
If you want to sort the custom fields by position, you just need to add this: if( $field->layout_pos=='myposition'), so it looks like this:
foreach ($product->customfields as $field){
if( $field->layout_pos=='showcat'){
echo "<strong>".$field->custom_title."</strong><br>";
echo $field->display."<br>";
}
}
Hope this might help a little bit.
Cheers!
Is there a better way we ask ourselves?? Please let us know! Milbo.