Search Products in FLEXIGRID
- Single Page
Posted 09 September 2012 - 10:31 AM
I have used grocerycrud for the first time and i am amazed with the features.
I have a crud rendered with flexigrid. In the table i want a search feature for products as my client has more than 400 products. I know there is a search feature with flexigrid but unable to make it happen when rendered with grocerycrud.
Please guide.
Further,
My client has 100s of products spanned in several categories. Now when the table for products is rendered, i want a dropdown on top listing all the cateogries. The user chooses a category and products under that category should show up. Is this possible with grocerycrud?
Thanks.
Posted 09 September 2012 - 11:17 AM
Show your tables structure and your controllers code.
Posted 10 September 2012 - 16:49 PM
function _example_output($output = null)
{
$data=array();
$data['main']='admin/products';
$data['title']='Products';
$this->load->vars($data);
$this->load->view('admin/form_template',$output);
}
function index()
{
$crud = new grocery_CRUD();
$crud->set_table('products');
$crud->set_subject('Product');
$crud->set_relation('category','categories','name');
$crud->set_field_upload('product_image','product_images/');
$crud->callback_after_upload(array($this,'thumbnailer'));
$crud->columns('name','category');
$crud->change_field_type('description','text');
$output = $crud->render();
$this->_example_output($output);
}
Table consists of following columns:
1. id (AI)
2. name (varchar)
3. category (int)
4. product_image (varchar)
5. price (int)
6. description (shorttext)
Thanks.
Posted 10 September 2012 - 16:53 PM
Do you have an error with this code when you doing search? what specific problems you are having?
Posted 10 September 2012 - 17:26 PM
1. Id (AI)
2. Name (varchar)
3. Furl (varchar)
4. Status (enum)
Posted 10 September 2012 - 17:36 PM
For example :
category
----------
cat_id
cat_name
cat_furl
cat_status.
products
-------------------
id (AI)
name (varchar)
category (int)
product_image (varchar)
price (int)
description (shorttext).
try it.
If you ignore this,you will have this error:
"Column 'name' in where clause is ambiguous".
Helped you in this matter?
Posted 14 September 2012 - 16:56 PM