public function index() { if (empty($_GET['seo_url'])) { $this->notFound(); return; } $productDAO = new ProductDAO(DataSource::getInstance()); $product = $productDAO->findBySeoUrl($_GET['seo_url']); if (!$product) { $this->notFound(); return; } $categoryDAO = new CatDAO(DataSource::getInstance()); $brandDAO = new BrandDAO(DataSource::getInstance()); $cat_id = $product['category_id']; $brand_id = $product['brand_id']; $categories_list = $categoryDAO->findByAll_Navigation(); $brands_list = $brandDAO->findByAll(); $products_list_in_cat = $productDAO->findByCatId($cat_id); $products_list_in_brand = $productDAO->findByBrandId($brand_id); $promoDAO = new PromoDAO(DataSource::getInstance()); $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl(); $this->registry->template->cart = getCart(); $this->registry->template->categories_list = $categories_list; $this->registry->template->brands_list = $brands_list; $this->registry->template->current_cat_id = $cat_id; $this->registry->template->current_brand_id = $brand_id; $this->registry->template->products_list_in_cat = $products_list_in_cat; $this->registry->template->products_list_in_brand = $products_list_in_brand; $this->registry->template->product = $product; $this->registry->template->product_pics = explode_pics($product['pics']); $this->registry->template->tile_title = $categories_list[$cat_id]['name'] . ' / ' . $brands_list[$brand_id] . ' / ' . $product['code']; $this->registry->template->facebook_description = $product['description']; $this->registry->template->facebook_image = __SITE_CONTEXT . __UPLOAD_DIR . get_pic_at($product['pics'], 1); $this->registry->template->body_class = 'product-template'; $this->registry->template->tile_content = 'product.php'; $this->registry->template->tile_footer = 'footer.php'; $this->registry->template->show('layout/user.php'); }
public function findByInfo_Manage($info) { $s = ' WHERE 1 = 1 '; if (isset($info['code'])) { $s .= " AND P.code = '" . $this->ds->escape($info['code']) . "'"; } if (isset($info['category_id'])) { if ((int) $info['category_id'] == 0) { $s .= ' AND P.category_id IS NULL '; } else { $s .= ' AND P.category_id = ' . $info['category_id']; } } if (isset($info['brand_id'])) { if ((int) $info['brand_id'] == 0) { $s .= ' AND P.brand_id IS NULL '; } else { $s .= ' AND P.brand_id = ' . $info['brand_id']; } } $sql = "SELECT P.id, P.code, P.price_fonds, P.price_sell, P.pics, " . "(" . "SELECT " . "(SELECT IFNULL(SUM(IBI.amount), 0) FROM import_bill_items AS IBI WHERE IBI.product_id=P.id) - " . "(SELECT IFNULL(SUM(EBI.amount), 0) FROM export_bill_items AS EBI WHERE EBI.product_id=P.id) " . ") AS my_sum, " . "(SELECT C.name FROM categories AS C WHERE C.id = P.category_id) AS category_name, " . "(SELECT B.name FROM brands AS B WHERE B.id = P.brand_id) AS brand_name " . "FROM products AS P " . $s . " ORDER BY P.code"; $rs = $this->ds->execute($sql); $list_prod = array(); while ($row = mysql_fetch_array($rs)) { $list_prod[$row['id']] = array('code' => htmlspecialchars($row['code']), 'price_fonds' => $row['price_fonds'], 'price_sell' => $row['price_sell'], 'pic' => get_pic_at($row['pics'], 0), 'my_sum' => $row['my_sum'], 'category_name' => htmlspecialchars($row['category_name']), 'brand_name' => htmlspecialchars($row['brand_name'])); } mysql_free_result($rs); return $list_prod; }
Các sản phẩm sẽ được sắp xếp theo thứ tự từ trái qua phải, từ trên xuống dưới.</p> <ul id="sortable_grid"> <?php foreach ($list_prod as $key => $value) { ?> <li class="ui-state-default" prod_id="<?php echo $key; ?> "> <img title="<?php echo $value['code']; ?> " width="100" height="100" src="<?php echo __SITE_CONTEXT . __UPLOAD_DIR; echo get_pic_at($value['pics'], 0); ?> " alt="<?php echo $product_title; ?> " /> </li> <?php } ?> </ul> <div style="clear:both;padding:30px;text-align:center"> <input type="button" value="Lưu lại" style="font-size:20px" onclick="save_lick()" /> </div>