public static function _validation_valid_product($val) { if (self::_empty($val)) { return true; } return Model_Base_Product::valid_field('id', $val); }
public function action_edit($id = null) { if (empty($id) || !Model_Base_Product::valid_field('id', $id)) { Response::redirect('/admin/product'); } $this->data['category'] = Model_Base_Category::get_all(); $this->data['product'] = Model_Base_Product::get_one($id); $this->data['product']['category'] = Model_Base_ProductCategory::get_by('category_id', 'product_id', $id); $this->data['product']['sub_photo'] = Model_Base_Product::get_sub_photo($id); $this->template->content = View::forge($this->layout . '/product/edit', $this->data); }