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 = 'en'
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
WHERE
1
AND cscart_pages.company_id IN (0, 137, 138, 146)
AND cscart_pages.page_type IN ('P')
AND cscart_pages.page_id IN (59)
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 <= 1734783077
AND (
cscart_pages.avail_till_timestamp >= 1734783077
OR cscart_pages.avail_till_timestamp = 0
)
)
)
ORDER BY
cscart_pages.position asc,
cscart_page_descriptions.page asc