<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.0.9
  @date  20/05/10, 11:41
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
Class categories {

  var $leflux;


  function categories(){
    $this->title=CL_TITLE_FEEDS;
    $this->description=CL_DESC_FEEDS;
    $this->link=tep_href_link(FILENAME_DEFAULT);
    $this->leflux=array();
  }

  function feed(){

    global $page,$languages_id,$currencies;
	$categories_query = tep_db_query("select c.categories_id, cd.categories_name,cd.categories_description, c.categories_image , c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0'  and c.categories_status='1' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");
      while ($categories = tep_db_fetch_array($categories_query)) {

	$foo[$categories['categories_id']] = array(
						  'name' => $categories['categories_name'],
						  'parent' => $categories['parent_id'],
						  'level' => 0,
						  'path' => $categories['categories_id'],
						  'next_id' => false
						  );

	if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $categories['categories_id']; }

	$prev_id = $categories['categories_id'];

	if (!isset($first_element)) {
	  $first_element = $categories['categories_id'];
	}

      $list['title']=htmlspecialchars($categories['categories_name']) ;
      $list['link']=tep_href_link(FILENAME_DEFAULT, 'cPath=' . $categories['categories_id'], 'NONSSL') ;
      $list['image']=htmlspecialchars(tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], $page->_conf_value('SMALL_IMAGE_WIDTH'), $page->_conf_value('SMALL_IMAGE_HEIGHT')));
      $list['description']=htmlspecialchars($categories['categories_description']);

      $this->leflux[]=new objectInfo($list);
    }

    return $this->leflux;
  }

}
?>