SELECT
pf.feature_id,
pf.company_id,
pf.feature_type,
pf.parent_id,
pf.display_on_product,
pf.display_on_catalog,
pf.display_on_header,
cscart_product_features_descriptions.description,
cscart_product_features_descriptions.internal_name,
cscart_product_features_descriptions.lang_code,
cscart_product_features_descriptions.prefix,
cscart_product_features_descriptions.suffix,
pf.categories_path,
cscart_product_features_descriptions.full_description,
pf.status,
pf.comparison,
pf.position,
pf.purpose,
pf.feature_style,
pf.filter_style,
pf.feature_code,
pf.timestamp,
pf.updated_timestamp
FROM
cscart_product_features AS pf
LEFT JOIN cscart_product_features_descriptions ON cscart_product_features_descriptions.feature_id = pf.feature_id
AND cscart_product_features_descriptions.lang_code = 'es'
INNER JOIN cscart_ult_objects_sharing ON (
cscart_ult_objects_sharing.share_object_id = pf.feature_id
AND cscart_ult_objects_sharing.share_company_id = 1
AND cscart_ult_objects_sharing.share_object_type = 'product_features'
)
WHERE
pf.feature_type = 'G'
AND (
pf.feature_id IN ('')
OR pf.feature_id NOT IN (
SELECT
parent_id
FROM
cscart_product_features
)
)
ORDER BY
pf.position,
cscart_product_features_descriptions.description