当前位置: 首页>>代码示例>>PHP>>正文


PHP ProductCategory::bll方法代码示例

本文整理汇总了PHP中ProductCategory::bll方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductCategory::bll方法的具体用法?PHP ProductCategory::bll怎么用?PHP ProductCategory::bll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProductCategory的用法示例。


在下文中一共展示了ProductCategory::bll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_index

 public function action_index($category_slug = '')
 {
     if ($category_slug != '') {
         $category = ProductCategory::bll()->findOneBy('slug', $category_slug);
         if (!$category) {
             //category not found
         }
         $this->template->title = __($category['name'] . " | Sản phẩm |");
         $total_items = ProductItem::bll()->getItemsCountByCat_Front_Listing($category['id']);
         $pagging = Pagination::factory(array('total_items' => $total_items, 'items_per_page' => 12));
         $items = ProductItem::bll()->getItemsByCat_Front_Listing($category['id'], $pagging->offset, $pagging->items_per_page);
     }
     $data['category'] = $category;
     $data['items'] = $items;
     $data['page_link'] = $pagging->render();
     $this->template->content = View::factory('/front/product/item/list', $data);
 }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:17,代码来源:productcategory.php

示例2: action_edit

 public function action_edit($product_id = 0)
 {
     $data = array();
     $item = ProductItem::bll()->find($product_id);
     if (!$item) {
         Message::error('Sản phẩm yêu cầu không tồn tại!');
         Request::instance()->redirect('/admin/product/index');
     }
     $category = $item->Category;
     if (!$category) {
         Request::instance()->redirect('/admin/product/index');
     }
     $data['item'] = $item->toArray();
     $data['category'] = $category;
     if (Request::$method == "POST") {
         //$item = new ProductItem();
         $post = $item->validate_update($_POST);
         if ($post->check()) {
             $post = $post->as_array();
             //die(print_r($post));
             $item->cat_id = $post['cat_id'];
             $item->name = $post['name'];
             $item->slug = $post['slug'];
             $item->summary = $post['summary'];
             $item->description = $post['description'];
             $item->meta_desc = $post['meta_desc'];
             $item->meta_keys = $post['meta_keys'];
             $item->price = $post['price'];
             $item->thumb_image = $post['thumb_image'];
             $item->full_image = $post['full_image'];
             $item->product_in_stock = $post['product_in_stock'];
             $item->product_order = $post['product_order'];
             $item->special = $post['special'];
             $item->publish = $post['publish'];
             $item->is_new = $post['is_new'];
             $item->product_sku = $post['product_sku'];
             //$item->user_id = Auth::instance()->get_user()->id;
             //$item->views = 0;
             $item->save();
             Message::success("Cập nhật thông tin sản phẩm thành công!");
             Request::instance()->redirect('/admin/product/by_cat/' . $item->cat_id);
         } else {
             $data['errors'] = $post->errors();
             $_POST = $post->as_array();
         }
     }
     //build category list
     $q = ProductCategory::bll()->createQuery();
     $q->addOrderBy('root_id asc')->addOrderBy('lft asc');
     //echo $q->getSqlQuery();
     $objects = $q->execute();
     ///$trees[0] = ' --- ROOT ---';
     foreach ($objects as $object) {
         $prefix = '|';
         if ($object['level'] == 0) {
             $prefix = null;
         }
         $trees[$object['id']] = $prefix . ' ' . str_repeat('- ', $object['level'] * 2) . $object['name'];
     }
     $data['trees'] = $trees;
     $this->template->title = __('Chỉnh sửa thông tin sản phẩm');
     $this->template->section_title = __('Chỉnh sửa thông tin sản phẩm');
     $this->template->content = View::factory('/admin/product/item/edit', $data);
 }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:64,代码来源:product.php

示例3: action_move_down

 public function action_move_down($cat_id = 0)
 {
     $category = ProductCategory::bll()->findOneBy('id', $cat_id);
     if (!$category) {
         Message::error('Không thể tìm thấy danh mục yêu cầu');
         Request::instance()->redirect('/admin/productcategory/index');
     }
     $pre = $category->getNode()->getNextSibling();
     if ($pre) {
         $category->getNode()->moveAsNextSiblingOf($pre);
     }
     Request::instance()->redirect('/admin/productcategory/index');
     //die(print_r($pre->toArray()));
 }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:14,代码来源:productcategory.php

示例4:

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$cat_level_1 = ProductCategory::bll()->getAllLevelOne_Front();
//print_r(Request::instance()->param());
// get current selected category, if has sub => display them
$cat_slug = Request::instance()->param('category_slug');
$in_sub = false;
$selected_parent_slug = '';
$show_sub = '';
// neu la sub cat
if ($cat_slug != '') {
    $select_node = ProductCategory::bll()->getOneBySlug($cat_slug);
    if ($select_node) {
        $in_sub = true;
        $selected_node_id = $select_node['id'];
        if ($select_node['level'] == 1) {
            //get childs next to current
            $selected_parent_slug = $select_node['slug'];
            //$childs = $select_node->getNode()->getChildren();
            $childs = ProductCategory::getNodeChildrens($selected_node_id);
        } else {
            //get from bottom to top
            //$parents = $select_node->getNode()->getAncestors();
            $parents = ProductCategory::getSinglePath($selected_node_id);
            //print_r($parents->toArray());
            if (count($parents) >= 2) {
                $p = $parents[1];
开发者ID:abdul-baten,项目名称:hbcms,代码行数:31,代码来源:_category.php


注:本文中的ProductCategory::bll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。