Skip to content

Instantly share code, notes, and snippets.

@pollin14
Last active July 20, 2017 15:01
Show Gist options
  • Save pollin14/3633c56f6bdf8070a1cb235b5fac106f to your computer and use it in GitHub Desktop.
Save pollin14/3633c56f6bdf8070a1cb235b5fac106f to your computer and use it in GitHub Desktop.
Dos sentencias SELECT para obtener la relación entre reglas y productos en Magento
SELECT
2,
`cg`.`customer_group_id`,
`p`.`entity_id`,
189796,
1484006400,
1514764799,
'by_percent',
50,
0,
1,
'',
0
FROM `catalog_product_entity` AS `p`
INNER JOIN `catalog_product_flat_2` AS `cpf` ON cpf.entity_id = p.entity_id
LEFT JOIN `catalog_category_product` AS `ccp` ON ccp.product_id = p.entity_id
LEFT JOIN `customer_group` AS `cg` ON cg.customer_group_id IN ('0', '1')
WHERE ((`cpf`.`sku` IN ('36672201', '36672202', '36672203', '36672204', '36672205', '36672206', '36672200'))) AND
(`p`.`entity_id` >= '32572') AND (`p`.`entity_id` < 1032572);
SELECT
2,
`cg`.`customer_group_id`,
`p`.`entity_id`,
201459,
1499126400,
1501372799,
'by_percent',
20,
0,
0,
'by_percent',
20
FROM `catalog_product_entity` AS `p`
INNER JOIN `catalog_product_flat_2` AS `cpf` ON cpf.entity_id = p.entity_id
LEFT JOIN `catalog_category_product` AS `ccp` ON ccp.product_id = p.entity_id
LEFT JOIN `customer_group` AS `cg` ON cg.customer_group_id IN ('0', '1')
WHERE ((`ccp`.`category_id` IN ('2', '15066', '15068', '15069'))) AND (`p`.`entity_id` >= '32572') AND
(`p`.`entity_id` < 1032572)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment