Virtuemart Media Dateien / Artikel Content / Category Name / Category Childs auslesen

Gepostet am Dezember 22, 2012

Durch folgende Abfragen können die im VirtualMart oder direkt aus dem Jommla Template bestimmte Informationen auslesen. Das auslesen erfolgt direkt über die Datenbank.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function getChildrenList($category_id) {
	$db = JFactory::getDBO();
	$q = "SELECT category_child_id 
		FROM #__virtuemart_category_categories
		WHERE category_parent_id = ".$category_id;
	$db->setQuery($q);
	$childs = $db->loadObjectList();
	$childList = array();
	foreach ($childs as $ckey => $child) {
	    $childList[] = $child->category_child_id;
	}
    return $childList;
}
 
function getCategoryName($category_id) {
	$db = JFactory::getDBO();
	$q = "SELECT category_name 
		FROM #__virtuemart_categories_de_de
		WHERE virtuemart_category_id = ".$category_id;
	$db->setQuery($q);
	return $db->loadResult();
}
 
function getArticleContents($article_id) {
    $db =& JFactory::getDBO();
    $sql = "SELECT introtext FROM #__content WHERE id = ".intval($article_id);
    $db->setQuery($sql);
    return $db->loadResult();
}
 
function getVmMediaFile($virtuemart_media_id, $getthumb = false) {
    $db =& JFactory::getDBO();
    if ($getthumb) $sql = "SELECT file_url_thumb FROM #__virtuemart_medias WHERE virtuemart_media_id = ".intval($virtuemart_media_id);
	else $sql = "SELECT file_url FROM #__virtuemart_medias WHERE virtuemart_media_id = ".intval($virtuemart_media_id);
    $db->setQuery($sql);
    return $db->loadResult();
}

Mediadaten einer Kategorie auslesen:

1
2
3
4
<?php foreach($category->virtuemart_media_id as $virtuemart_media_id): ?>
<img src="<?php echo getVmMediaFile($virtuemart_media_id); //normal ?>" alt="" />
<img src="<?php echo getVmMediaFile($virtuemart_media_id,true); //thumb ?>" alt="" />
<?php endforeach; ?>

Tags: ,

Leave a Reply

 

Posts of Current Category



Facebook: