Exemplo n.º 1
0
 /** Virtuemart support */
 static function getCategoryTree($xmap, $parent, &$params, $catid = 0)
 {
     $database = JFactory::getDBO();
     if (!isset($urlBase)) {
         $urlBase = JURI::base();
     }
     $vendorId = 1;
     $cache = JFactory::getCache('com_virtuemart', 'callback');
     $children = $cache->call(array('VirtueMartModelCategory', 'getChildCategoryList'), $vendorId, $catid);
     $xmap->changeLevel(1);
     foreach ($children as $row) {
         $node = new stdclass();
         $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) {
             xmap_com_virtuemart::getCategoryTree($xmap, $parent, $params, $row->virtuemart_category_id);
         }
     }
     $xmap->changeLevel(-1);
     if ($params['include_products'] && $catid != 0) {
         $products = self::$productModel->getProductsInCategory($catid);
         if ($params['include_product_images']) {
             self::$categoryModel->addImages($products, 1);
         }
         $xmap->changeLevel(1);
         foreach ($products as $row) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'c' . $row->virtuemart_category_id . 'p' . $row->virtuemart_product_id;
             $node->browserNav = $parent->browserNav;
             $node->priority = $params['prod_priority'];
             $node->changefreq = $params['prod_changefreq'];
             $node->name = $row->product_name;
             $node->modified = strtotime($row->modified_on);
             $node->expandible = false;
             $node->link = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $row->virtuemart_product_id . '&virtuemart_category_id=' . $row->virtuemart_category_id . '&Itemid=' . $parent->id;
             if ($params['include_product_images']) {
                 foreach ($row->images as $image) {
                     if (isset($image->file_url)) {
                         $imagenode = new stdClass();
                         $imagenode->src = $urlBase . $image->file_url_thumb;
                         $imagenode->title = $row->product_name;
                         $imagenode->license = $params['product_image_license_url'];
                         $node->images[] = $imagenode;
                     }
                 }
             }
             $xmap->printNode($node);
         }
         $xmap->changeLevel(-1);
     }
 }
 /** Virtuemart support */
 function &getCategoryTree(&$xmap, &$parent, &$params, $catid = 0)
 {
     $database =& JFactory::getDBO();
     $mosConfig_absolute_path = JPATH_SITE;
     $query = "SELECT a.category_id, a.category_name, a.mdate,a.category_flypage " . "\n FROM #__vm_category AS a, #__vm_category_xref AS b " . "\n WHERE a.category_publish='Y' " . "\n AND b.category_parent_id = {$catid} " . "\n AND a.category_id=b.category_child_id " . "\n ORDER BY a.list_order ASC, a.category_name ASC";
     $database->setQuery($query);
     $rows = $database->loadObjectList();
     $xmap->changeLevel(1);
     foreach ($rows as $row) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->uid = $parent->uid . 'c' . $row->category_id;
         $node->browserNav = $parent->browserNav;
         $node->name = stripslashes($row->category_name);
         $node->modified = intval($row->mdate);
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->expandible = true;
         $node->link = $parent->link . '&page=shop.browse&category_id=' . $row->category_id . '&Itemid=' . $params['Itemid'];
         if ($xmap->printNode($node) !== FALSE) {
             xmap_com_virtuemart::getCategoryTree($xmap, $parent, $params, $row->category_id);
         }
     }
     $xmap->changeLevel(-1);
     if ($params['include_products']) {
         $query = "SELECT a.product_id, a.product_name,a.mdate, b.category_id,d.category_flypage " . "\n FROM #__vm_product AS a, #__vm_product_category_xref AS b, #__vm_category d" . "\n WHERE a.product_publish='Y'" . "\n AND b.category_id={$catid} " . "\n AND a.product_parent_id=0 " . "\n AND a.product_id=b.product_id " . "\n AND b.category_id=d.category_id " . "\n ORDER BY a.product_name";
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         $xmap->changeLevel(1);
         foreach ($rows as $row) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'c' . $row->category_id . 'p' . $row->product_id;
             $node->browserNav = $parent->browserNav;
             $node->priority = $params['prod_priority'];
             $node->changefreq = $params['prod_changefreq'];
             $node->name = $row->product_name;
             $node->modified = intval($row->mdate);
             $node->expandible = false;
             $node->link = 'index.php?option=com_virtuemart&page=shop.product_details&flypage=' . ($row->category_flypage ? $row->category_flypage : FLYPAGE) . '&category_id=' . $row->category_id . '&product_id=' . $row->product_id . '&Itemid=' . $params['Itemid'];
             $xmap->printNode($node);
         }
         $xmap->changeLevel(-1);
     }
     return $list;
 }
