Isn't that info available in $data['Category']?  Given the
relationships you've established I think it would be there.

On 8/21/06, ShepherdWeb <[EMAIL PROTECTED]> wrote:
>
> Color and Product are hasAndBelongsToMany to each other
>
> Product belongsTo Category
>
> Category hasMany Product
>
> I'm using this code to show products by color:
>
>
>                 $this->Product->Color->id = $color_id;
>                 $data = $this->Product->Color->read();
>                 $this->set('products', $data['Product']);
>
> this returns this array:
>
> Array
> (
>     [0] => Array
>         (
>             [id] => 51
>             [title] =>  Pink Polka dot Headband
>             [description] => This is our best selling headband!  We
> start with a stretch cotton headband that is oh so comfy, then top it
> off with an adorable light pink and white polka dot grosgrain bow. This
> bow has a pink and white knotted center.  This headband is a classic
> and one your little girl will wear for years! Fits ages 4 months - 4
> years.
>             [inventory] => 2
>             [price] => 4.99
>             [category_id] => 1
>             [sale_date] => 0000-00-00
>             [sale_price] => 0
>         )
>
>     [1] => Array
>         (
>             [id] => 52
>             [title] => Double Ruffle Satin Bow
>             [description] => How could you live without this one?
> Bowhead Babies favorite bow of all, the double ruffle satin bow.  This
> bow is perfect for dresses and casual play clothes.  It has a matching
> satin knotted center and covered scissor clip back.  This bow measures
> 3" and is great for newborn to toddler girls.  It looks great in a lace
> headband or in pigtails! Look at our 5 piece set deal!
>             [inventory] => 5
>             [price] => 3.99
>             [category_id] => 1
>             [sale_date] => 0000-00-00
>             [sale_price] => 0
>         )
>
> )
>
> I would like to be able to return category.title to the view also.  How
> do I do this?
>
>
> >
>


-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to