public function loadModel() { if ($this->_model == null) { if (isset($_GET['category'])) { $this->_model = category_entity::model()->findByAttributes(array('category_SEF' => $_GET['category'])); } if ($this->_model == null) { throw new CHttpException(404, "The requested page does not exist!"); } } return $this->_model; }
public function constructCategoryTree($checked_IDS = null) { $roots = category_entity::rootCategory(); foreach ($roots as $row) { $tree[] = $this->PackageTree($row, $checked_IDS); } return $tree; }
<div id="navigate"> <a href="/" class="n_home">Home</a> - <span>All Categories</span> <span class="n_icol"></span> <span class="n_icor"></span> </div> <div class="content_box mb_12 all_categories"> <div class="pop_box" style="padding:12px;"> <h1>All Categories</h1> <?php foreach ($roots as $row) { echo "<h2><a href='/{$row['category_SEF']}'>{$row['category_name']}</a></h2> <ul class='nav1'>"; foreach (category_entity::getChirdren($row['category_ID']) as $item) { echo "<li><a href='/{$item['category_SEF']}'>{$item['category_name']}</a></li>"; } echo " </ul><div class='fix'></div>"; } ?> </div> </div> <div class="content_box mb_12 prduct_list" id="popular"> <h2><a href="#popular" class="i_d_sel">Popular Products</a></h2> <?php /* $pop=product_entity::model()->popular()->findAll(); $count=count($pop); foreach($pop as $key=>$row) {
<ul> <?php $roots = category_entity::rootCategory(); if (!isset($this->acc_active)) { $active_index = 0; } else { $active_index = $this->acc_active; } $i = 0; foreach ($roots as $value) { if ($i == $active_index) { $active = "sc_currall"; } else { $active = null; } $children = category_entity::getChirdren($value['category_ID']); echo "<li><h3 class='{$active}'><a href='/{$value['category_SEF']}'>{$value['category_name']}</a></h3>"; echo "<ul style='display:block;'>"; foreach ($children as $item) { echo "<li><a href='/{$item['category_SEF']}'>{$item['category_name']}</a></li>"; } echo "</ul></li>"; $i++; } ?> </ul> </div> <div class="fix"></div> </div>
?> </div> <div id="footer"> <div class="footer_link"> <a href="/help/about" rel="nofollow">About Us</a> <a href="/help/shipping" rel="nofollow">Shipping & Tracking</a> <a href="/help/return" rel="nofollow">Return & Exchanges</a> <a href="/help/privacy" rel="nofollow">Privacy Policy</a> <a href="/help/terms" rel="nofollow">Terms & Conditions</a> <a href="/help/contact" rel="nofollow">Contact Us</a> <a href="/sitemap.xml" rel="nofollow">Sitemap</a> <a href="#page_top" class="back_top" rel="nofollow">TOP</a> </div> <?php foreach (category_entity::getChirdren(1) as $row) { $cate .= "<li><a href='/{$row['category_SEF']}'>{$row['category_name']}</a></li>"; } ?> <ul class="nav4"> <?php echo $cate; ?> </ul> <div class="fix"></div> <div class="footer_copyr"> © 2000-2010 Cardsnds Inc. All rights reserved. </div> </div> <!--/footer --> <img src="/images/f_secure_img.jpg" alt="" /> </div>
<div id="productGrid"> <?php $this->widget('TradeGrid', array('dataProvider' => $model->search(), 'filter' => $model, 'htmlOptions' => array('class' => 'hor-scroll'), 'columns' => array(array('header' => '编号', 'name' => 'product_ID', 'type' => 'raw'), array('header' => '名称', 'name' => 'product_name', 'type' => 'raw'), array('header' => '默认分类', 'name' => 'product_def_category_ID', 'value' => '$data->defCategory->category_name', 'filter' => category_entity::categoryOptionData(), 'type' => 'raw'), array('header' => 'SKU', 'name' => 'product_SKU', 'type' => 'raw'), array('header' => '零售价', 'name' => 'product_price', 'type' => 'raw'), array('header' => '库存', 'name' => 'product_quantity', 'type' => 'raw'), array('header' => '状态', 'name' => 'product_status', 'type' => 'raw'), array('class' => 'CButtonColumn', 'template' => '{update} {delete}')))); ?> </div>