Need some help to make a relationship between products and quantity.
Table1: Products
Columns: id , code, unit, name, size , cost , price
-
Table2: qty_products
Columns: id , product_id , warehouse_id , quantity
the relation between products here is id
from products
and product_id
from qty_products
a simple query for this result is:
SELECT p.id, p.code, p.unit, p.name, p.size, p.cost, p.price, s.quantity, s.warehouse_id FROM products p
INNER JOIN qty_products s ON s.product_id = p.id
this result i need to translate to Grocery CRUD.
function products()
{
$crud = new grocery_CRUD();
$crud->set_table('products');
$crud->set_relation('column','table','column');
$output = $crud->render();
$this->_products($output);
}
Any help is appreciated.