2013-08-28 83 views
0

我想獲得產品的拇指網址,我已將產品ID分配給$ pro_id。如何通過產品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

我有一個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;?>" /> 
相關問題