SELECT
cscart_settings_objects.object_id as object_id,
name,
section_id,
section_tab_id,
type,
position,
is_global,
cscart_settings_objects.name as description,
(
CASE WHEN company_values.object_id IS NOT NULL THEN company_values.value WHEN storefront_values.object_id IS NOT NULL THEN storefront_values.value ELSE cscart_settings_objects.value END
) AS value
FROM
cscart_settings_objects
LEFT JOIN cscart_settings_vendor_values AS company_values ON company_values.object_id = cscart_settings_objects.object_id
AND company_values.company_id = 1
AND company_values.storefront_id = 1
LEFT JOIN cscart_settings_vendor_values AS storefront_values ON storefront_values.object_id = cscart_settings_objects.object_id
AND storefront_values.storefront_id = 1
AND storefront_values.company_id = 0
WHERE
1
AND section_id = 8
AND (
FIND_IN_SET(
'STOREFRONT', cscart_settings_objects.edition_type
)
OR FIND_IN_SET(
'VENDOR', cscart_settings_objects.edition_type
)
OR FIND_IN_SET(
'ROOT', cscart_settings_objects.edition_type
)
OR FIND_IN_SET(
'ULT:STOREFRONT', cscart_settings_objects.edition_type
)
OR FIND_IN_SET(
'ULT:VENDOR', cscart_settings_objects.edition_type
)
OR FIND_IN_SET(
'ULT:ROOT', cscart_settings_objects.edition_type
)
)
AND cscart_settings_objects.type <> 'H'
ORDER BY
cscart_settings_objects.position