summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Lindsay2012-09-14 08:30:50 (GMT)
committerAnthony Lindsay2012-09-14 08:30:50 (GMT)
commit63807ea9c1b611a2a704caea06e2473979b7cf0e (patch)
tree074657c484e84a2d37467fb3c9e9234ca9066f84
parent25c8818c6596aefb48652b7bc6f2518e1eb599f1 (diff)
Changed sql query to find product types to use Commerce api call.
-rw-r--r--commerce_popular_products.module10
1 files changed, 6 insertions, 4 deletions
diff --git a/commerce_popular_products.module b/commerce_popular_products.module
index 1d5f0d1..4df68ce 100644
--- a/commerce_popular_products.module
+++ b/commerce_popular_products.module
@@ -179,7 +179,7 @@ function commerce_popular_products_menu() {
function commerce_popular_products_settings() {
$output = t('<p>Here you can define which product types are ranked for popularity & the period over which they are ranked.</p>');
$form = drupal_get_form('commerce_popular_products_settings_form');
- $output .= render( &$form);
+ $output .= render(&$form);
return $output;
}
@@ -260,9 +260,11 @@ function commerce_popular_products_settings_form_submit($form, &$form_state) {
* A simple query to return all the Commerce product types in the database.
*/
function commerce_popular_products_get_product_types() {
- $sql = 'SELECT name from {commerce_product_type}';
- $result = db_query($sql)->fetchCol();
- return $result;
+ $products = commerce_product_types();
+ foreach ($products as $item) {
+ $names[] = $item['name'];
+ }
+ return $names;
}