Skip to content

Instantly share code, notes, and snippets.

@klim2020
Last active April 9, 2022 05:21
Show Gist options
  • Save klim2020/218f343a58ea068869fa5aaf77eaf27d to your computer and use it in GitHub Desktop.
Save klim2020/218f343a58ea068869fa5aaf77eaf27d to your computer and use it in GitHub Desktop.
php opencart mysql get all attributes for directory
SELECT ocptc.category_id,
ocp.product_id,
ocp.attribute_id,
ocp.language_id,
ocp.text,
oagd.attribute_group_id,
oagd.name
FROM `oc_category_path`
RIGHT JOIN `oc_product_to_category` ocptc
on ocptc.category_id = oc_category_path.category_id
RIGHT JOIN oc_product_attribute ocp
on ocp.product_id = ocptc.product_id
LEFT JOIN oc_attribute oa
on oa.attribute_id = ocp.attribute_id
LEFT JOIN oc_attribute_group_description oagd
on oagd.attribute_group_id = oa.attribute_group_id
where path_id = 240 ORDER BY `path_id` ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment