I’m putting together a multi-store e-commerce site that has different descriptions for some of the items, depending on the store.
Here is a basic layout of the tables:
product
[i]-id
-published[/i]
product_description
[i]-store_id
-product_id
-name
-description[/i]
The relation I have setup right now in Product is:
'description'=>array(self::HAS_ONE, 'ProductDescription', 'product_id',
'condition'=>'store_id=:store_id',
'params'=>array(':store_id'=>1)
),
This works, but only grabs the description for Store 1. Store 1 is the default store that has all descriptions.
The problem is when I switch this to store_id = 2. I need this relation to check to see if there is a product_description available for a particular product in Store 2, and if it does not find one, default back to Store 1.
Can someone help me figure out how to write that?
Thanks!