summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Lindsay2012-09-14 09:25:30 (GMT)
committerAnthony Lindsay2012-09-14 09:25:30 (GMT)
commit3449719d60710efdabb34ce7bfccf6ddc2d873c2 (patch)
tree19f97834186109ec6cc957b6be62eb76fdd9ceff
parent63807ea9c1b611a2a704caea06e2473979b7cf0e (diff)
parentc963317166a61c977cab241d91c252fd45591e3e (diff)
Fixed merge conflict.
-rw-r--r--README.txt (renamed from readme.txt)15
-rw-r--r--commerce_popular_products.info11
-rw-r--r--commerce_popular_products.module21
3 files changed, 40 insertions, 7 deletions
diff --git a/readme.txt b/README.txt
index 16f89eb..1c46d1e 100644
--- a/readme.txt
+++ b/README.txt
@@ -21,7 +21,20 @@ module name.
Installation:
Install Views
-Install Commerce
+Install Commerce (& commerce modules).
+Commerce Popular Modules depends on the following Commerce modules:
+commerce_ui
+commerce_cart
+commerce_checkout
+commerce_customer
+commerce_line_item
+commerce_order
+commerce_payment
+commerce_price
+commerce_product
+commerce_product_reference
+commerce_product_pricing
+
Install Commerce Popular Products
Place the block wherever you want it
Set up your products & product displays.
diff --git a/commerce_popular_products.info b/commerce_popular_products.info
index 9845004..9173432 100644
--- a/commerce_popular_products.info
+++ b/commerce_popular_products.info
@@ -5,3 +5,14 @@ core = "7.x"
package = Commerce (Contrib)
dependencies[] = commerce
dependencies[] = views
+dependencies[] = commerce_ui
+dependencies[] = commerce_cart
+dependencies[] = commerce_checkout
+dependencies[] = commerce_customer
+dependencies[] = commerce_line_item
+dependencies[] = commerce_order
+dependencies[] = commerce_payment
+dependencies[] = commerce_price
+dependencies[] = commerce_product
+dependencies[] = commerce_product_reference
+dependencies[] = commerce_product_pricing
diff --git a/commerce_popular_products.module b/commerce_popular_products.module
index 4df68ce..f3c4226 100644
--- a/commerce_popular_products.module
+++ b/commerce_popular_products.module
@@ -199,12 +199,20 @@ function commerce_popular_products_settings_form($form, &$form_state) {
'#description' => t('The title of the "popular products" block as shown to users.'),
'#default_value' => $title,
);
- $form['product_types'] = array(
- '#type' => 'checkboxes',
- '#title' => t('Product Types.'),
- '#description' => t('Product nodes to include in the popularity check.'),
- '#default_value' => $products,
- );
+ if (isset($products)) {
+ $form['product_types'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Product Types.'),
+ '#description' => t('Product nodes to include in the popularity check.'),
+ '#default_value' => $products,
+ );
+ }
+ else {
+ $form['product_types'] = array(
+ '#title' => t('Product Types.'),
+ '#markup' => t('<h4>Product types</h4><p>You have not defined any product types. You need to define some first.</p>'),
+ );
+ }
$product_types = commerce_popular_products_get_product_types();
$options = array();
foreach ($product_types as $type) {
@@ -260,6 +268,7 @@ 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() {
+ $names = array();
$products = commerce_product_types();
foreach ($products as $item) {
$names[] = $item['name'];