Exemplo n.º 3
0
 /** Virtuemart support */
 function &getCategoryTree(&$xmap, &$parent, &$params, $catid = 0)
 {
     $database =& JFactory::getDBO();
     global $sess;
     static $urlBase;
     if (!isset($urlBase)) {
         $urlBase = JURI::base();
     }
     $query = "SELECT a.category_id, a.category_name, a.mdate,a.category_flypage " . "\n FROM #__vm_category AS a, #__vm_category_xref AS b " . "\n WHERE a.category_publish='Y' " . "\n AND b.category_parent_id = {$catid} " . "\n AND a.category_id=b.category_child_id " . "\n ORDER BY a.list_order ASC, a.category_name ASC";
     $database->setQuery($query);
     $rows = $database->loadObjectList();
     $xmap->changeLevel(1);
     foreach ($rows as $row) {
         $node = new stdclass();
         $node->id = $params['Itemid'];
         $node->uid = $parent->uid . 'c' . $row->category_id;
         $node->browserNav = $parent->browserNav;
         $node->name = stripslashes($row->category_name);
         $node->modified = intval($row->mdate);
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->expandible = true;
         //$node->link = $parent->link.'&page=shop.browse&category_id='.$row->category_id.'&Itemid='.$params['Itemid'];
         $node->link = $sess->url("index.php?page=shop.browse&category_id=" . $row->category_id);
         if ($xmap->printNode($node) !== FALSE) {
             xmap_com_virtuemart::getCategoryTree($xmap, $parent, $params, $row->category_id);
         }
     }
     $xmap->changeLevel(-1);
     if ($params['include_products']) {
         $query = "SELECT a.product_id, a.product_name,a.mdate, a.product_thumb_image, a.product_full_image, b.category_id,d.category_flypage " . "\n FROM #__vm_product AS a, #__vm_product_category_xref AS b, #__vm_category d" . "\n WHERE a.product_publish='Y'" . "\n AND b.category_id={$catid} " . "\n AND a.product_parent_id=0 " . "\n AND a.product_id=b.product_id " . "\n AND b.category_id=d.category_id " . "\n ORDER BY a.product_name";
         $database->setQuery($query);
         $rows = $database->loadObjectList();
         $xmap->changeLevel(1);
         foreach ($rows as $row) {
             $node = new stdclass();
             $node->id = $params['Itemid'];
             $node->uid = $parent->uid . 'c' . $row->category_id . 'p' . $row->product_id;
             $node->browserNav = $parent->browserNav;
             $node->priority = $params['prod_priority'];
             $node->changefreq = $params['prod_changefreq'];
             $node->name = $row->product_name;
             $node->modified = intval($row->mdate);
             $node->expandible = false;
             $node->link = $sess->url("index.php?page=shop.product_details&flypage=" . ($row->category_flypage ? $row->category_flypage : FLYPAGE) . "&category_id=" . $row->category_id . '&product_id=' . $row->product_id);
             //$node->link = 'index.php?option=com_virtuemart&page=shop.product_details&flypage='.($row->category_flypage? $row->category_flypage : FLYPAGE).'&category_id='.$row->category_id . '&product_id=' . $row->product_id. '&Itemid='.$params['Itemid'];
             if ($params['include_product_images']) {
                 // Include the standard product image
                 if (isset($row->product_full_image) && $row->product_full_image != "") {
                     $image = new stdClass();
                     $image->src = $urlBase . "components/com_virtuemart/shop_image/product/" . $row->product_full_image;
                     $image->title = $row->product_name;
                     $image->license = $params['product_image_license_url'];
                     $node->images[] = $image;
                 }
                 // Include additional product images
                 $query = " SELECT file_name FROM #__vm_product_files WHERE file_product_id = ";
                 $query .= $row->product_id;
                 $database->setQuery($query);
                 $additional_images = $database->loadObjectList();
                 foreach ($additional_images as $additional_image) {
                     $image = new stdClass();
                     $image->src = $urlBase . $additional_image->file_name;
                     $image->title = $row->product_name;
                     $node->images[] = $image;
                 }
             }
             $xmap->printNode($node);
         }
         $xmap->changeLevel(-1);
     }
     return $list;
 }