首页 > 数据库技术 > 详细

magento 的一些Sql查询

时间:2016-05-13 19:06:32      阅读:240      评论:0      收藏:0      [点我收藏+]

1,模拟使用getName()获取产品名称的sql

SELECT `value` AS product_name FROM yo_catalog_product_entity_varchar 

WHERE entity_type_id = (SELECT entity_type_id FROM yo_eav_entity_type WHERE entity_type_code = catalog_product)

AND attribute_id = (SELECT attribute_id FROM yo_eav_attribute WHERE attribute_code = name

AND entity_type_id = (SELECT entity_type_id FROM yo_eav_entity_type WHERE entity_type_code = catalog_product))

技术分享

 

2,Mage::getModel(‘catalog/product‘)->getCollection()的sql输出

SELECT  `e` . * ,  `price_index`.`price` ,  `price_index`.`tax_class_id` ,  `price_index`.`final_price` , IF( price_index.tier_price IS NOT NULL , LEAST( price_index.min_price, price_index.tier_price ) , price_index.min_price ) AS  `minimal_price` ,  `price_index`.`min_price` ,  `price_index`.`max_price` , `price_index`.`tier_price` 
FROM  `yo_catalog_product_entity` AS  `e` 
INNER JOIN  `yo_catalog_product_index_price` AS  `price_index` ON price_index.entity_id = e.entity_id
AND price_index.website_id =  1
AND price_index.customer_group_id =  4
LIMIT 0 , 30

 

SELECT `e` . * , `price_index`.`price` , `price_index`.`tax_class_id` , `price_index`.`final_price` , IF( price_index.tier_price IS NOT NULL , LEAST(price_index.min_price, price_index.tier_price ) , price_index.min_price ) AS `minimal_price` , `price_index`.`min_price` , `price_index`.`max_price` ,`price_index`.`tier_price` 
FROM `yo_catalog_product_entity` AS `e` 
INNER JOIN `yo_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id
AND price_index.website_id = ‘1‘
AND price_index.customer_group_id = ‘4‘
LIMIT 0 , 30

magento 的一些Sql查询

原文:http://www.cnblogs.com/liangsongbai/p/5490228.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!