public function getLinkedProductsCriteria($typeCode = null)
{
$criteria = new CDbCriteria();
$criteria->join .= ' JOIN {{store_product_link}} linked ON t.id = linked.linked_product_id';
$criteria->compare('linked.product_id', $this->id);
if (null !== $typeCode) {
$criteria->join .= ' JOIN {{store_product_link_type}} type ON type.id = linked.type_id';
$criteria->compare('type.code', $typeCode);
}
return $criteria;
}