Item::search PHP Method

    public function search()
    {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.
        $criteria = new CDbCriteria();
        $criteria->order = 'item_id desc, sort_order asc';
        $criteria->compare('item_id', $this->item_id, true);
        $criteria->compare('category_id', $this->category_id, true);
        $criteria->compare('title', $this->title, true);
        $criteria->compare('sn', $this->sn, true);
        $criteria->compare('unit', $this->unit, true);
        $criteria->compare('stock', $this->stock);
        $criteria->compare('min_number', $this->min_number, true);
        $criteria->compare('market_price', $this->market_price, true);
        $criteria->compare('shop_price', $this->shop_price, true);
        $criteria->compare('currency', $this->currency, true);
        $criteria->compare('skus', $this->skus, true);
        $criteria->compare('props', $this->props, true);
        $criteria->compare('props_name', $this->props_name, true);
        $criteria->compare('item_imgs', $this->item_imgs, true);
        $criteria->compare('prop_imgs', $this->prop_imgs, true);
        $criteria->compare('pic_url', $this->pic_url, true);
        $criteria->compare('desc', $this->desc, true);
        $criteria->compare('location', $this->location, true);
        $criteria->compare('post_fee', $this->post_fee, true);
        $criteria->compare('express_fee', $this->express_fee, true);
        $criteria->compare('ems_fee', $this->ems_fee, true);
        $criteria->compare('is_show', $this->is_show);
        $criteria->compare('is_promote', $this->is_promote);
        $criteria->compare('is_new', $this->is_new);
        $criteria->compare('is_hot', $this->is_hot);
        $criteria->compare('is_best', $this->is_best);
        $criteria->compare('is_discount', $this->is_discount);
        $criteria->compare('click_count', $this->click_count, true);
        $criteria->compare('sort_order', $this->sort_order);
        $criteria->compare('create_time', $this->create_time, true);
        $criteria->compare('update_time', $this->update_time, true);
        $criteria->compare('language', $this->language, true);
        return new CActiveDataProvider($this, array('criteria' => $criteria));
    }

Usage Example

Example #1
0
 public static function search($values = array())
 {
     $result1 = DB::getInstance()->search("category", $values);
     if (count($result1) != 0) {
         $category_data = array("cat_name" => $result1[0]["category_name"], "cat_label" => $result1[0]["category_no"]);
         $new_category = new Category();
         $new_category->set_name($result1[0]["category_name"]);
         $new_category->set_label($result1[0]["category_no"]);
         $itemList = DB::getInstance()->search("item_category", array("category_id" => $result1[0]["category_id"]));
         foreach ($itemList as $item) {
             $new_category->addItem(Item::search(array("item_id" => $item["item_id"])));
         }
         return $new_category;
     } else {
         return null;
     }
 }
All Usage Examples Of Item::search