This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Alexa94
Alexa94

I have three tables: Orders (id) Order_product_list (id, order_id, product_id, price) Product (id, price)

Only I need that-be price from Product.Price placed Order_product_list.Price .

Tell me how to do it? Which plugins have such a relationship? Thank you!

Crazymodder
Crazymodder

Hi,

What you search for is pivot data. Check documentation here:

http://octobercms.com/docs/backend/relations#belongs-to-many-pivot

Alexa94
Alexa94

Hi Crazymodder, thank you for your answer

Yes, i found this relation in documentation. But there is nothing said about 'automatics write data to pivot table'. With 'pivot' I can write this value only by hand. But I need automatically

Crazymodder
Crazymodder

Sure you can,

Simply do somethink like this in your attach:

attach(1, array('price' => $your_pivot_price));

Last updated

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.