Hi Hipnotik,

You would need a controller and model for the realtion also.

I have the same situation with some of my models and work woth a third model 
which gives me the connection between then like Conncolourproduct.php and 
conncolourproducts_controller.php

Maybe someone has a more clever solution?

Anja

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[EMAIL PROTECTED] Im Auftrag von Hipnotik
Gesendet: Montag, 17. November 2008 11:13
An: CakePHP
Betreff: How to add colour to product? [Models associations/relations, habtm?]


I have problem.
I have 3 tables:
1. products
2. colours
3. colours_products

There are also 2 models:
1. Product
2. Colour
with set up associations
Product model: var $hasAndBelongsToMany = array("Colour"); Colour model: var 
$hasAndBelongsToMany = array("Product");

I created a view with form with 2 select boxes where the first one contain 
products list and second available colours. I would like to select a product 
then select a colour and click on Save button to save
product->colour relation. I have a controller to display data but I
don't know how to create proper add action.

How to save data from form like this?
How form initialization line should be looking (I mean echo $form-
>create("Colour", array("action"=>"add"));)?

Thanks for help



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

Reply via email to