News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom Fields in Category View?

Started by ChristerE, March 25, 2012, 23:06:52 PM

Previous topic - Next topic

dcsupp

I've used this code and works perfect adding a little change for logged-in users !

<div>
<?php 
  
//MY EDIT STARTS HERE
 //make a database connection and find the field record that contains the customfield string
 $db JFactory::getDBO();
     
//please do check in php myadmin how your database table is called and replace it instead of "VM2_virtuemart_product_customfields" replace the "6" with your ID of Custom field you want to output
     
$db->setQuery("SELECT concat('TEXT',' ',custom_value) FROM #__virtuemart_product_customfields WHERE virtuemart_product_id=".$product->virtuemart_product_id." and virtuemart_custom_id=6 ;");  
     
$db->query();
     
$result $db->loadResult();

  $user JFactory::getUser();
$status $user->guest;
if (!$status == 1){
        echo 
"<div class=\"YOUR_CLASS_HERE\">".$result."</div>";
                 }
else
        {
        echo 
"<div></div>";
        }
 
 
?>

</div>


Can someone please tell me how can I make this work on the Product page ?
Thanks

Maxim Pishnyak

Custom fields already show on product page unless you use template overrides.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart