I'm trying to get total no of products from products table where product.store_id = store.id in cakephp to shoq store owner his total products in his store and i'm using containable behavior to get this by this query
$stores = $this->Store->find('all', array(
'contain' => array(
'Product' => array(
'conditions' => array('product.store_id = store.id')
'fields' => array('COUNT(*) AS count')
)
)));
Store HABM products product HABM Store
3 tables
stores products products_stores
But i'm getting empty array of products on view
[Product] => Array
(
)
i know ,i'm not getting product(id, name, other features), but total no of products should be in this array. Or kindly tell me the way to get total products of specific store.
sorry for bad English.