我想获取产品的拇指网址,我已将产品ID分配给$ pro_id。
JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$pro_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb('class="catImage" border="0"',false));
它给了我错误!
答案 0 :(得分:0)
我有一个virtmart 2.x搜索组件的情况,我正在开发和使用以下工作。
<?php
$pid= $item->virtuemart_product_id; // product id here
$sql="select i.file_url_thumb as image from #__virtuemart_medias as i,
#__virtuemart_product_medias as mi where
i.virtuemart_media_id = mi.virtuemart_media_id and
mi.virtuemart_product_id =".$pid." limit 0,1";
// Get a db connection.
$dbb = JFactory::getDbo();
$dbb->setQuery($sql);
$results = $dbb->loadObjectList();
?>
<img src="<?php echo JURI::root () . $results[0]->image; ?>" alt="<?php echo $item->order_item_name;?>" />