你好(抱歉英语不好)。我尝试为当前目录标签选择最小和最大价格(drupal commerce)。 ATM我把头文件放入PHP代码:
$max = db_query("SELECT MAX(`commerce_price_amount`) FROM {`field_data_commerce_price`}")->fetchField();
所以我可以获得所有产品的最高价格。同样的分钟。 但我需要当前的标签。我的sql表看起来像这样:
table field_data_field_product_catalog: http://postimage.org/image/tahrk3y29/
table field_data_commerce_price: http://postimage.org/image/w1yvkh8kn/
一些建议PLZ?答案 0 :(得分:1)
$catalog=arg(2);
$max = db_query("SELECT MAX(`commerce_price_amount`) FROM {`field_data_field_product_catalog`},{`field_data_commerce_price`}
WHERE {field_data_commerce_price.entity_id}={field_data_field_product_catalog.entity_id}
AND {field_product_catalog_tid}=:cnid", array(':cnid' => $catalog))->fetchField();
$max=Ceil($max/100);