If the Order & Customer associations re good then you can grab the latter's data through the former model, eg. $this->Order->Customer->whatever()
You can make the route however you want. It could also just be "/orders/add/:customer_id", for example. Router::connect( '/orders/new/:customer_id', array('controller' => 'orders', 'action' => 'add'), array('customer_id' => '[0-9]+', 'pass' => array('customer_id')) ); The add() method doesn't normally take a param but it's easy to do so. function add($customer_id = null) { if (!empty($this->data)) { ... if ($this->Order->save($this->data)) { ... } } /* prepare to show form */ if (!empty($customer_id)) { $this->data = $this->Order->Customer->read(null, $customer_id); } } view: debug($this->data); // to check that it worked echo $form->hidden('Customer.id'); echo $form->input('Customer.first_name'); ... On Sat, Mar 27, 2010 at 5:20 AM, mivogt-LU <c...@mivogt.net> wrote: > Hello again, as usual I use the weekend to ask what the week collected > me working with cake... > > In my app I have several models and all works fine so far. > i.e. I have a customer model and an order model > > I am able to use the baked add funtion to add customers and orders > as the order has a customer_id field I am able to select the customer > the order should be done for. > > Now I would like to have a button next to the customer in the customer- > list (index view) to quick-start a new order having the customer field > already filled with the customer_id from the selected custome. > > As far as I understood, it has to be done a new action inside the > customer controller > i.e. customerDoNewOrder() that is calling the order-controller action > baked as add-action. > > My problems are I have no idea how to start adding a new button in the > index view and how to do the transfer of information between the 2 > models; mean getting the customer_id from the indexview and calling > the order_add_action from order controller to get a prefilled > order_add_view. > > Any hints and code a realy welcome. Thanks in advance for all you > might give me. > > CU > > Michael > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > > To unsubscribe from this group, send email to > cake-php+unsubscribegooglegroups.com or reply to this email with the words > "REMOVE ME" as the subject. > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.