【发布时间】:2011-10-23 13:38:03
【问题描述】:
我正在构建(php + mySQL)一个应用程序,它使用产品规格来在 Magento 之外生成产品标题。 目前我的代码是这样的:
//select attributes
$sql = "SELECT DISTINCT P.entity_id, P.sku, V.value AS Name, T2.value AS ShortDesc, D.value AS Price
FROM catalog_product_entity AS P INNER JOIN
catalog_product_entity_varchar AS V ON P.entity_id = V.entity_id AND V.attribute_id = 60 LEFT JOIN
catalog_product_entity_text AS T2 ON P.entity_id = T2.entity_id AND T2.attribute_id = 62 LEFT JOIN
catalog_product_entity_decimal AS D ON P.entity_id = D.entity_id AND D.attribute_id = 64";
//Run the query
$query = mysql_query($sql);
//Loop through and print each products info
while($row = mysql_fetch_array($query))
{
echo '<p>';
echo $row['entity_id']." - ".$row['sku']." - ".$row['Name']." - ".$row['ShortDesc']." - ".$row['Price'];
echo '</p>';
}
上面的代码没有我需要的所有属性,所以我使用 phpMyAdmin 查看了 Magento 数据库,但是我在 Magento 的后端中找不到一些产品属性的相应属性 ID。有没有办法查看所有属性及其对应的attribute_id?
【问题讨论】:
标签: mysql magento magento-1.4 magento-1.5 entity-attribute-value