Ejemplo n.º 1
0
echo search_tag(6, '', '彩色');
?>
">彩色</a>
                             </p>
                         </div>
                     </div>
                    
                <!--</div>-->
            </div>
            <div class="cell main_l">
			     <div class="main_l_box">
                     <div class="m_T8">
                         <?php 
$n = 1;
if (is_array(get_child_category(43))) {
    foreach (get_child_category(43) as $v) {
        ?>
                         <a href="<?php 
        echo $v['url'];
        ?>
"><h3><?php 
        echo $v['catname'];
        ?>
</h3></a>
                         <?php 
        $n++;
    }
}
unset($n);
?>
                     </div>
Ejemplo n.º 2
0
 function category_new_action()
 {
     $cmd = Url::get('cmd', 'add');
     $parent_id = Url::get('parent_id', 0);
     $id = Url::get('id');
     $cate_id = $id;
     $zone_id = trim(Url::get('zone_id', 0));
     if ($parent_id > 0) {
         $cate = DB::fetch("select * from products_category where id={$parent_id}");
         $zone_id = $cate['zone_id'];
     }
     if (Url::get('name', '') == '') {
         echo 0;
         exit;
     }
     if ($parent_id == 0) {
         $level = 1;
     } else {
         $sql = "select * from products_category where id='{$parent_id}'";
         $re = DB::fetch($sql);
         if ($re) {
             $level = $re['level'] + 1;
         }
     }
     $insert_arr = array('name' => trim(Url::get('name', '')), 'zone_id' => $zone_id, 'parent_id' => $parent_id, 'extra_fields_group' => Url::get('extra_fields_group', 0), 'published' => Url::get('published', 0), 'orders' => Url::get('orders', 0), 'level' => $level, 'description' => Url::get('description', ''));
     if ($cmd == 'add') {
         if ($insert_arr['orders'] == 0) {
             $orders = DB::fetch("select MAX(orders) as max from products_category where parent_id={$insert_arr['parent_id']} ");
             $insert_arr['orders'] = $orders['max'] + 1;
         }
         $id = DB::insert('products_category', $insert_arr);
     } elseif ($cmd == 'edit') {
         $re = DB::query("select zone_id from products_category where id={$id}");
         $row = mysql_fetch_array($re);
         $old_zone_id = $row['zone_id'];
         $child_ids = get_child_category($id);
         if ($id == $parent_id) {
             echo 0;
             exit;
         }
         if ($child_ids != '') {
             $child_ids_arr = explode(',', $child_ids);
             if (in_array($insert_arr['parent_id'], $child_ids_arr)) {
                 echo 0;
                 exit;
             }
             $id = DB::update('products_category', $insert_arr, "id={$id}");
             if ($old_zone_id != $insert_arr['zone_id']) {
                 if ($child_ids != '') {
                     DB::update('products_category', array('zone_id' => $insert_arr['zone_id']), "id in ({$child_ids} 0)");
                     DB::update('products_filter', array('zone_id' => $insert_arr['zone_id']), "cat_product_id in ({$child_ids} 0,{$cate_id} )");
                 }
             }
         } else {
             $id = DB::update('products_category', $insert_arr, "id={$id}");
             DB::update('products_filter', array('zone_id' => $insert_arr['zone_id']), "cat_product_id ={$cate_id}");
         }
     } else {
         echo 0;
         exit;
     }
     if ($id) {
         echo $id;
         if (!class_exists('eCate')) {
             require_once ROOT_PATH . 'core/eCate.php';
         }
         eCateElectronic::delCacheRelated($cate_id);
         if (MEMCACHE_ON) {
             eb_memcache::do_remove('categories_new');
         }
     } else {
         echo 0;
     }
 }