veselov.sumy.ua > PHP, > ShopOS

ShopOS


07.06.11.
    ShopOS

:
http://www.getinfo.ru/article610.html - !
http://phpclub.ru/detail/article/db_tree

, ShopOS. , ( ), , . .

:
    ShopOS

. . , . , .

( index.html ):

    {php}
    $sql = "SELECT cat.categories_id, cd.categories_name FROM vip_categories cat, vip_categories_description cd WHERE cat.categories_status = '1' AND cd.categories_id = cat.categories_id";
    $sql = osDBquery($sql);
    while ($row = os_db_fetch_array($sql)) {
    $menu[$row['categories_id']] = $row['categories_name'];
    }
    foreach ($menu as $CatId => $CatName )
    {
    echo "
  • ".$CatName."";
    echo "
      ";
      $query = "SELECT * FROM
      vip_products p,
      vip_products_description pd,
      vip_products_to_categories p2c,
      vip_categories c
      WHERE
      c.categories_status='1'
      and p.products_status = '1'
      and p.products_id = p2c.products_id
      and p.products_id=pd.products_id
      and p2c.categories_id = '".$CatId."'
      and c.categories_id = '".$CatId."'
      ORDER by p.products_date_added";
      $query = osDBquery($query);
      while ($row1 = os_db_fetch_array($query)) {
      echo "
    • ".$row1['products_name']."
    • ";
      }
      echo "
  • ";
    }
    {/php}


:


, !
    ShopOS

! .

( index.html ):

    {php}
    $sql = "SELECT cat.categories_id, cat.parent_id, cat.categories_url, cd.categories_name FROM vip_categories cat, vip_categories_description cd WHERE cat.categories_status = '1' AND cd.categories_id = cat.categories_id ORDER BY cat.parent_id, cat.categories_id";
    $sql = osDBquery($sql);
    while ($row = os_db_fetch_array($sql)) {
    $menu[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
    }
    foreach ($menu[0] as $CatId => $CatName )
    {
    echo "
  • ".$CatName."";
    if (isset($menu[$CatId])) {
    echo "
      ";
      foreach ($menu[$CatId] as $ItemId => $ItemName)
      {
      echo "
    • ".$ItemName."";
      echo "
        ";
        $query = "SELECT * FROM
        vip_products p,
        vip_products_description pd,
        vip_products_to_categories p2c,
        vip_categories c
        WHERE
        c.categories_status='1'
        and p.products_status = '1'
        and p.products_id = p2c.products_id
        and p.products_id=pd.products_id
        and p2c.categories_id = '".$ItemId."'
        and c.parent_id = '".$CatId."'
        ORDER by p.products_date_added";
        $query = osDBquery($query);
        while ($row1 = os_db_fetch_array($query)) {
        echo "
      • ".$row1['products_name']."
      • ";
        }
        echo "
      ";
      echo "
    • ";
      }
      echo "
  • ";
    } else { echo "";}
    }
    {/php}


:



- ( index.html ):


    {php}
    $sql = "SELECT cat.categories_id, cat.parent_id, cat.categories_url, cd.categories_name FROM vip_categories cat, vip_categories_description cd WHERE cat.categories_status = '1' AND cd.categories_id = cat.categories_id ORDER BY cat.parent_id, cat.categories_id";
    $sql = osDBquery($sql);
    while ($row = os_db_fetch_array($sql)) {
    $menu[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
    }
    foreach ($menu[0] as $CatId => $CatName )
    {
    echo "
  • ".$CatName."";
    if (isset($menu[$CatId])) {
    echo "
      ";
      foreach ($menu[$CatId] as $ItemId => $ItemName)
      {
      echo "
    • ".$ItemName."";
      echo "
        ";
        $query = "SELECT * FROM
        vip_products p,
        vip_products_description pd,
        vip_products_to_categories p2c,
        vip_categories c
        WHERE
        c.categories_status='1'
        and p.products_status = '1'
        and p.products_id = p2c.products_id
        and p.products_id=pd.products_id
        and p2c.categories_id = '".$ItemId."'
        and c.parent_id = '".$CatId."'
        ORDER by p.products_date_added";
        $query = osDBquery($query);
        while ($row1 = os_db_fetch_array($query)) {
        //echo "
        ";
        //print_r($row1);
        //echo "
        ";
        echo "
      • ".$row1['products_name']."
      • ";
        }
        echo "
      ";
      echo "
    • ";
      }
      echo "
  • ";
    } else { echo "";}
    }
    {/php}


:

, . , ( UL), .

, . {$box_CATEGORIES}.

_\themes\_\source\inc\show_category.inc.php. $MaxLevel 1, , 1 .
:
if ($old_level > $level) {

:
if ( isset($GLOBALS['cPath']) ) {
if ( !strpos($GLOBALS['cPath'], "_")===false ) {
$path = explode('_',$GLOBALS['cPath']);
$query = "SELECT * FROM
vip_products p,
vip_products_description pd,
vip_products_to_categories p2c,
vip_categories c
WHERE
c.categories_status='1'
and p.products_status = '1'
and p.products_id = p2c.products_id
and p.products_id=pd.products_id
and p2c.categories_id = '".$path[1]."'
and c.parent_id = '".$path[0]."'
ORDER by p.products_date_added";
$query = osDBquery($query);
$categories_string .= "";
}
}

: cPath ( ), , , . - .
    ShopOS

, . -) .

UPD 02.09.11. + .
show_category.inc.php ( $foo[$cid]['name'].$ProductsCount. ''; - 114 )
if ($level == 3) {
if ( !empty($Aktiv)) {
//$categories_string .= $cid;
$query = "SELECT * FROM
vip_products_to_categories p2c,
vip_products p,
vip_products_description pd
WHERE
p2c.categories_id = '".$cid."'
and p.products_status = '1'
and p.products_id = p2c.products_id
and p.products_id=pd.products_id
ORDER by p.products_date_added";
$query = osDBquery($query);
$categories_string .= "
    ";
    while ($row1 = os_db_fetch_array($query)) {
    $categories_string .= "
  • [url=/product_info.php?products_id={$row1[]".$row1['products_name']."[/url]";
    }
    $categories_string .= "
";
}
}