Skip to content

Commit

Permalink
Fixes #38, fixing the virtuemart plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderson Grudtner Martins committed Mar 19, 2015
1 parent 42b9503 commit f9c5040
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/extensions/plg_xmap_com_virtuemart/com_virtuemart.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,27 +145,32 @@ public static function getCategoryTree($xmap, $parent, &$params, $catid = 0)
}

$vendorId = 1;
$cache = JFactory::getCache('com_virtuemart','callback');

$children = $cache->call(array('VirtueMartModelCategory', 'getChildCategoryList'), $vendorId, $catid);
$m = VirtueMartModelCategory::getInstance('Category', 'VirtueMartModel');

$xmap->changeLevel(1);
$cache = JFactory::getCache('com_virtuemart', 'callback');
$cache->setCaching(true);
$children = $cache->call(array($m, 'getChildCategoryList'), $vendorId, $catid);

foreach ($children as $row) {
$node = new stdclass;
if (!empty($children)) {
$xmap->changeLevel(1);

$node->id = $parent->id;
$node->uid = $parent->uid . 'c' . $row->virtuemart_category_id;
$node->browserNav = $parent->browserNav;
$node->name = stripslashes($row->category_name);
$node->priority = $params['cat_priority'];
$node->changefreq = $params['cat_changefreq'];
$node->expandible = true;
$node->link = 'index.php?option=com_virtuemart&view=category&virtuemart_category_id='
. $row->virtuemart_category_id . '&Itemid='.$parent->id;
foreach ($children as $row) {
$node = new stdclass;

if ($xmap->printNode($node) !== FALSE) {
self::getCategoryTree($xmap, $parent, $params, $row->virtuemart_category_id);
$node->id = $parent->id;
$node->uid = $parent->uid . 'c' . $row->virtuemart_category_id;
$node->browserNav = $parent->browserNav;
$node->name = stripslashes($row->category_name);
$node->priority = $params['cat_priority'];
$node->changefreq = $params['cat_changefreq'];
$node->expandible = true;
$node->link = 'index.php?option=com_virtuemart&view=category&virtuemart_category_id='
. $row->virtuemart_category_id . '&Itemid='.$parent->id;

if ($xmap->printNode($node) !== FALSE) {
self::getCategoryTree($xmap, $parent, $params, $row->virtuemart_category_id);
}
}
}

Expand Down

0 comments on commit f9c5040

Please sign in to comment.