Is anyone able to shed any light on this??

I've put it aside for a while, but I need to figure this out now. So
anyone able to help?

TIA,
d.

On Aug 5, 12:43 pm, designvoid <[EMAIL PROTECTED]> wrote:
> Oh and I should mention i'm using v1.2
> And...
>
> ...editing and adding new variations via the edit method WORKS! I'm
> confused! It seems to work when the product id is there as a hidden
> field for edit, but it doesnt insert last id when adding a new
> product... hmmm!
>
> On Aug 5, 12:38 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Hi there!
>
> > I'm currently trying to use thesaveAll() function with the following
> > set up:
>
> > Products haveMany Variations
> > Variations belongTo Products
>
> > However when I execute the add function in the Products controller:
>
> > if (!empty($this->data)) {
> >         $this->Product->create();
> >         if ($this->Product->saveAll($this->data)) {
> >                 $this->Session->setFlash(__('The Product has been saved', 
> > true));
> >                 $this->redirect(array('action'=>'index'));
> >         } else {
> >                 $this->Session->setFlash(__('The Product could not be 
> > saved. Please,
> > try again.', true));
> >         }
>
> > }
>
> > The rows are inserted but the the related Variations are missing the
> > Product id!
>
> > The SQL dump shows this:
>
> > START TRANSACTION
> > INSERT INTO `products` (`name`,`price`) VALUES ('save all test',10.00)
> > SELECT LAST_INSERT_ID() AS insertID
> > INSERT INTO `variations`
> > (`name`,`stock`,`price_modifier`,`product_id`) VALUES ('qq',
> > 15,3.00,'')                     SELECT LAST_INSERT_ID() AS insertID
> > INSERT INTO `variations`
> > (`name`,`stock`,`price_modifier`,`product_id`) VALUES ('ww',
> > 15,3.00,'')
> > SELECT LAST_INSERT_ID() AS insertID
> > COMMIT
>
> > Can anyone shed any light on this?
> > TIA!
> > d.
--~--~---------~--~----~------------~-------~--~----~
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