Hi there,
I have 4 table that relate to this problem...
- Products
- Types
- Sizes
- StockItems
I have set CakePHP so that each product has a Type.
I am now sorting out the StockItems controller/views. Each StockItem
will relate to a single Product and will specify the Size of the
StockItem.
My question is... On the StockItem Edit page, how do I limit the Size
drop-down to only display the Sizes that relate to the Type of the
Product?
I started off by trying to get this to work in the Add view, but of
course, the Product for the record was not sat at this point! Doh!
Any help would be appreciated. Here's what I have in my model at the
moment...
var $belongsTo = array(
'Product' => array(
'className' => 'Product',
'foreignKey' => 'product_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Size' => array(
'className' => 'Size',
'foreignKey' => 'size_id',
'conditions' => array('Size.size_type_id' =>
'StockItem.Product.size_type_id'),
// I have also tried with...
// 'conditions' => array('Size.size_type_id' =>
'Product.size_type_id'),
'fields' => '',
'order' => ''
)
);
Thanks,
Toby
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---