Commit 163bf5e7 authored by anthonylindsay's avatar anthonylindsay

Fixed coding style errors.

parent 0bb0f27b
......@@ -10,7 +10,7 @@ function commerce_popular_products_get_product() {
$time = variable_get('commerce_popular_products_time', $default = 'month');
$number = variable_get('commerce_popular_products_number', $default = '1');
$products = variable_get('commerce_popular_products_products');
if (isset($products)) {
// Gather information on all the Commerce product reference fields in use.
$fields = field_info_fields();
......@@ -22,7 +22,7 @@ function commerce_popular_products_get_product() {
}
}
}
// Turn the time period into something we can use with FROM_UNIXTIME().
$time_period = '';
switch ($time) {
......@@ -44,7 +44,7 @@ function commerce_popular_products_get_product() {
}
// Create an array to hold all our results for different product types.
$all_results = array();
$all_results = array();
// For each product reference type.
foreach ($product_references as $table) {
// Build query to find the most bought product for the current month.
......@@ -69,7 +69,7 @@ function commerce_popular_products_get_product() {
);
$query->condition(
'co.status',
array('pending', 'complete', 'checkout_complete'),
array('pending', 'complete', 'checkout_complete'),
'in',
);
$product_types = array();
......@@ -80,18 +80,18 @@ function commerce_popular_products_get_product() {
// Deal with the different time periods.
switch ($time) {
case 'day':
$query->where("co.changed > (unix_timestamp(now()) - 86400) ");
$query->where("co.changed > (unix_timestamp(now()) - 86400) ");
break;
case 'week':
$query->where("co.changed > (unix_timestamp(now()) - 604800) ");
$query->where("co.changed > (unix_timestamp(now()) - 604800) ");
break;
case 'month':
$query->where("co.changed > (unix_timestamp(now()) - 2629743) ");
$query->where("co.changed > (unix_timestamp(now()) - 2629743) ");
break;
}
}
$query->groupBy('order_time');
$query->groupBy('cp.product_id');
$query->groupBy('cp.title');
......@@ -144,7 +144,7 @@ function commerce_popular_products_block_info() {
/**
* Implements hook_block_view().
*/
function commerce_popular_products_block_view($delta='') {
function commerce_popular_products_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'popular-product-block':
......@@ -187,7 +187,6 @@ function commerce_popular_products_settings() {
* Produces the Settings Page form.
*/
function commerce_popular_products_settings_form($form, &$form_state) {
// variable_get($name, $default = NULL)
$time = variable_get('commerce_popular_products_time', $default = 'month');
$number = variable_get('commerce_popular_products_number', $default = '1');
$products = variable_get('commerce_popular_products_products');
......@@ -197,13 +196,13 @@ function commerce_popular_products_settings_form($form, &$form_state) {
'#title' => t('Block title.'),
'#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,
);
);
$product_types = commerce_popular_products_get_product_types();
$options = array();
foreach ($product_types as $type) {
......@@ -221,7 +220,7 @@ function commerce_popular_products_settings_form($form, &$form_state) {
'year' => t('Year'),
),
'#default_value' => $time,
);
);
$form['number_display'] = array(
'#type' => 'select',
'#title' => t('Display.'),
......@@ -234,7 +233,7 @@ function commerce_popular_products_settings_form($form, &$form_state) {
'5' => '5',
),
'#default_value' => $number,
);
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'));;
return $form;
}
......@@ -270,10 +269,10 @@ function commerce_popular_products_get_product_types() {
*
* Makes hooking into Views possible.
*/
function commerce_popular_products_views_api() {
function commerce_popular_products_views_api() {
return array(
'api' => 3,
'path' => drupal_get_path('module', 'commerce_popular_products'),
);
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment