$this->loadModel('Product');
$this->set('products',$this->Product->find('list',array('product'=>array('products.name' => 'products.price'))));
$this->set(compact('products'));
I am trying to make it so I can display both the product name and it’s price beside each other in the function I am using. So when the drop down is selected, instead of just being “productname” it would be like “productname – $price”.
I am pretty sure this is all the code that needsto be seen.
Simple add the following line in your
Product Model:and try the following code to fetch: