if (isset($_GET['id'])) { echo $temp['description']; } ?> </textarea> </div> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="col-md-12 reset-margin-padding">Chọn danh mục sản phẩm:</label> <div class="col-md-12 grey-back"> <table class="align-col"> <?php //$temp_cat = $cat_obj->getAllCat(); $cat_obj = new category_product(); $temp_cat = $cat_obj->getAllCat('position'); echo buildCatDeQuy($temp_cat, 0); ?> </table> </div> </div> </div> </div> </div> </div> </div> </div> <div id="tab2" class="tab-pane fade"> <div class="row"> <div class="col-md-12 pd-top">
//include("models/Product.php"); $config = array('current_page' => isset($_GET['page']) ? $_GET['page'] : 1, 'total_record' => count($product->getProductByCatId($_GET["c_id"])), 'limit' => 6, 'link_full' => "index.php?view=product-cat&c_id={$_GET['c_id']}&page={page}", 'link_first' => "index.php?view=product-cat&c_id={$_GET['c_id']}", 'range' => 9); $start = ($config['current_page'] - 1) * $config['limit']; if ($_GET["c_id"]) { $temp = $product->getProductOfCat($_GET["c_id"], "pro_id", array($start, $config['limit'])); } //echo "<pre>"; // print_r($temp); //echo "</pre>"; ?> <div class="sp-moi"> <?php $catpro_obj = new category_product(); $catpro = $catpro_obj->getCatById($_GET['c_id']); ?> <div class="spm"> <h3><?php echo $catpro['cat_name']; ?> </h3> </div> <div class="list-spm"> <?php foreach ($temp as $val) { ?>
protected function beforeDelete() { $this->seo->delete(); category_product::model()->deleteAllByAttributes(array('product_ID' => $this->product_ID)); if ($this->hasEventHandler('onBeforeDelete')) { $event = new CModelEvent($this); $this->onBeforeDelete($event); return $event->isValid; } else { return true; } }
<?php require_once '../models/class-cat-product.php'; $cat_obj = new category_product(); if (isset($_GET['id'])) { $temp = $cat_obj->getCatById($_GET['id']); } ?> <div class="panel panel-danger"> <div class="panel-heading"> <h3 class="panel-title"> <i class="livicon" data-name="bell" data-loop="true" data-color="#fff" data-hovercolor="#fff" data-size="18"></i> <?php if (isset($_GET['act'])) { echo $_GET['act'] == 'update' ? 'Sửa' : 'Thêm'; } else { echo "Thêm"; } ?> danh mục </h3> <span class="pull-right"> <i class="fa fa-fw fa-chevron-up clickable"></i> <i class="fa fa-fw fa-times removepanel clickable"></i> </span> </div> <div class="panel-body border"> <form action="control/proccess-cat-product.php" method="post" class="form-horizontal form-bordered"> <div class="form-group"> <label class="col-md-3 control-label" for="example-text-input">Tên danh mục</label> <div class="col-md-6">
public function actionUpdate() { $this->htmlOption = array('class' => 'icon-head head-products', 'header' => "编辑商品", 'button' => array(array('class' => 'scalable save', 'id' => 'form-save', 'header' => '保存'))); $product = $this->loadModel(); $image = new image_entity(); $image->image_product_ID = $product->product_ID; $discount = new discount_quantity(); $discount->product_ID = $product->product_ID; if (isset($_POST['product'])) { $product->attributes = $_POST['product']; $product->product_reducetion_from = $_POST['product']['product_reducetion_from']; $product->product_reducetion_to = $_POST['product']['product_reducetion_to']; $product->seo->attributes = $_POST['seo']; $product->validate(); $product->product_def_category_ID = category_entity::resolveDefCategory($_POST['product']['product_category_ID']); if ($product->seo->validate()) { $product->seo->save(); if ($product->save()) { //process image stuffer if ($_POST['image']) { foreach ($_POST['image'] as $key => $row) { $imageModel = image_entity::model()->findByPk($key); $imageModel->image_legend = $row['legend']; $imageModel->image_position = $row['position']; $imageModel->update(); } } category_product::productAlert($product->product_ID, $_POST['product']['product_category_ID']); $this->redirect(array('index')); } } $tree = $this->constructCategoryTree($_POST['product']['product_category_ID']); } if (!isset($tree)) { $tree = $this->constructCategoryTree(category_product::getCategoryIDS($product->product_ID)); } if (!isset($_POST['product']['product_status'])) { $status = product_entity::resovelProductStatus($product->product_status); } else { $status = $_POST['product']['product_status']; } $this->constructScript('update'); $this->sideView = 'sidebar/update'; $this->layout = 'column2'; $this->render('update', array('model' => $product, 'tree' => $tree, 'image' => $image, 'status' => $status, 'discount' => $discount)); }
<?php require_once '../models/class-cat-product.php'; $cat_obj = new category_product(); $sort = ''; if (isset($_GET['sort'])) { $sort = $_GET['sort']; } switch ($sort) { case 'cat': $a = $cat_obj->getAllCat('cat_name'); break; case 'position': $a = $cat_obj->getAllCat('position'); break; default: $a = $cat_obj->getAllCat(); } ?> <table class="table table-bordered table-striped table-condensed flip-content"> <thead class="flip-content"> <tr> <th><a href="index.php?view=list-cat-product&sort=cat">Category Name</a></th> <th width="10%" class="numeric"><a href="index.php?view=list-cat-product&sort=position">Thứ tự</a></th> <th width="5%" class="numeric">Sửa</th> <th width="5%" class="numeric">Xóa</th> </tr> </thead> <tbody> <?php echo listCatTable($a);
header("Location: ../index.php?view=list-cat-product&stt=success"); } else { header("Location: ../index.php?view=list-cat-product&stt=fail"); } } break; case "xoa": $id = $_POST['id']; $cat_obj = new category_product(); if ($cat_obj->delCat($id)) { header("Location: ../index.php?view=list-cat-product&stt=success"); } else { header("Location: ../index.php?view=list-cat-product&stt=fail"); } break; default: if (isset($_POST['cat_name']) && isset($_POST['position']) && isset($_POST['parent_id'])) { $cat_obj = new category_product(); $cat = $_POST['cat_name']; $position = $_POST['position']; $parent_id = $_POST['parent_id']; $home = isset($_POST['home']) ? $_POST['home'] : ''; if ($cat_obj->insertCat($cat, $parent_id, $position, $home)) { header("Location: ../index.php?view=form-cat-product&stt=success"); } else { header("Location: ../index.php?view=form-cat-product&stt=fail"); } } break; } }
require_once "models/config.php"; require_once "models/function.php"; require_once "models/class.php"; require_once "models/class-cat-product.php"; ?> <div id="col-left"> <div id="list-cat"> <div class="header"> Danh mục </div> <div class="list"> <?php $catsp_obj = new category_product(); $kien = $catsp_obj->getCatByHome(); foreach ($kien as $val) { ?> <ul> <li><a href="index.php?view=product-cat&c_id=<?php echo $val["cat_id"]; ?> "><?php echo $val['cat_name']; ?> </a></li> </ul> <?php } ?>