summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Lindsay2012-08-24 09:35:17 (GMT)
committerAnthony Lindsay2012-08-24 09:35:17 (GMT)
commit8ee191716cb05a45ab9054e8d00efe84517703ec (patch)
tree1daa24e594cb6ebe878f9c4ceee695cce1683c40
parent7d591d1686b98b6e0a3edb428566c718bfc84f6a (diff)
Revert "Initialised products array when settings empty and removed bad bock region."
This reverts commit 7361150d97f8436fcbd49f37162ff4f642a333f4.
-rw-r--r--commerce_popular_products.module22
1 files changed, 7 insertions, 15 deletions
diff --git a/commerce_popular_products.module b/commerce_popular_products.module
index cb4fefb..4df68ce 100644
--- a/commerce_popular_products.module
+++ b/commerce_popular_products.module
@@ -136,6 +136,7 @@ function commerce_popular_products_block_info() {
// A block To display a popular product.
$blocks['popular-product-block'] = array(
'info' => t('Commerce Popular Products display block'),
+ 'region' => array('Content'),
'weight' => '-50',
);
return $blocks;
@@ -192,19 +193,6 @@ function commerce_popular_products_settings_form($form, &$form_state) {
$number = variable_get('commerce_popular_products_number', $default = '1');
$products = variable_get('commerce_popular_products_products');
$title = variable_get('commerce_popular_products_title', 'Popular Products This Month');
- $product_types = commerce_popular_products_get_product_types();
- $options = array();
-
- foreach ($product_types as $type) {
- $options[$type] = $type;
- }
- if (!isset($products)) {
- $product_array = array();
- foreach ($product_types as $type) {
- $product_array[$type] = 0;
- }
- $products = $product_array;
- }
$form['block_title'] = array(
'#type' => 'textfield',
'#title' => t('Block title.'),
@@ -217,7 +205,11 @@ function commerce_popular_products_settings_form($form, &$form_state) {
'#description' => t('Product nodes to include in the popularity check.'),
'#default_value' => $products,
);
-
+ $product_types = commerce_popular_products_get_product_types();
+ $options = array();
+ foreach ($product_types as $type) {
+ $options[$type] = $type;
+ }
$form['product_types']['#options'] = $options;
$form['time_period'] = array(
'#type' => 'radios',
@@ -244,7 +236,7 @@ function commerce_popular_products_settings_form($form, &$form_state) {
),
'#default_value' => $number,
);
- $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));;
return $form;
}