SELECT
cscart_pages.*,
cscart_page_descriptions.*,
cscart_seo_names.name as seo_name,
cscart_seo_names.path as seo_path
FROM
cscart_pages
LEFT JOIN cscart_page_descriptions ON cscart_pages.page_id = cscart_page_descriptions.page_id
AND cscart_page_descriptions.lang_code = 'no'
LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = cscart_pages.page_id
AND cscart_seo_names.type = 'a'
AND cscart_seo_names.dispatch = ''
AND cscart_seo_names.lang_code = 'en'
LEFT JOIN cscart_polls ON cscart_polls.page_id = cscart_pages.page_id
INNER JOIN cscart_ult_objects_sharing ON (
cscart_ult_objects_sharing.share_object_id = cscart_pages.page_id
AND cscart_ult_objects_sharing.share_company_id = 1
AND cscart_ult_objects_sharing.share_object_type = 'pages'
)
WHERE
1
AND cscart_pages.page_type IN ('P')
AND cscart_pages.page_id IN (30)
AND (
cscart_pages.usergroup_ids = ''
OR FIND_IN_SET(0, cscart_pages.usergroup_ids)
OR FIND_IN_SET(1, cscart_pages.usergroup_ids)
)
AND (
cscart_pages.use_avail_period = 'N'
OR (
cscart_pages.use_avail_period = 'Y'
AND cscart_pages.avail_from_timestamp <= 1731596400
AND (
cscart_pages.avail_till_timestamp >= 1731596400
OR cscart_pages.avail_till_timestamp = 0
)
)
)
ORDER BY
cscart_pages.position asc,
cscart_page_descriptions.page asc