You can try out one workaround that I use for myself.
It works for me, not sure for you, so give it a try alright?

Create a model specifically for your HABTM table.
When you do that, you are going to need a primary key set for that
table.
So you will need to modify your database table.

When you save your data, save it in this format:

Array(
   [model_name] => Array(
      ["cart_id"] => 1,
      ["product_id"] => 2,
      ["quantity"] => 999,
   )
)

Highly doubt it will conflict with the actual HABTM linking, but I
hope this has helped you in any way...

On Jan 29, 5:08 am, red <[EMAIL PROTECTED]> wrote:
> Hi,
> I have two models: Cart and Product, theHABTMrelation and
> carts_products table.
>
> Now I have action connecting carts and products (without form):
> blabla/carts/add/16/product_id:2
>
> So I build data like this andsave:
> array(2) {
>   ["Cart"]=>
>   array(1) {
>     ["id"]=>
>     string(2) "16"
>   }
>   ["Product"]=>
>   array(1) {
>     ["Product"]=>
>     array(1) {
>       [0]=>
>       string(1) "2"
>     }
>   }
>
> }
>
> Works perfect. Now I want to add extra column toHABTMtable -
> quanitity. I've added, and tried to prepare data for saving like this:
>
> array(2) {
>   ["Cart"]=>
>   array(1) {
>     ["id"]=>
>     string(2) "16"
>   }
>   ["Product"]=>
>   array(1) {
>     ["Product"]=>
>     array(1) {
>       [0]=>
>       array(2) {
>         ["product_id"]=>
>         string(1) "2"
>         ["quantity"]=>
>         string(1) "1"
>       }
>     }
>   }
>
> }
>
> And it doesn't work :( I've read some posts and faq, but haven't
> worked out my problem.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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